Closed daveknippers closed 1 month ago
Probably the saturation splines are on in the GUI and not enabled in your code.
Well, credit's due, adding a single flag to my call fixed my issue. Thank you!
Hi @daveknippers Could you share how you set the flag? I'm not familiar with this API usage and any suggestion will be much appreciated!
from what i remember setting the 6th argument to 1 turns splines on.
calc = rp.REFPROPdll(rp_species_string, k, tout, MASS_BASE_SI,0,1,v1,v2,rp_moles)
after splines are on, you can manually deactivate them with a FLAGSdll call for future calculations.
rp.FLAGSdll('Splines off',1)
calc = REFPROPdll(rp_species_string, k, tout, MASS_BASE_SI,0,0,v1,v2,rp_moles)
in certain cases my solutions failed to converge with splines on, so it was necessary to manage.
@daveknippers thanks a lot!
Description
I'm attempting to use REFPROP's API to predict the phase of mixtures. There's a discrepancy between what I'm seeing in the REFPROP GUI and the return values from the API.
The mixture is a simple hydrocarbon, 0.85 mole fraction Methane and 0.15 mole fraction Ethane. This mixture should be in a supercritical state. The REFPROP GUI states the phase as supercritical as expected, as shown in this attachment:
For each row, the highlighted portions were the inputs.
This mixture should be a single phase at that temperature and pressure. Instead, the REFPROP API predicts it's a two phase mixture.
We use the REFPROP api to calculate the density based on the temperature and pressure (TP -> D), then we feed that density back into refprop's api and call it again to get the temperature (DP -> T)
That doesn't jive with the GUI returns.
Using either density or the temperature as inputs along side pressure, the phase is predicted to be two-phase:
When vapor is forced (or liquid, for that matter), the calculated phase and temperature agrees with the GUI (and Coolprop):
This bug is similar to https://github.com/usnistgov/REFPROP-issues/issues/626 but it also shows an issue with calculation of temperature from density.
Steps to Reproduce
Expected behavior:
Actual behavior:
Versions
REFPROP Version: 10.0
Operating System and Version: Linux, Windows Access Method: python 3.11