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



Name Description
 BaseProperties Base properties of medium
 ThermodynamicState a selection of variables that uniquely defines the thermodynamic state
 dewEnthalpy dew curve specific enthalpy of water
 bubbleEnthalpy boiling curve specific enthalpy of water
 saturationTemperature saturation temperature
 solubilities_pTX solubility calculation of gas in m_gas/m_H2O
 fugacity_pTX Calculation of nitrogen fugacity coefficient extracted from EES
 density_liq_pTX Density of the liquid phase
 vapourQuality Returns vapour quality, needs to be defined to overload function defined in PartialMixtureTwoPhaseMedium
 specificEnthalpy_pTX wrapper to extract h from state
 density_pTX wrapper to extract d from state
 temperature_phX iterative inversion of specificEnthalpy_pTX by regula falsi
 pressure_dTX iterative inversion of density_pTX by regula falsi
 specificEnthalpy_liq_pTX Specific enthalpy of liquid phase
 specificEnthalpy_gas_pTX Specific enthalpy of gas in gas phase
 saturationPressures Return saturationPressures for gases and water
 saturationPressure_H2O brine water vapour pressure
 setState_pTX finds the VLE iteratively by varying the normalized quantity of gas in the gasphase, calculates the densities
 setState_phX Calculates medium properties from p,h,X
 specificHeatCapacityCp numeric calculation of specific heat capacity at constant pressure
 density return density of ideal gas


Generated at 2021-01-25T01:59:20Z by OpenModelicaOpenModelica 1.17.0~dev-347-g03da1b5 using GenerateDoc.mos