Sure thing. Apologies for the insufficient description ealier. I was trying to keep it short but after spending another day with this problem I realised this is way more complex :D
- mixture properties using Peng-Robinson EoS
- mixture properties in the two-phase region
Regarding the first problem (1): I set all property methods in Aspen to the standard Peng-Robinson method which should be the same as the one implemented in CoolProp. For pure fluids (methane, ethane, propane and nitrogen) I get property values which are close enough to assume the methods are similar enough. As far as I know I turned off all non-standard alpha-functions or volume corrections. When I do the same calculations for a 50/50 mixture of methane and ethane the densities are practically the same, but everything else deviates way more. I calculated entropy, enthalpy, heat capacity, isentropic expansion coefficient and density for temperatures from 100 to 300 K and pressures from 1 to 21 bar in Aspen and CoolProp. The tables show the mean and maximum absolute deviation from the Aspen values in percent. In regard to the second problem, the data for the mixture is cleaned from all data points that are in the two-phase region according to the Aspen data, as those data points were even further off or could not be computed.
Methane:
property mean deviation / % max
deviation
/ %
____________________________________________________________________
totalEntropy 0.1054 0.328845
vaporEntropy 0.0788673 0.0865843
liquidEntropy 0.184282 0.328845
totalEnthalpy 0.128219 0.342046
vaporEnthalpy 0.106786 0.149505
liquidEnthalpy 0.19194 0.342046
totalHeatCapacity 0.115254 0.380907
vaporHeatCapacity 0.098544 0.380907
liquidHeatCapacity 0.164933 0.21431
totalExpansionCoefficient 0.155593 0.301243
vaporExpansionCoefficient 0.148849 0.161466
liquidExpansionCoefficient 0.240105 0.653065
totalDensity 0.100435 0.356001
vaporDensity 0.0203411 0.171851
liquidDensity 0.338551 0.356001
Methan[0.5]&Ethane[0.5]
property
mean deviation / % max
deviation
/ %
___________________________________________________________________
totalEntropy
54.1622 67.7097
vaporEntropy
60.6791 67.7097
liquidEntropy
45.9937 52.8483
totalEnthalpy
32.8982 49.2161
vaporEnthalpy
26.5181 31.7697
liquidEnthalpy
40.8952 49.2161
totalHeatCapacity
62.8988 80.908
vaporHeatCapacity
74.8701 80.908
liquidHeatCapacity
47.8936 49.3701
totalExpansionCoefficient
3192.22 33342.3
vaporExpansionCoefficient
5673.56 33342.3
liquidExpansionCoefficient
81.9964 158.258
totalDensity
0.127352 0.297458
vaporDensity
0.0105603 0.0445371
liquidDensity
0.273741 0.297458
The deviations for the other pure fluids (ethane, propane and nitrogen) are bigger but nowhere near the mixture deviations.
The AbstractState is initialized like this:
methaneAndEthane = AbstractStateFactory["PR", "Methane&Ethane"];
AbstractStateSetFractions[methaneAndEthane, {0.5, 0.5}]
AbstractStateSetBinaryInteraction[methaneAndEthane, 0, 1, "kij", -0.0026]
The second problem (2) concerns the properties in the two-phase region. Using temperature and pressure as inputs for states with a low quality (<0.2-0.3) CoolProp will fail to calculate the "total" value, which means that no phase is imposed and it should be in the two phase region. For bigger quality values, not imposing a phase will return the value for the gas phase. From what I can gather in the source code for CoolProp::AbstractCubicBackend::solver_rho_Tp "two-phase" cannot be imposed and Q is always set to -1 in the function.
Trying to use the inputs that contain the quality (QT_INPUTS or PQ_INPUTS) also does not always work. QT will fail for all quality inputs that are neither 0 or 1 (Error: Inputs in Brent [50.000000,10000.000000] do not bracket the root.), PQ has worked so far and at least the resulting densities are the same as in Aspen.
One other weird thing I noticed: After building the phase envelope, updating the State with QT_INPUTS will result in an Assertion Failure, other inputs will still work. What exactly does building the phase envelope do? I haven't really figured that out yet...
I hope this makes the problem a bit clearer. If not I'll try again :D