usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
193 stars 127 forks source link

Entropy value calculated by ABFLSHdll is diffenent with the output of REFPROP program 10.0 #488

Closed HuaxiaGoodBoy closed 2 years ago

HuaxiaGoodBoy commented 2 years ago

Description The entropy of pre-mixutures calculated by ABFLSHdll is diffenent with the output of REFPROP program 10.0. With the inputs below, the entropy value calculated by ABFLSHdll is 167.88 kJ/kmol-K, but in RREFPROP 10.0, the results is 160.45 kJ/kmol-K.

Code

from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary

RP = REFPROPFunctionLibrary('D:\Work\RefLib\REFPRP64.DLL', 'dll') RP.SETPATHdll('D:\Work\RefLib') r = RP.SETMIXTUREdll('R404A') T = -15 + 273.15 # -15°C P = 250 # kPa res = RP.ABFLSHdll('TP', T, P, r.z, iFlag=100) print(res[10]) # Overall entropy [kJ/kmol-K] 167.88024783816886

image

image

ianhbell commented 2 years ago

Did you set the reference states to the same? If not, differences are to be expected. Default reference states in Excel and GUI are different.

HuaxiaGoodBoy commented 2 years ago

Thanks a lot for your reply. I set the reference state of GUI and REFPRP64.DLL to NBP, but the results are still different. One is 87.57, the other is 93.90. image

Python code from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary

RP = REFPROPFunctionLibrary('D:\Work\RefLib\REFPRP64.DLL', 'dll') RP.SETPATHdll('D:\Work\RefLib') r = RP.SETMIXdll('R404A.MIX','HMX.BNC','NBP') T = -15 + 273.15 # -15°C P = 250 # kPa res = RP.ABFLSHdll('TP', T, P, r.z, iFlag=000) print(res[10]) # Overall entropy [J/mol-K] 93.90379321907498

ABFLSHdll output ABFLSHdlloutput(T=258.15, P=250.0, D=0.125668662246214, Dl=0.125668662246214, Dv=0.125668662246214, x=array('d', [0.357816784026318, 0.0382639950410712, 0.603919220932611, 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', [0.357816784026318, 0.0382639950410712, 0.603919220932611, 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=998.0, e=19503.944754471082, h=21493.303083997915, s=93.90379321907498, Cv=72.33871229546226, Cp=84.65677656529236, w=148.32313671017135, ierr=0, herr='')

HuaxiaGoodBoy commented 2 years ago

I think I found the reason, the "Apply reference state to" need to be set "Eacn pure conponent", and the results match. Anyway, I really appreciate your tip and help.

image