**PartialBrine_ngas_Newton**is based on`PartialMixtureTwoPhaseMedium`

, an extension to the`Modelica.Media`

library. This extension was necessary because`Modelica.Media`

supports mixtures and two-phase media, but not both combined.- The vapour-liquid-equilibrium (VLE) is defined by the water vapour pressure and the gas solubilites. It is determined using Newton's method.
- Explicit material functions are not specified in this package, as it is just a template. They need to be provided in the instantiating package (e.g.
`BrineProp.Brine_5salts_TwoPhase_3gas`

). - The model calculates properties for a thermodynamic state specified by
*p*and*T*,*p*and*h*,*T*and*d*or*p*and*d*.

- The fluid consists of water,
*N*salts and_{s}*N*gases._{g} - Its total composition is given by a vector of mass fractions X.
- There are one or two phases: liquid and, if absolute pressure is low enough, gas (no solid phase).
- The gas phase is an ideal mixture of water vapour and gases.
- The salts are completely dissolved in and limited to the liquid phase (no precipitation/evaporation).
- Water and gases are exchanged between both phases by degassing/dissolution or evaporation/condensation, taking into account mass and energy conservation.
- Gases dissolve in liquid depending on their respective solubility, which depends on temperature and salt content, but not on the content of other gases.
- The saturation pressure of water is reduced by the salt content.
- Water evaporation and condensation depend on its saturation pressure, which depends on temperature and the salt content according to Raoult's law.
- In two-phase state degassing pressures equal the respective partial pressures.
- Both phases are assumed to be in thermodynamic equilibrium, i.e. they have the same pressure and temperature. The vapour-liquid equilibrium is instantly reached.
- Boundary surface enthalpies are neglected.

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.

- The package is in one file, because it extends a MSL package (DYMOLA limitiation?).

Henning Francke

Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences

Telegrafenberg, D-14473 Potsdam

Germany

Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences

Telegrafenberg, D-14473 Potsdam

Germany

Name | Description |
---|---|

Salt_data | |

BaseProperties | Base properties of medium |

ThermodynamicState | a selection of variables that uniquely defines the thermodynamic state |

density | return density of ideal gas |

density_pTX | wrapper to extract d from state |

density_liq_pTX | Density of the liquid phase |

density_gas_pTX | Density of the gas phase |

saturationTemperature | saturation temperature |

dewEnthalpy | dew curve specific enthalpy of water |

bubbleEnthalpy | boiling curve specific enthalpy of water |

solutionEnthalpy | |

solubilities_pTX | solubility calculation of gas in m_gas/m_H2O |

fugacity_pTX | Calculation of nitrogen fugacity coefficient extracted from EES |

vapourQuality | Returns vapour quality, needs to be defined to overload function defined in PartialMixtureTwoPhaseMedium |

temperature_phX | iterative inversion of specificEnthalpy_pTX by regula falsi |

pressure_dTX | iterative inversion of density_pTX by regula falsi |

specificEnthalpy_pTX | wrapper to extract h from state |

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 |

specificHeatCapacityCp_liq | |

specificHeatCapacityCp_gas | |

isobaricExpansionCoefficient_liq | |

specificEnthalpy |

Generated at 2024-03-03T19:16:20Z by OpenModelicaOpenModelica 1.22.1 using GenerateDoc.mos