TwoPhaseWater

Extension of the StandardWater package

Package Contents

BaseProperties

Make StandardWater.BaseProperties non replaceable in order that inheritance is possible in model ExtendedProperties

ExtendedProperties

Plenty of two-phase properties

TestTwoPhaseStates

Test the above model

Package Constants (27)

ThermoStates

Value: Modelica.Media.Interfaces.Choices.IndependentVariables.ph

Type: IndependentVariables

Description: Enumeration type for independent variables

mediumName

Value: "WaterIF97"

Type: String

Description: Name of the medium

substanceNames

Value: {"water"}

Type: String[:]

Description: Names of the mixture substances. Set substanceNames={mediumName} if only one substance.

extraPropertiesNames

Value: fill("", 0)

Type: String[:]

Description: Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused

singleState

Value: false

Type: Boolean

Description: = true, if u and d are not a function of pressure

reducedX

Value: true

Type: Boolean

Description: = true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details)

fixedX

Value: true

Type: Boolean

Description: = true if medium contains the equation X = reference_X

reference_p

Value: 101325

Type: AbsolutePressure (Pa)

Description: Reference pressure of Medium: default 1 atmosphere

reference_T

Value: 298.15

Type: Temperature (K)

Description: Reference temperature of Medium: default 25 deg Celsius

reference_X

Value: fill(1 / nX, nX)

Type: MassFraction[nX] (kg/kg)

Description: Default mass fractions of medium

p_default

Value: 101325

Type: AbsolutePressure (Pa)

Description: Default value for pressure of medium (for initialization)

T_default

Value: Modelica.SIunits.Conversions.from_degC(20)

Type: Temperature (K)

Description: Default value for temperature of medium (for initialization)

h_default

Value: specificEnthalpy_pTX(p_default, T_default, X_default)

Type: SpecificEnthalpy (J/kg)

Description: Default value for specific enthalpy of medium (for initialization)

X_default

Value: reference_X

Type: MassFraction[nX] (kg/kg)

Description: Default value for mass fractions of medium (for initialization)

C_default

Value: fill(0, nC)

Type: ExtraProperty[nC]

Description: Default value for trace substances of medium (for initialization)

nS

Value: size(substanceNames, 1)

Type: Integer

Description: Number of substances

nX

Value: nS

Type: Integer

Description: Number of mass fractions

nXi

Value: if fixedX then 0 else if reducedX then nS - 1 else nS

Type: Integer

Description: Number of structurally independent mass fractions (see docu for details)

nC

Value: size(extraPropertiesNames, 1)

Type: Integer

Description: Number of extra (outside of standard mass-balance) transported properties

C_nominal

Value: 1.0e-6 * ones(nC)

Type: Real[nC]

Description: Default for the nominal values for the extra properties

smoothModel

Value: false

Type: Boolean

Description: True if the (derived) model should not generate state events

onePhase

Value: false

Type: Boolean

Description: True if the (derived) model should never be called with two-phase inputs

fluidConstants

Value: waterConstants

Type: FluidConstants[nS]

Description: Constant data for the fluid

Region

Value: 0

Type: Integer

Description: Region of IF97, if known, zero otherwise

ph_explicit

Value: true

Type: Boolean

Description: True if explicit in pressure and specific enthalpy

dT_explicit

Value: false

Type: Boolean

Description: True if explicit in density and temperature

pT_explicit

Value: false

Type: Boolean

Description: True if explicit in pressure and temperature

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Example: TwoPhaseWater

The TwoPhaseWater package demonstrates how to extend the parsimonious BaseProperties with a minimal set of properties from the standard water package with most properties that are needed in two-phase situations. The model also demonstrates how to compute additional  properties for the medium model. In this scenario, that builds a new medium model with many more properties than the default, the standard BaseProperties is used as a basis. For additional properties, a user has to:
  1. Declare a new variable of the wanted type, e.g., "DynamicViscosity eta".
  2. Compute that variable by calling the function form the package, e.g., eta = dynamicViscosity(state). Note that the instance of ThermodynamicState is used as an input to the function. This instance "state" is declared in PartialMedium and thus available in every medium model. A user does not have to know what actual variables are required to compute the dynamic viscosity, because the state instance is guaranteed to contain what is needed.
  3. Attention: Many properties are not well defined in the two phase region and the functions might return undesired values if called there. It is the user's responsibility  to take care of such situations. The example uses one of several possible models to compute an averaged viscosity for two-phase flows.
In two phase models, properties are often needed on the phase boundary just outside the two phase dome, right on the border.. To compute the thermodynamic state there, two auxiliary functions are provided: setDewState(sat) and setBubbleState(sat). They take an instance of SaturationProperties as input. By default they are in one-phase, but with the optional phase argument set to 2, the output is forced to be just inside the phase boundary. This is only needed when derivatives like cv are computed with are different on both sides of the boundaries. The usual steps to compute properties on the phase boundary are:
  1. Declare an instance of ThermodynamicState, e.g., "ThermodynamicState  dew".
  2. Compute the state, using an instance of SaturationProperties, e.g., dew = setDewState(sat)
  3. Compute properties on the phase boundary to your full desire, e.g., "cp_d = specificHeatCapacityCp(dew)".

The sample model TestTwoPhaseStates test the extended properties

The same procedure can be used to compute properties at other state points, e.g., when an isentropic reference state is computed.