usnistgov / REFPROP-issues

A repository solely used for reporting issues with NIST REFPROP
26 stars 13 forks source link

Question about RP.ABFLSHdll #688

Open nse6fe opened 2 days ago

nse6fe commented 2 days ago

Hi together

I used ABFLSHdll to caculate the saturation points of propane for T = 273.15 K. I expect the output of saturated liquid propane enthalpy 200 kJ/kg at 273.15 K.

Here is the relevant code I typed in python jupyter notebook:

RP.SETFLUIDSdll("PROPANE"); result = RP.ABFLSHdll("TQ", 273.15, 0, [1.0], 1)

Here is result. I see an enthalpy of h=193.7491375095284 in the result.

ABFLSHdlloutput(T=273.15, P=474.45684662403505, D=528.5938031426816, Dl=11.987444629255279, Dv=0.2347291835892758, x=array('d', [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), y=array('d', [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), q=0.0, e=192.0038557199406, h=193.7491375095284, s=0.764069435466772, Cv=3.0562905115638936, Cp=4.8477499459951225, w=885.470667777689, ierr=0, herr='')

Did I use the subroutine ABFLSHdll wrongly? Thx

Versions

REFPROP Version: 10.0 Operating System and Version: Windows 10 **Access Method: Python wrapper of REFPROP

ianhbell commented 2 days ago

Please read our most frequently asked question: https://pages.nist.gov/REFPROP-docs/#reference-states-enthalpy-and-entropy-differences

nse6fe commented 2 days ago

Please read our most frequently asked question: https://pages.nist.gov/REFPROP-docs/#reference-states-enthalpy-and-entropy-differences

Thank you for the quick answer. I test it again with the SETREFdll routine to ensure IIR-Reference-State:

MASS_BASE_SI = RP.GETENUMdll(0, "MASS BASE SI").iEnum RP.SETFLUIDSdll("PROPANE"); icomp = 1 RP.SETREFdll("IIR", icomp, z, -1,-1,-1,-1) # -1 are placeholders, not needed, but must be passed r1 = RP.REFPROPdll("","TQ","P;H",RP.MASS_BASE_SI,0,0,273.15,0,[1.0]) r2 = RP.ABFLSHdll("TQ", 273.15, 0, [1.0], 1) print(r1.Output[0:2]) print(r2)

here the result. ABFLSHdll and REFPROPdll show different enthalpy value, while the result of REFPROPdll is correct.

array('d', [474456.8466240351, 199999.99999999994]) ABFLSHdlloutput(T=273.15, P=474.45684662403505, D=528.5938031426816, Dl=11.987444629255279, Dv=0.23472918358927608, x=array('d', [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), y=array('d', [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), q=0.0, e=387.13945884729196, h=388.8847406368798, s=1.9444237031843998, Cv=3.0562905115638936, Cp=4.8477499459951225, w=885.470667777689, ierr=0, herr='')

nse6fe commented 2 days ago

Furthermore, a comment in the linked tutorial is somehow misleading: https://github.com/usnistgov/REFPROP-wrappers/blob/master/wrappers/python/notebooks/Tutorial.ipynb

In the cell [21], the comment above the last function call says "This should be back to IIR again". But the resulting enthalpy is neither back to IIR, nor the former NBP. Does this example show intentionally this result, or is it some issue in the code?

ianhbell commented 1 day ago

Yes, that is a bug in REFPROP