usnistgov / REFPROP-issues

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

Issues with water/hydrogen two phase mixtures #583

Open owensmithNREL opened 1 year ago

owensmithNREL commented 1 year ago

REFPROP Version: REFPROP 10.0 Operating System and Version: Windows 10 Access Method: GUI, Python wrapper

We have an issue where we are trying to calculate the water vapor take-up of saturated hydrogen/water as it flows through a phase separator. We are interested in primarily the mass fraction of the water (i.e. 100% RH water content) and how it varies with temperature and pressure as it travels through our system to the end wet-gas use.

I believe there may be a bug/issue or perhaps I am not using it correctly.

I have put down my ratio of hydrogen to water as 16/84 mass fraction to match the actual output stream out of our electrolyzers, but this is not a critical variable as I’m only looking at the vapor portion. I am using both the 10.0 GUI and the Python refprop wrapper.

At 1 MPa absolute, the outputs from 10-100C perform pretty much as expected and correlate reasonably close with the values obtained here for H2 at 100% RH http://go.vaisala.com/humiditycalculator/ as spot checks.

hydrogen 1 mpa

At around ambient pressures (0.1 MPa, gage pressure not turned on), I get odd behavior at colder temps. The superheated values above 80C are expected as the hydrogen would absorb all of the water and still not reach 100% humidity. However, at 10-20C it fails to detect any liquid portion and states that it is entirely gaseous – which makes no sense to me. Cool, ambient hydrogen above water would remain a two-phase mixture. The two-phase vapor mass fractions also start to diverge from what I get from the external humidity calcs (the Vaisala calculator seems to have its own issues at these pressures and throws multiple errors)

hydrogen 01 mpa

Slightly increasing the pressures mitigates this but still present at 10C. I would expect a very small amount of water vapor in the hydrogen as 2-phase at 10C, about 0.05 per the Vaisala calc.

hydrogen 02 mpa

When attempting to tabulate the vapor/liquid saturation points, it fails for anything under 50C. Some errors I got were “SATT error 124, Iteration did not converge for T=283.15 K” (when calculating liquid at 10C) and “One or more inputs are out of range: Pressure below zero. P = -0.155286 MPa” when calculating vapor at 10C

hydrogen saturation

Trying out 10C and 0.1 MPa at various compositions fails to detect any 2-phase points, and fails above about 80% water, giving me a TPFL2 226 “2-phase iteration did not converge”.

hydrogen var composition

I reproduced this in Python, with the same results. I saw some issues on Github about turning on iFlag to call SATSPLN and resolve errors. I tried this, but all it seems to have done is change the estimated phase from saturated liquid to superheated gas in the last table above if I vary the composition between 15-80% water. For the same inputs of 0.16/0.84 at 10C/0.1 MPa, it simply breaks with a SATSPLN error 355 fail.

Temp = 10 #C Pres = 0.1 #MPa Comp = [0.16,0.84] #mass fraction iUnits = RP.GETENUMdll(0, 'SI WITH C').iEnum

rstr = RP.REFPROPdll('Hydrogen (normal) * water','TP', 'PHASE', iUnits, 1, 1, Temp, Pres, Comp) #1, 0 for mass fraction and SATSPLN off H_XVAPstring = rstr.hUnits print(H_XVAPstring, 'phase state for ' + str(Comp) + ' total composition at ' + str(Temp) + 'C and ' + str(Pres) + 'MPa')

r = RP.REFPROPdll('Hydrogen (normal) * water','TP', 'XMASSVAP|DVAP|QMASS', iUnits, 1, 1, Temp, Pres, Comp) #1, 0 for mass fraction and SATSPLN off H_XVAP = r.Output[0] W_XVAP = r.Output[1] #for mixtures, the compositions are returned as array of x components HW_DVAP = r.Output[2] HW_QUAL = r.Output[3] print(H_XVAP, 'vapor hydrogen composition') print(W_XVAP, 'vapor water composition') print(HW_DVAP, 'vapor density kg/m3') print(HW_QUAL, 'quality kg/kg') print(r.herr)

Any thoughts? I did see the comments about humid air not working great, so perhaps I’m simply using REFPROP for something it was never intended for. I could look at going about this in a more roundabout way using only the water vapor pressures.

Thank you for your expert assistance.

(Reposted from email)

ianhbell commented 1 year ago

As I mentioned in our email correspondence, the thermodynamic model for hydrogen + water in REFPROP is a placeholder, as you can see from the 1.0 for the interaction parameters:

?Hydrogen/Water                                            [H2/H2O]
?Kunz and Wagner (2007)
  8d757b40/b43a7600
    KW0      1.             1.             1.             1.             0.             0.             0. 0. 0. 0. 0. 0.
    TC7      0.             0.             0.             0.             0.             0.             0. 0. 0. 0. 0. 0.
    VC7      0.             0.             0.             0.             0.             0.             0. 0. 0. 0. 0. 0.

REFPROP doesn't alert you to this because this is technically a "fitted" model because it is provided in the HMX.BNC even though it is a placeholder, and I would argue this should never have been added in the first place.

Second point is that there are a few bugs in the REFPROPdll function when you provide mass-based compositions. These bugs are not present when you use mole-based compositions, so I recommend you do so too. Or use the CoolProp interface around REFPROP, which doesn't have the bugs and allows for the use of mass fractions properly. But then you have to get familiar with the CoolProp interface too.

owensmithNREL commented 1 year ago

Ian,

Thank you for the information. I was able to find the HMX.BNC file in the FLUIDS folder, and it is informative.

For multi-component mixtures of more than 2 fluids, is a binary pair calculated for each combination? Ex. methane-hydrogen-water would be methane-hydrogen, methane-water and then hydrogen-water?

What does it mean if the TC/VC values are all zero but there are values for the KW* parameters? Example would be the methane/water or nitrogen/water mixtures, as well as multiple H2 mixtures. Are these combinations also not to be trusted?

Thank you for the info on mole fractions as well. I updated both the GUI and the Python code to use mole fractions to be safe, and it matches the mass fractions pretty much everywhere, bugs and all (phase errors, SATSPLN crashing, etc.)

ianhbell commented 1 year ago

Can you shoot me an email? I think it might make sense to chat about this offline. All good questions. I'll updated this thread after our discussion.

ianhbell commented 1 year ago

ian.bell@nist.gov