propertiesmediamodelica

How to find saturated vapor density using Modelica.Media.Water library?


For liquid water at atmospheric pressure (approx. 101420 Pa), I would like to determine the corresponding saturated vapor density (directly across the Pv curve) using the Modelica.Media.Water library.

I've been following the Modelica.Media.Examples.TwoPhaseWater example and figured out how to get the density of the saturated liquid. However, I'm stuck trying to figure out how to get the corresponding vapor state and its density.


model Example_3


  parameter Modelica.Units.SI.Pressure p = 101420;
  replaceable package Medium = Modelica.Media.Water.StandardWater ;
  
  
  Medium.ThermodynamicState satLiquidState;
  Medium.ThermodynamicState satVaporState;

  Modelica.Units.SI.Temperature T_sat;
  
  Modelica.Units.SI.Density rho_f;
  Modelica.Units.SI.Density rho_g;

  Real nu_f(unit="kg/m3");
  Real nu_g(unit="kg/m3");
 
  Medium.SaturationProperties dew "Dew line Properties";
  
equation
  satVaporState = Medium.setDewState(dew);
  T_sat = Medium.saturationTemperature(p);
  satLiquidState = Medium.setState_pT(p,T_sat);
 
  rho_f = satLiquidState.d;
  nu_f = 1/rho_f;
  rho_g = satVaporState.d;
  nu_g = 1/rho_g;
end Example_3;


through simple lookup, I can see that the property values should be
νg = 1.6941 m3/kg or ρg = 0.5903 kg/m3
νf = 0.001043 m3/kg or ρf = 958.7728 kg/m3


Solution

  • Here is a working example

    model Example_4
      parameter Modelica.Units.SI.Pressure p = 101420;
      replaceable package Medium = Modelica.Media.Water.StandardWater;
    
      Modelica.Units.SI.Temperature T_sat;
    
      Modelica.Units.SI.Density rho_f;
      Modelica.Units.SI.Density rho_g;
    
      Modelica.Units.SI.SpecificVolume nu_f;
      Modelica.Units.SI.SpecificVolume nu_g;
    
      Medium.SaturationProperties dew "Dew line Properties";
    equation 
      dew.psat = p;
      dew.Tsat = T_sat;
    
      T_sat = Medium.saturationTemperature(p);
      rho_f = Medium.bubbleDensity(dew);
      nu_f = 1/rho_f;
      rho_g = Medium.dewDensity(dew);
      nu_g = 1/rho_g;
    end Example_4;
    

    There are several alternative method to set the satuation state. You could also use dew = Medium.setSat_p(p); instead of

    dew.psat = p;
    dew.Tsat = T_sat;