usnistgov / REFPROP-wrappers

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

SETUP error 117 in Matlab using Water and Toluene #239

Closed jojorim closed 4 years ago

jojorim commented 4 years ago

Hey! I have an issue calculating properties of a mixture containing both water and toluene. When I try to use this mixture, i get the response

[SETUP error 117] Estimation of mixing parameters is not possible for most mixtures containing water, heavy water, helium, hydrogen, parahydrogen, deuterium, neon, ammonia, fluorine, methanol, or ethanol.

I am trying to calculate the temperature I get when mixing a hot stream of water (92% at 250°C) with a cold stream of toluene (8% at 20°C) at 11 bar. Here's my code:

zeta.N = 0.92; % mass fraction Water
zeta.T = 0.08; % mass fraction Toluene

T.N = 250 + 273.15; % Temperature in K
T.T = 20 + 273.15;

P.N = 1100; % Pressure in kPa
P.T = 1100;

h.N = refpropm('H','T',T.N,'P',P.N,'Water');
h.T = refpropm('H','T',T.T,'P',P.T,'Toluene');
h.mix = (zeta.N * h.N + zeta.T * h.T)/(sum([zeta.N, zeta.T]));

T.mix = refpropm('T','P',P.N,'H',h.mix,'Toluene','Water',[zeta.T zeta.N]);

If I understand it right, the issue is that refprop doesn't really know how these two substances interact in the liquid and two-phase region. But since I will end up in the gaseous region, and both substances can be seen as ideal gases, the interaction is negligible. Also, the calculations don't have to be very precise since it's just a first estimation. Can I somehow "tell" matlab to ignore this error, or is that not a good idea? Is there another workaround?

Thanks in advance

ianhbell commented 4 years ago

It's not a good idea to blindly ignore warnings like these :) In short, a pressure of 1.1 MPa isn't all that low, so real-gas effects are definitely relevant and should not be ignored. Modeling mixtures with water are very challenging because they tend to be very asymmetric, and yield some very funky (but correct) mixture behaviors, which is why, absent a lot of data, we disable the estimation schemes in order to not deceive users by our confidence.

P.S. Please transition to the Python-based interface in MATLAB. It is much more fully-featured and the refpropm interface is no longer supported.