usnistgov / REFPROP-wrappers

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

Error message in Python: [THFLSH error 248] Single-phase iteration did not converge for T = 43.0000 K and H = 675.320 J/mol. #338

Closed malteradecke closed 3 years ago

malteradecke commented 3 years ago

Hello,

I found an issue using REFPROP in Python. While trying to obtain the physical properties for Parahydrogen with the following call:

 for iFlag in 0,1:
        r = RP.REFPROPdll("PARAHYD","HT","P,CPvap",MASS_BASE_SI,1,iFlag,h_2h2,T_2h2,z)
        p_2h2 = r.Output[0] 
        print('p_2h2 = ',p_2h2,' Pa', r.herr)
        cp_2h2 = r.Output[1]

I'm getting this error message:

T_2h2 =  42.97916031858583  K
h_2h2 =  335280.0  J
p_2h2 =  -9999990.0  Pa [THFLSH error 248] Single-phase iteration did not converge for T = 42.9792 K and H = 675.884 J/mol.
p_2h2 =  -9999990.0  Pa [THFLSH error 248] Single-phase iteration did not converge for T = 42.9792 K and H = 675.884 J/mol.

I already modified my original code relatin to the saturation spline call. Im new to using REFPROP and also Python, so it would be amazing if you could help me with this problem.

Versions

REFPROP Version: 10.0002 Operating System and Version: Windows 10 Home Access Method: REFPROP for Python (Version 3.8.5) while using Spyder (Version 4.1.5) as IDE

ianhbell commented 3 years ago

Can you please show your entire code?

ianhbell commented 3 years ago

My first guess is that this is a problem of reference states. Can you define this input in terms of things that don't have a reference state in them (temperature, pressure, density)? That will help to sanity check your input. Also, TH are tricky inputs because of the multiple solutions, but it seems you are already somewhat clear on that.

malteradecke commented 3 years ago

Thank you for the fast answer, the reference state hint helped me a lot! I found the problem: In the end i made a fundamental thermodynamic mistake and failed to make some assumptions.