Fluid model assumptions

See PhD thesis for more details.


Brine is a mixture of components and, if gases are involved, potentially has two phases. As this is not possible with the components provided in Modelica.Media a new Medium template had to be created by merging Modelica.Media.Interfaces.PartialMixtureMedium and Modelica.Media.Interfaces.PartialTwoPhaseMedium of the Modelica Standard Library 3.1.

The model is explicit for p and T, but for h(p,T) the inverse function T(p,h) is defined. T(p,h) is inverts h(p,T) numerically by bisection, stopping at a given tolerance.

In order to calculate h(p,T), the vapour-liquid-equilibrium (VLE) is determined, i.e. the gas mass fraction q and the compositions of the liquid phases X_l. Only h is returned, due to the limitation of DYMOLA/Modelica not allowing inverse functions of functions that are returning an array. As x (gas mass fraction) and X_l (composition of liquid phase) are of interest themselves and required to calculate density and viscosity, the VLE calculation is conducted one more time, this time with T known. This additiona unnecessary calculation doubles the workload when p,h are given. When p,T are given, however, it adds only one more calculation to the multiple iterations of the bisection algorithm.


This is a partial medium and cannot be used as is.

See BrineProp.Examples.BrineProps2phase for usage example.

See BrineProp.Examples.BrineProps2phase or info of BrineProp.Brine_5salts_TwoPhase_3gas for more usage examples.

Known Issues:
Created by
Henning Francke
Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences
Telegrafenberg, D-14473 Potsdam



 BasePropertiesBase properties of medium
 ThermodynamicStatea selection of variables that uniquely defines the thermodynamic state
 densityreturn density of ideal gas
 density_pTXwrapper to extract d from state
 density_liq_pTXDensity of the liquid phase
 density_gas_pTXDensity of the gas phase
 saturationTemperaturesaturation temperature
 dewEnthalpydew curve specific enthalpy of water
 bubbleEnthalpyboiling curve specific enthalpy of water
 solubilities_pTXsolubility calculation of gas in m_gas/m_H2O
 fugacity_pTXCalculation of nitrogen fugacity coefficient extracted from EES
 vapourQualityReturns vapour quality, needs to be defined to overload function defined in PartialMixtureTwoPhaseMedium
 temperature_phXiterative inversion of specificEnthalpy_pTX by regula falsi
 pressure_dTXiterative inversion of density_pTX by regula falsi
 specificEnthalpy_pTXwrapper to extract h from state
 specificEnthalpy_liq_pTXSpecific enthalpy of liquid phase
 specificEnthalpy_gas_pTXSpecific enthalpy of gas in gas phase
 saturationPressuresReturn saturationPressures for gases and water
 saturationPressure_H2Obrine water vapour pressure
 setState_pTXfinds the VLE iteratively by varying the normalized quantity of gas in the gasphase, calculates the densities
 setState_phXCalculates medium properties from p,h,X
 specificHeatCapacityCpnumeric calculation of specific heat capacity at constant pressure


Generated at 2024-07-20T18:16:01Z by OpenModelicaOpenModelica 1.23.1 using GenerateDoc.mos