packageTemperatureDependentDensity

Package with model for liquid water with temperature-dependent density

Extends from Modelica.Media.Interfaces.PartialPureSubstance (Base class for pure substances of one chemical substance), Modelica.Icons.Package (Icon for standard packages).

Information

This medium package models liquid water.

The mass density is computed using a 3rd order polynomial, which yields the density as a function of temperature as shown in the figure below. Note, however, that computing density as a function of temperature can lead to considerably slower computing time compared to using Buildings.Media.Water in which the density is a constant. We therefore recommend to use Buildings.Media.Water for typical building energy simulations.

Mass density as a function of temperature

For the specific heat capacities at constant pressure and at constant volume, a constant value of 4184 J/(kg K), which corresponds to 20°C is used. The figure below shows the relative error of the specific heat capacity that is introduced by this simplification. Using a constant value for the specific heat capacity allows to compute temperature from enthalpy without having to solve an implicit equation, and therefore leads to faster simulation.

Relative variation of specific heat capacity with temperature

Thermal conductivity is calculated as a function of temperature as shown in the figure below. The correlation used to calculate the thermal conductivity is

λ(T) = λ(298.15 K) ⋅ (-1.48445+4.12292⋅(T/298.15)-1.63866⋅(T/298.15)2),

where λ(298.15 K) = 0.6065 W/(m ⋅ K) is the adopted standard value of the thermal conductivity of water at 298.15 K and 0.1 MPa.

Thermal conductivity as a function of temperature

Dynamic viscosity is calculated as the product of density and kinematic viscosity, both temperature dependent. However, the kinematic viscosity has its own temperature dependent correlation, implemented at Buildings.Media.Specialized.Water.TemperatureDependentDensity.kinematicViscosity. Results of the kinematic viscosity as a function of temperature are shown in the figure below.

Kinematic viscosity as a function of temperature

The enthalpy is computed using the convention that h=0 if T=0 °C.

Limitations

Phase changes are not modeled.

Parameters

TypeNameDefaultDescription
Modelica.Media.Interfaces.Choices.IndependentVariablesThermoStates (from PartialMedium)Enumeration type for independent variables
StringmediumName (from PartialMedium)"unusablePartialMedium"Name of the medium
String[:]substanceNames (from PartialMedium){mediumName}Names of the mixture substances. Set substanceNames={mediumName} if only one substance.
String[:]extraPropertiesNames (from PartialMedium)fill("", 0)Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused
BooleansingleState (from PartialMedium)= true, if u and d are not a function of pressure
BooleanreducedX (from PartialMedium)true= true, if medium contains the equation sum(X) = 1.0; set reducedX=true, if only one substance (see docu for details)
BooleanfixedX (from PartialMedium)false= true, if medium contains the equation X = reference_X
AbsolutePressurereference_p (from PartialMedium)101325Reference pressure of Medium: default 1 atmosphere
Temperaturereference_T (from PartialMedium)298.15Reference temperature of Medium: default 25 deg Celsius
MassFraction[nX]reference_X (from PartialMedium)fill(1/nX, nX)Default mass fractions of medium
AbsolutePressurep_default (from PartialMedium)101325Default value for pressure of medium (for initialization)
TemperatureT_default (from PartialMedium)Modelica.Units.Conversions.from_degC(20)Default value for temperature of medium (for initialization)
SpecificEnthalpyh_default (from PartialMedium)specificEnthalpy_pTX(p_default, T_default, X_default)Default value for specific enthalpy of medium (for initialization)
MassFraction[nX]X_default (from PartialMedium)reference_XDefault value for mass fractions of medium (for initialization)
ExtraProperty[nC]C_default (from PartialMedium)fill(0, nC)Default value for trace substances of medium (for initialization)
IntegernS (from PartialMedium)size(substanceNames, 1)Number of substances
IntegernX (from PartialMedium)nSNumber of mass fractions
IntegernXi (from PartialMedium)if fixedX then 0 else if reducedX then nS - 1 else nSNumber of structurally independent mass fractions (see docu for details)
IntegernC (from PartialMedium)size(extraPropertiesNames, 1)Number of extra (outside of standard mass-balance) transported properties
Real[nC]C_nominal (from PartialMedium)1.0e-6*ones(nC)Default for the nominal values for the extra properties
Modelica.Units.SI.SpecificHeatCapacitycp_const4184Specific heat capacity at constant pressure

Contents

NameDescription
FluidConstants
ThermodynamicStateThermodynamic state variables
BasePropertiesBase properties
densityReturn the density
dynamicViscosityReturn the dynamic viscosity
specificEnthalpyReturn the specific enthalpy
enthalpyOfLiquidReturn the specific enthalpy of liquid
specificInternalEnergyReturn the specific enthalpy
specificEntropyReturn the specific entropy
specificGibbsEnergyReturn the specific Gibbs energy
specificHelmholtzEnergyReturn the specific Helmholtz energy
isentropicEnthalpyReturn the isentropic enthalpy
isobaricExpansionCoefficientReturn the isobaric expansion coefficient
isothermalCompressibilityReturn the isothermal compressibility factor
density_derp_TReturn the partial derivative of density with respect to pressure at constant temperature
density_derT_pReturn the partial derivative of density with respect to temperature at constant pressure
density_derXReturn the partial derivative of density with respect to mass fractions at constant pressure and temperature
specificHeatCapacityCpReturn the specific heat capacity at constant pressure
specificHeatCapacityCvReturn the specific heat capacity at constant volume
thermalConductivityReturn the thermal conductivity
pressureReturn the pressure
temperatureReturn the temperature
molarMassReturn the molar mass
setState_dTXReturn thermodynamic state from d, T, and X or Xi
setState_phXReturn the thermodynamic state as function of pressure p, specific enthalpy h and composition X or Xi
setState_pTXReturn the thermodynamic state as function of p, T and composition X or Xi
setState_psXReturn the thermodynamic state as function of p, s and composition X or Xi
der_specificHeatCapacityCpprotectedReturn the derivative of the specific heat capacity at constant pressure
der_enthalpyOfLiquidprotectedTemperature derivative of enthalpy of liquid per unit mass of liquid
kinematicViscosityprotectedReturn the kinematic viscosity

Revisions

  • April 5, 2022, by Michael Wetter:
    Corrected assignment of R_s in BaseProperties to avoid a unit error.
    This is for #1603.
  • July 7, 2016, by Carles Ribas Tugores:
    Correct Documentation. This is for #487.
  • June 6, 2015, by Michael Wetter:
    Set AbsolutePressure(start=p_default) and Temperature(start=T_default) to have to have conistent start values. See also revision notes of Buildings.Media.Water. This is for #266.
  • May 1, 2015, by Michael Wetter:
    Added Inline=true for issue 227.
  • February 25, 2015, by Michael Wetter:
    Removed stateSelect attribute on pressure as this caused Buildings.Examples.Tutorial.SpaceCooling.System3 to fail with the error message "differentiated if-then-else was not continuous".
  • February 3, 2015, by Michael Wetter:
    Removed stateSelect.prefer for temperature. This is for #160.
  • October 15, 2014, by Michael Wetter:
    Renamed from Buildings.Media.Water to Buildings.Media.Water.Detailed to allow addition of Buildings.Media.Water.Simple.
  • September 12, 2014, by Michael Wetter:
    Set T(start=T_default) and p(start=p_default) in the ThermodynamicState record. Setting the start value for T is required to avoid an error due to conflicting start values when checking Buildings.Examples.VAVReheat.ClosedLoop in pedantic mode.
  • December 18, 2013, by Michael Wetter:
    First implementation.