usnistgov / REFPROP-issues

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

Sound speed doesn't match literature values for ethanol/water mixtures #672

Open scott-c-jensen opened 1 month ago

scott-c-jensen commented 1 month ago

The sound speeds output for ethanol/water mixtures do not match experimental. Particularly of note is that the refprop sound speed decreases with ethanol fraction at low (<.2) fractions and experimentally it increases.

I get the following from refprop (using the python wrapper)

image

expected from literature https://pubs.aip.org/asa/jasa/article-abstract/19/4/701/763632/Ultrasonic-Velocity-in-Ethanol-Water-Mixtures?redirectedFrom=PDF image

https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=87312b79da693a4bcc1143834a9f1dd4ded85fbe image

I assume this has to do with how the mixture is calculated. I am also interested if density is an issue for water/ethanol mixtures.

Basic example of a single refprop call:

import os from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary os.environ['RPPREFIX'] = r'C:/Program Files (x86)/REFPROP' RP = REFPROPFunctionLibrary(os.environ['RPPREFIX']) RP.SETPATHdll(os.environ['RPPREFIX']) MOLAR_BASE_SI = RP.GETENUMdll(0, "MOLAR BASE SI").iEnum

molar_frac_eth = 0.05 tc = 20 molar_frac_w = 1-molar_frac_eth fluid = f'water;{molar_frac_w} * ethanol;{molar_frac_eth}' r = RP.REFPROPdll(fluid, 'TPL', 'D w', MOLAR_BASE_SI, 0,0, tc + 273.15, 101325, [molar_frac_w, molar_frac_eth])

ianhbell commented 1 month ago

I think this seems to be a problem with the model. I agree with the result you see. With the code (aside: don't put the composition in the fluid string):

import os
import numpy as np
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
import matplotlib.pyplot as plt 

os.environ['RPPREFIX'] = os.getenv('HOME') + '/REFPROP10'
RP = REFPROPFunctionLibrary(os.environ['RPPREFIX'])
RP.SETPATHdll(os.environ['RPPREFIX'])

for TC in np.arange(5, 55, 10):
    molar_frac_eth = np.linspace(0, 1)
    molar_frac_w = 1-molar_frac_eth
    fluid = f'ethanol*water'
    xx, yy = [], []
    for i in range(len(molar_frac_eth)):
        z = [molar_frac_eth[i], molar_frac_w[i]]
        r = RP.REFPROPdll(fluid, 'TP', 'D;W', RP.MOLAR_BASE_SI, 0,0, TC + 273.15, 101325, z)
        xx.append(z[0])
        yy.append(r.Output[1])
    plt.plot(xx, yy, label=rf'T={TC} C')
plt.gca().set(xlabel=r'$x_{\rm EtOH}$ / mole frac.', ylabel='$w$ / m/s')
plt.legend()
plt.show()

I get:

image

@nist-aharvey do you see any reason why the REFPROP model should have this behavior?

nist-aharvey commented 1 month ago

Alcohol-water mixtures in the liquid phase tend to have unusual behaviors with composition, I think depending on whether one can easily fit into the hydrogen bond network of the other. The normal mixture model in REFPROP would be unlikely to be able to reproduce such extrema; I expect it would take a special fitting effort paying attention to reproducing these features, perhaps with a complicated departure function. I don't know where the current mixture model for ethanol/water in REFPROP came from. At some point I think there was an interest in distillation, so perhaps attention was paid to the VLE without worrying about reproducing liquid-phase extrema (especially extrema in derivative properties like sound speed -- I would hope it might do better on the density).

It should be pretty easy to see how well REFPROP does on the mixture liquid density -- data for that are even in the CRC Handbook as I recall (and/or Perry's ChemE Handbook) and should be findable online.

ianhbell commented 1 month ago

What should be implemented is the model from Eckermann's PhD dissertation. Her SOS is much better:

image

I thought that was the default model in REFPROP but it seems I was wrong. It is of the same general model formulation so in principle it should be possible to add. I will have to coordinate this with @EricLemmon.

scott-c-jensen commented 1 month ago

Alcohol-water mixtures in the liquid phase tend to have unusual behaviors with composition, I think depending on whether one can easily fit into the hydrogen bond network of the other. The normal mixture model in REFPROP would be unlikely to be able to reproduce such extrema; I expect it would take a special fitting effort paying attention to reproducing these features, perhaps with a complicated departure function. I don't know where the current mixture model for ethanol/water in REFPROP came from. At some point I think there was an interest in distillation, so perhaps attention was paid to the VLE without worrying about reproducing liquid-phase extrema (especially extrema in derivative properties like sound speed -- I would hope it might do better on the density).

It should be pretty easy to see how well REFPROP does on the mixture liquid density -- data for that are even in the CRC Handbook as I recall (and/or Perry's ChemE Handbook) and should be findable online.

Not sure if this difference is worth it for you to go after but there are dynamics in the ethanol/water mixture for density not captured in Refprop. Here is the comparison, where ICT is the international critical tables the CRC handbook references, but does not copy perfectly (at least in some editions). Note: in all cases I just assume the pressure is 1 atm.

image

https://reader.library.cornell.edu/docviewer/digital?id=chla2944761_2172#mode/1up
International critical tables of numerical data, physics, chemistry and technology: Volume III. (1928)

It may be easier to see the trends with the less crowded graphs with more temperatures. image image

Unfortunately I was hopeful to extend this to temperatures and pressures that are not reported with an accuracy higher than what Refprop gives in the range, so I am currently out of luck on this one.

ianhbell commented 1 month ago

I don't think it is worth to go deeper until the model from Eckermann is implemented.

nist-aharvey commented 1 month ago

Just for the record on the small differences between the CRC Handbook and the International Critical Tables. It looks like the ICT was tabulating g/ml based on the definitions 100 years ago, when the liter and milliliter were defined relative to water at its density maximum near 4 degC (1 g of H2O = 1 ml). But since then, the SI definition of the liter has changed; it was disconnected from the properties of water in 1964. So any old tabulations in terms of g/ml need to be corrected based on the actual density of water at that condition, which if memory serves is 0.999975 g/ml. Of course that correction only matters for very precise data, but the NBS measurements of ethanol/water densities that I think the ICT was based on were pretty good. It looks like the CRC applied that correction to get their density values.

This history of how a "ml" is no longer defined the same as it was 100 years ago is described briefly here: https://en.wikipedia.org/wiki/Litre

Edit: Another way of saying the above is that, from 1901 to 1964, the cubic centimeter and the milliliter were slightly different quantities, while since 1964 they have been identical by definition.

scott-c-jensen commented 1 month ago

Thanks, I did forget to adjust for the standards changes on that one, so thanks for the reminder! I actually haven't checked the CRC vs ICT myself, I just know I have seen a paper where they used the values from CRC and mentioned it had a couple data entry issues that needed to be corrected to match the ICT. I don't remember which edition it was.