Open GaelEnee opened 1 year ago
Apologies,
After a double check, I would rather modify the expression in Modelica.Media.Air.ReferenceMoistAir.massFraction_pTphi
:
X := {phi*k_mair/(p/pds - phi),1 - phi*k_mair/(p/pds - phi)};
by:
X := {k_mair/(k_mair + p/pds/phi -1),1 - k_mair/(k_mair + p/pds/phi -1)};
Sorry.
Adding a link to the two functions in question directly
ReferenceMoistAir https://github.com/modelica/ModelicaStandardLibrary/blob/c15f9d3bea31db7a03904248c81c77f26bb6cb2f/Modelica/Media/Air/ReferenceMoistAir.mo#L232-L245
@GaelEnee Could you help me understand this quicker by elaborating what is wrong and why? Is the corrected version taken from any reference? Do you possibly have a test model that demoes the wrong result?
I'm sorry for the delay, here is the demonstration:
X_steam = m_steam / (m_steam + m_air) = n_steam ' M_H2O / (n_steam ' M_H2O + n_air ' M_air) = n_steam / (n_steam + n_air ' M_air/M_H2O) = (n_steam/n_sat) / (n_steam/n_sat + n_air/n_sat *' M_air/M_H2O)
with ideal gas assumption : pV = nRT = (p_steam/p_sat) / (p_steam/p_sat + p_air/p_sat *' M_air/M_H2O)
by definition : phi = p_steam/p_sat = phi / (phi + p_air/p_sat *' M_air/M_H2O)
with p_air = p - p_steam = phi / (phi + (p - p_steam)/p_sat ' M_air/M_H2O) = phi / (phi + (p - phi ' p_sat)/p_sat ' M_air/M_H2O) = phi / (phi + (p/p_sat - phi) ' M_air/M_H2O) = phi ' M_H2O/M_air / (phi ' M_H2O/M_air + p/p_sat - phi)
with k = M_H2O/M_air, X_steam = phi'k / (phi'k + p/p_sat - phi)
According to this, the function is MoistAir.massFraction_pTphi is correct and the one ReferenceMoistAir.massFraction_pTphi is to be corrected
Just glancing quickly at this, there appears to be at least one wrong assumption that may be guiding you to a wrong conclusion: Note that ReferenceMoistAir doesn't follow ideal gas law (like the non-reference version).
Hello, The presumed mistake I reported looks much like a scripting mistake to me. Getting rid of the ideal gas assumption for passing from the 4th to the 5th equation would involve the compressibility modulus Z of steam and air (pV=Z(p, T)nRT) and would result in a much more complicated final expression for X_steam. If you can get in touch with the original author of the function, he might provide an relevant advice about it.
Hello,
I would like to report an error in Modelica.Media.Air.MoistAir.massFraction_pTphi.
I suggest the replacement of :
by :
Thanks !