Peng-Robinson (PR)¶
Peng-Robinson cubic equation of state (1976) with the van der Waals one-fluid mixing rules and binary interaction parameters kij from the databank. The general-purpose package for hydrocarbons, natural gas and light gases.
DWSIM.Thermodynamics.PropertyPackages.PengRobinsonPropertyPackage
Assembly DWSIM.Thermodynamics.dll · Object ← PropertyPackage ← PengRobinsonPropertyPackage
Name in the flowsheet Peng-Robinson (PR) · FluentAPI PropertyPackages.PengRobinson
Scope¶
The general-purpose equation of state of DWSIM for hydrocarbons and the light gases that come with them (N2, CO2, H2S, H2): natural gas, gas processing, refinery light ends, compression and expansion, high-pressure vapor-liquid equilibrium. The same equation gives the fugacity coefficients of both phases, so the package works from vacuum to well above the critical pressure of the mixture.
The Peng-Robinson (1976) equation, P = RT/(V - b) - a(T)/[V(V + b) + b(V - b)], takes the co-volume b = 0.07780 RTc/Pc and the attraction parameter a = 0.45724 (R2Tc2/Pc) α(T), with α = [1 + m(1 - Tr1/2)]2 and m = 0.37464 + 1.54226ω - 0.26992ω2. Mixtures use the van der Waals one-fluid rules, am = ΣΣ xixj(aiaj)1/2(1 - kij) and bm = Σ xibi. The cubic in Z has up to three roots; the liquid takes the smallest and the vapor the largest. Enthalpy and entropy are the ideal-gas values (from the ideal gas heat capacity) plus the departure functions of the equation.
Parameters. Tc, Pc and ω come from the compound database. The binary
interaction parameters kij come from a databank shipped with DWSIM; a pair that is not in it has
kij = 0. They can be changed in the package editor, or from code with
ConfigurePR(c => c.WithKij(...)) as in the example, and are saved with the flowsheet.
Liquid density. By default the liquid density comes from the experimental data of the compound, or the Rackett equation where there are none. The equation-of-state density, with the Peneloux volume translation, is an option of the package settings. The volume shift corrects the liquid molar volume and leaves the phase equilibrium unchanged.
Derivatives. The package provides analytical temperature and composition derivatives of the fugacity coefficients, which the vapor-fraction flashes and the rigorous column solvers use.
Limitations¶
- Two-parameter cubic equations predict liquid molar volumes poorly, which is why the default liquid density comes from correlations.
- Polar and associating liquids (water with alcohols, glycols, acids) are outside the model. Use NRTL or UNIQUAC at low pressure, or the CPA and SAFT models of ThermoPack.
- A missing kij is zero. For pairs that matter (CO2, H2S, N2 or H2 with hydrocarbons; methane with heavy ends) check that the databank has a value.
- A stream with a single compound (mole fraction above 0.99999) is flashed on the vapor pressure curve of the compound database, so its saturation pressure is that of the correlation.
- For heavy hydrocarbons (ω above 0.49) Peng-Robinson 1978 gives better vapor pressures with the same parameters.
Example¶
This code runs on every build of this site, and the output below is what it printed.
gas = ["Methane", "Ethane", "Propane", "N-butane", "N-pentane", "N-hexane"]
z = [0.88, 0.06, 0.03, 0.015, 0.01, 0.005] # mole fractions
fs = (Flowsheet.Create("PengRobinsonExample")
.WithCompounds(*gas)
.WithPropertyPackage(PropertyPackages.PengRobinson))
methane = (fs.AddMaterialStream("Methane")
.At(Q.Celsius(25.0), Q.Bar(50.0))
.SetCompoundMolarFlow("Methane", 1.0))
cold = fs.AddMaterialStream("Gas at -20 C").At(Q.Celsius(-20.0), Q.Bar(50.0))
dew = fs.AddMaterialStream("Dew point").WithPressure(Q.Bar(50.0)).WithVaporFraction(1.0)
for name, x in zip(gas, z):
cold.SetCompoundMolarFlow(name, x)
dew.SetCompoundMolarFlow(name, x)
# the same gas with kij(methane, n-hexane) = 0 in place of the databank value, set through
# the typed package configuration (an extension method, called as a static method from Python)
fs0 = PropertyPackageConfigExtensions.WithPropertyPackage(
Flowsheet.Create("NoKij").WithCompounds(*gas), PropertyPackages.PengRobinson,
Action[PropertyPackageBuilder](lambda pp: pp.ConfigurePR(
Action[PRConfig](lambda c: c.WithKij("Methane", "N-hexane", 0.0)))))
dew0 = fs0.AddMaterialStream("Dew point").WithPressure(Q.Bar(50.0)).WithVaporFraction(1.0)
for name, x in zip(gas, z):
dew0.SetCompoundMolarFlow(name, x)
fs.Solve()
fs0.Solve()
pr = list(fs.Inner.PropertyPackages.Values)[0].__implementation__
kij = pr.m_pr.InteractionParameters["Methane"]["N-hexane"].kij
m, s = methane.Object.Phases[2].Properties, cold.Object
print(f"Methane density = {m.density:.2f} kg/m3 (Z = {m.compressibilityFactor:.4f})")
print(f"Vapor fraction = {s.Phases[2].Properties.molarfraction:.4f} (gas at -20 C)")
print(f"Vapor density = {s.Phases[2].Properties.density:.2f} kg/m3")
print(f"Methane in liquid = {s.Phases[3].Compounds['Methane'].MoleFraction:.4f} (mole fraction)")
print(f"Dew point = {dew.Object.GetTemperature() - 273.15:.2f} C (kij methane/n-hexane = {kij:.4f})")
print(f"Dew point, kij = 0 = {dew0.Object.GetTemperature() - 273.15:.2f} C")
Output
Methane density = 35.63 kg/m3 (Z = 0.9082)
Vapor fraction = 0.9451 (gas at -20 C)
Vapor density = 54.72 kg/m3
Methane in liquid = 0.3333 (mole fraction)
Dew point = 23.97 C (kij methane/n-hexane = 0.0400)
Dew point, kij = 0 = 23.81 C
DWSIM 10.2.11.0, generated 2026-10-08.
Property methods¶
How the package calculates each property, as it reports it in PropertyMethodsInfo (the property package editor shows the same list).
| Property | Method |
|---|---|
| Vapor fugacity | Peng-Robinson EOS |
| Liquid fugacity | Peng-Robinson EOS |
| Vapor enthalpy, entropy, Cp/Cv | Peng-Robinson EOS |
| Liquid enthalpy, entropy, Cp/Cv | Peng-Robinson EOS |
| Vapor density | Peng-Robinson EOS (+VT) |
| Liquid density | Peng-Robinson EOS (+VT) / Experimental / Rackett / COSTALD |
| Vapor viscosity | Experimental / Lucas / Jossi-Stiel-Thodos |
| Liquid viscosity | Experimental / Letsou-Stiel |
| Vapor thermal conductivity | Experimental / Ely-Hanley |
| Liquid thermal conductivity | Experimental / Latini |
| Surface tension | Experimental / Brock-Bird |
| Solid density | Experimental Data / User-Defined |
| Solid enthalpy, entropy, Cp/Cv | Experimental Solid Cp / From Liquid Phase Enthalpy + Enthalpy of Fusion |
Default flash algorithm: Universal.
Configuration saved with the flowsheet¶
The package writes its settings to the simulation file (SaveData) and reads them back on load (LoadData). The elements below are the ones this package adds to those of every property package, as written for the example.
| Element | Content in the example | What it holds |
|---|---|---|
InteractionParameters |
14 InteractionParameter entries (Compound1, Compound2, Value) |
kij (Value) of the pairs of the flowsheet compounds, from the databank or entered in the package editor |
First InteractionParameter of InteractionParameters in the example
Settings common to every property package, as saved for the example
| Element | Value |
|---|---|
Type |
65 characters |
ComponentName |
Peng-Robinson (PR) |
ComponentDescription |
|
Tag |
Peng-Robinson (PR) |
UseHenryConstants |
true |
AutoEstimateMissingNRTLUNIQUACParameters |
true |
UseImmiscibleListForLiquid2InitialEstimates |
true |
SingleCompoundCheckThreshold |
0.99999 |
OverrideKvalFugCoeff |
false |
OverrideEnthalpyCalculation |
false |
OverrideEntropyCalculation |
false |
LiquidDensityCalculationMode_Subcritical |
Rackett_and_ExpData |
LiquidDensityCalculationMode_Supercritical |
Rackett_and_ExpData |
LiquidDensity_CorrectExpDataForPressure |
true |
LiquidDensity_UsePenelouxVolumeTranslation |
true |
LiquidViscosityCalculationMode_Subcritical |
ExpData |
LiquidViscosityCalculationMode_Supercritical |
Letsou_Stiel |
LiquidViscosity_CorrectExpDataForPressure |
true |
LiquidViscosity_MixingRule |
MoleAverage |
VaporPhaseFugacityCalculationMode |
Ideal |
SolidPhaseFugacityCalculationMethod |
FromLiquidFugacity |
SolidPhaseFugacity_UseIdealLiquidPhaseFugacity |
false |
SolidPhaseEnthalpy_UsesCp |
false |
EnthalpyEntropyCpCvCalculationMode |
LeeKesler |
LiquidEnthalpyEntropyCpCvCalculationMode_EOS |
EOS |
LiquidFugacity_UsePoyntingCorrectionFactor |
true |
ActivityCoefficientModels_IgnoreMissingInteractionParameters |
false |
IgnoreVaporFractionLimit |
false |
IgnoreSalinityLimit |
false |
CalculateAdditionalMaterialStreamProperties |
true |
FlashCalculationApproach |
NestedLoops |
DisplayMissingCompoundPropertiesWarning |
false |
ForcedSolids |
[] |
PropertyOverrides |
{} |
FlashSettings |
36 Setting entries |
Learn more¶
-
User guide
-
Used with
-
Tutorials
-
FluentAPI
API members¶
Public members declared by this class. Inherited members are documented on the base classes.
Constructors¶
PengRobinsonPropertyPackage(bool)
| Parameter | Type | Description |
|---|---|---|
comode |
Boolean |
Properties¶
DisplayDescription
DisplayName
ImplementsAnalyticalDerivatives
MobileCompatible
Methods¶
AUX_CM(object)
| Parameter | Type | Description |
|---|---|---|
Vx |
Object |
AUX_CM(Phase)
| Parameter | Type | Description |
|---|---|---|
Phase |
Phase |
AUX_VAPDENS(double, double)
| Parameter | Type | Description |
|---|---|---|
T |
Double |
|
P |
Double |
AUX_Z(double[], double, double, PhaseName)
| Parameter | Type | Description |
|---|---|---|
Vx |
Double[] |
|
T |
Double |
|
P |
Double |
|
state |
PhaseName |
CalcIsothermalCompressibility(IPhase)
| Parameter | Type | Description |
|---|---|---|
p |
IPhase |
CalcJouleThomsonCoefficient(IPhase)
| Parameter | Type | Description |
|---|---|---|
p |
IPhase |
DisplayEditingForm()
DW_CalcCompPartialVolume(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
phase |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcCp_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcCv_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcdKdComposition(double[], double[], double, double, State, string): Composition (mole-number) derivative of the equilibrium K-values, d(K_i)/dn_j, with respect to the mole numbers of...
Composition (mole-number) derivative of the equilibrium K-values, d(K_i)/dn_j, with respect to the mole numbers of the phase indicated by withRespectTo (State.Liquid perturbs Vx, State.Vapor perturbs Vy), on a total-moles = 1 basis. Returns an (nc x nc) matrix. Base implementation is a finite difference; EOS/activity packages override it using the analytical d(ln phi)/dn (or d(ln gamma)/dx) building blocks.
| Parameter | Type | Description |
|---|---|---|
Vx |
Double[] |
|
Vy |
Double[] |
|
T |
Double |
|
P |
Double |
|
withRespectTo |
State |
|
type |
String |
DW_CalcdKdT(double[], double[], double, double, string)
| Parameter | Type | Description |
|---|---|---|
Vx |
Double[] |
|
Vy |
Double[] |
|
T |
Double |
|
P |
Double |
|
type |
String |
DW_CalcdLnFugCoeffdn(double[], double, double, State): Composition (mole-number) derivative of the natural logarithm of the fugacity coefficients, d(ln phi_i)/dn_j, for...
Composition (mole-number) derivative of the natural logarithm of the fugacity coefficients, d(ln phi_i)/dn_j, for the given phase, evaluated on a total-moles = 1 basis. Returns an (nc x nc) matrix. Base implementation is a finite difference in mole numbers; EOS/activity packages override this with the closed-form partial-molar expression.
| Parameter | Type | Description |
|---|---|---|
Vx |
Double[] |
|
T |
Double |
|
P |
Double |
|
st |
State |
DW_CalcdLnFugCoeffdT(double[], double, double, State): Temperature derivative of the natural logarithm of the fugacity coefficients, d(ln phi_i)/dT, for the given phase.
Temperature derivative of the natural logarithm of the fugacity coefficients, d(ln phi_i)/dT, for the given phase. Base implementation is a forward finite difference; EOS/activity packages override this with a closed-form expression. Distinct from DW_CalcdFugCoeffdT, which returns d(phi)/dT (not the logarithm).
| Parameter | Type | Description |
|---|---|---|
Vx |
Double[] |
|
T |
Double |
|
P |
Double |
|
st |
State |
DW_CalcEnergyFlowMistura_ISOL(double, double)
| Parameter | Type | Description |
|---|---|---|
T |
Double |
|
P |
Double |
DW_CalcEnthalpy(Array, double, double, State): Calculates the enthalpy of a mixture.
Calculates the enthalpy of a mixture.
| Parameter | Type | Description |
|---|---|---|
Vx |
Array |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature (K) |
P |
Double |
Pressure (Pa) |
st |
State |
State enum indicating the state of the mixture (liquid or vapor). |
DW_CalcEnthalpyDeparture(Array, double, double, State): Calculates the enthalpy departure of a mixture.
Calculates the enthalpy departure of a mixture.
| Parameter | Type | Description |
|---|---|---|
Vx |
Array |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature (K) |
P |
Double |
Pressure (Pa) |
st |
State |
State enum indicating the state of the mixture (liquid or vapor). |
DW_CalcEntropy(Array, double, double, State): Calculates the entropy of a mixture.
Calculates the entropy of a mixture.
| Parameter | Type | Description |
|---|---|---|
Vx |
Array |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature (K) |
P |
Double |
Pressure (Pa) |
st |
State |
State enum indicating the state of the mixture (liquid or vapor). |
DW_CalcEntropyDeparture(Array, double, double, State): Calculates the entropy departure of a mixture.
Calculates the entropy departure of a mixture.
| Parameter | Type | Description |
|---|---|---|
Vx |
Array |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature (K) |
P |
Double |
Pressure (Pa) |
st |
State |
State enum indicating the state of the mixture (liquid or vapor). |
DW_CalcFugCoeff(Array, double, double, State): Calculates fugacity coefficients for the specified composition at the specified conditions.
Calculates fugacity coefficients for the specified composition at the specified conditions.
| Parameter | Type | Description |
|---|---|---|
Vx |
Array |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature in K |
P |
Double |
Pressure in Pa |
st |
State |
Mixture state (Liquid or Vapor) |
DW_CalcFugCoeff(double[], double, double): Calculates fugacity coefficients for the specified composition at the specified conditions.
Calculates fugacity coefficients for the specified composition at the specified conditions.
| Parameter | Type | Description |
|---|---|---|
Vz |
Double[] |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature in K |
V |
Double |
Volume in m3/mol |
DW_CalcK_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcMassaEspecifica_ISOL(Phase, double, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
|
pvp |
Double |
DW_CalcMM_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcOverallProps()
DW_CalcP(double[], double, double): Calculates system pressure for the specified temperature, volume and composition.
Calculates system pressure for the specified temperature, volume and composition.
| Parameter | Type | Description |
|---|---|---|
Vz |
Double[] |
Vector of doubles containing the molar composition of the mixture. |
T |
Double |
Temperature in K |
V |
Double |
Volume in m3/mol |
DW_CalcPhaseProps(Phase)
| Parameter | Type | Description |
|---|---|---|
Phase |
Phase |
DW_CalcProp(string, Phase): Provides a wrapper function for CAPE-OPEN CalcProp/CalcSingleProp functions.
Provides a wrapper function for CAPE-OPEN CalcProp/CalcSingleProp functions.
| Parameter | Type | Description |
|---|---|---|
property |
String |
The property to be calculated. |
phase |
Phase |
The phase where the property must be calculated for. |
DW_CalcPVAP_ISOL(double)
| Parameter | Type | Description |
|---|---|---|
T |
Double |
DW_CalcTensaoSuperficial_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
DW_CalcViscosidadeDinamica_ISOL(Phase, double, double)
| Parameter | Type | Description |
|---|---|---|
Phase1 |
Phase |
|
T |
Double |
|
P |
Double |
RET_KIJ(string, string)
| Parameter | Type | Description |
|---|---|---|
id1 |
String |
|
id2 |
String |
ReturnCriticalPoints()
RunPostMaterialStreamSetRoutine()
SupportsComponent(ICompoundConstantProperties)
| Parameter | Type | Description |
|---|---|---|
comp |
ICompoundConstantProperties |
Fields¶
ClassId