www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowWaterNCG Class Reference

Specialized class for water and a non-condensable gas (NCG) Includes dissolution of gas in liquid water phase using Henry's law. More...

#include <PorousFlowWaterNCG.h>

Inheritance diagram for PorousFlowWaterNCG:
[legend]

Public Member Functions

 PorousFlowWaterNCG (const InputParameters &parameters)
 
virtual std::string fluidStateName () const override
 Name of FluidState. More...
 
void thermophysicalProperties (Real pressure, Real temperature, Real Xnacl, Real Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const override
 Determines the complete thermophysical state of the system for a given set of primary variables. More...
 
void equilibriumMassFractions (const DualReal &pressure, const DualReal &temperature, DualReal &Xncg, DualReal &Yh2o) const
 Mass fractions of NCG in liquid phase and H2O in gas phase at thermodynamic equilibrium. More...
 
void massFractions (const DualReal &pressure, const DualReal &temperature, const DualReal &Z, FluidStatePhaseEnum &phase_state, std::vector< FluidStateProperties > &fsp) const
 Mass fractions of NCG and H2O in both phases, as well as derivatives wrt PorousFlow variables. More...
 
void gasProperties (const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
 Gas properties - density, viscosity and enthalpy. More...
 
void liquidProperties (const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
 Liquid properties - density, viscosity and enthalpy Note: The pressure here is the liquid pressure. More...
 
DualReal liquidDensity (const DualReal &pressure, const DualReal &temperature) const
 Density of the liquid phase Note: The pressure here is the gas pressure. More...
 
DualReal gasDensity (const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
 Density of the gas phase. More...
 
DualReal saturation (const DualReal &pressure, const DualReal &temperature, const DualReal &Z, std::vector< FluidStateProperties > &fsp) const
 Gas saturation in the two-phase region. More...
 
void twoPhaseProperties (const DualReal &pressure, const DualReal &temperature, const DualReal &Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const
 Gas and liquid properties in the two-phase region. More...
 
DualReal enthalpyOfDissolution (const DualReal &temperature) const
 Enthalpy of dissolution of NCG in water calculated using Henry's constant From Himmelblau, Partial molal heats and entropies of solution for gases dissolved in water from the freezing to the near critical point, J. More...
 
virtual Real totalMassFraction (Real pressure, Real temperature, Real Xnacl, Real saturation, unsigned int qp) const override
 Total mass fraction of fluid component summed over all phases in the two-phase state for a specified gas saturation. More...
 
void phaseState (Real Zi, Real Xi, Real Yi, FluidStatePhaseEnum &phase_state) const
 Determines the phase state gven the total mass fraction and equilibrium mass fractions. More...
 
unsigned int getPressureIndex () const
 
unsigned int getTemperatureIndex () const
 
unsigned int getZIndex () const
 
unsigned int getXIndex () const
 
Real rachfordRice (Real vf, std::vector< Real > &Zi, std::vector< Real > &Ki) const
 Rachford-Rice equation for vapor fraction. More...
 
Real rachfordRiceDeriv (Real vf, std::vector< Real > &Zi, std::vector< Real > &Ki) const
 Derivative of Rachford-Rice equation wrt vapor fraction. More...
 
Real vaporMassFraction (Real Z0, Real K0, Real K1) const
 Solves Rachford-Rice equation to provide vapor mass fraction. More...
 
DualReal vaporMassFraction (const DualReal &Z0, const DualReal &K0, const DualReal &K1) const
 
Real vaporMassFraction (std::vector< Real > &Zi, std::vector< Real > &Ki) const
 
void initialize () final
 
void execute () final
 
void finalize () final
 
unsigned int numPhases () const
 The maximum number of phases in this model. More...
 
unsigned int numComponents () const
 The maximum number of components in this model. More...
 
unsigned int aqueousPhaseIndex () const
 The index of the aqueous phase. More...
 
unsigned int gasPhaseIndex () const
 The index of the gas phase. More...
 
unsigned int aqueousComponentIndex () const
 The index of the aqueous fluid component. More...
 
unsigned int gasComponentIndex () const
 The index of the gas fluid component. More...
 
unsigned int saltComponentIndex () const
 The index of the salt component. More...
 
void clearFluidStateProperties (std::vector< FluidStateProperties > &fsp) const
 Clears the contents of the FluidStateProperties data structure. More...
 

Protected Member Functions

DualReal moleFractionToMassFraction (const DualReal &xmol) const
 Convert mole fraction to mass fraction. More...
 
void checkVariables (Real temperature) const
 Check that the temperature is between the triple and critical values. More...
 

Protected Attributes

const SinglePhaseFluidProperties_water_fp
 Fluid properties UserObject for water. More...
 
const Water97FluidProperties_water97_fp
 Fluid properties UserObject for water (used to access Henry's law) More...
 
const SinglePhaseFluidProperties_ncg_fp
 Fluid properties UserObject for the NCG. More...
 
const Real _Mh2o
 Molar mass of water (kg/mol) More...
 
const Real _Mncg
 Molar mass of non-condensable gas (kg/mol) More...
 
const Real _water_triple_temperature
 Triple point temperature of water (K) More...
 
const Real _water_critical_temperature
 Critical temperature of water (K) More...
 
const std::vector< Real > _ncg_henry
 Henry's coefficients for the NCG. More...
 
const unsigned int _pidx
 Index of derivative wrt pressure. More...
 
const unsigned int _Zidx
 Index of derivative wrt total mass fraction Z. More...
 
const unsigned int _Tidx
 Index of derivative wrt temperature. More...
 
const unsigned int _Xidx
 Index of derivative wrt salt mass fraction X. More...
 
const Real _nr_max_its
 Maximum number of iterations for the Newton-Raphson routine. More...
 
const Real _nr_tol
 Tolerance for Newton-Raphson iterations. More...
 
unsigned int _num_phases
 Number of phases. More...
 
unsigned int _num_components
 Number of components. More...
 
const unsigned int _aqueous_phase_number
 Phase number of the aqueous phase. More...
 
unsigned int _gas_phase_number
 Phase number of the gas phase. More...
 
const unsigned int _aqueous_fluid_component
 Fluid component number of the aqueous component. More...
 
unsigned int _gas_fluid_component
 Fluid component number of the gas phase. More...
 
const unsigned int _salt_component
 Salt component index. More...
 
const Real _R
 Universal gas constant (J/mol/K) More...
 
const Real _T_c2k
 Conversion from C to K. More...
 
const PorousFlowCapillaryPressure_pc
 Capillary pressure UserObject. More...
 
FluidStateProperties _empty_fsp
 Empty FluidStateProperties object. More...
 

Detailed Description

Specialized class for water and a non-condensable gas (NCG) Includes dissolution of gas in liquid water phase using Henry's law.

Notation convention Throughout this class, both mole fractions and mass fractions will be used. The following notation will be used: yk: mole fraction of component k in the gas phase xk: mole fraction of component k in the liquid phase Yk: mass fraction of component k in the gas phase Xk: mass fraction of component k in the liquid phase

Definition at line 33 of file PorousFlowWaterNCG.h.

Constructor & Destructor Documentation

◆ PorousFlowWaterNCG()

PorousFlowWaterNCG::PorousFlowWaterNCG ( const InputParameters &  parameters)

Definition at line 29 of file PorousFlowWaterNCG.C.

31  _water_fp(getUserObject<SinglePhaseFluidProperties>("water_fp")),
32  _water97_fp(getUserObject<Water97FluidProperties>("water_fp")),
33  _ncg_fp(getUserObject<SinglePhaseFluidProperties>("gas_fp")),
39 {
40  // Check that the correct FluidProperties UserObjects have been provided
41  if (_water_fp.fluidName() != "water")
42  paramError("water_fp", "A valid water FluidProperties UserObject must be provided in water_fp");
43 
44  // Set the number of phases and components, and their indexes
45  _num_phases = 2;
46  _num_components = 2;
49 
50  // Check that _aqueous_phase_number is <= total number of phases
52  paramError("liquid_phase_number",
53  "This value is larger than the possible number of phases ",
54  _num_phases);
55 
56  // Check that _aqueous_fluid_component is <= total number of fluid components
58  paramError("liquid_fluid_component",
59  "This value is larger than the possible number of fluid components",
61 
63 }

Member Function Documentation

◆ aqueousComponentIndex()

unsigned int PorousFlowFluidStateBase::aqueousComponentIndex ( ) const
inlineinherited

The index of the aqueous fluid component.

Returns
aqueous fluid component number

Definition at line 92 of file PorousFlowFluidStateBase.h.

92 { return _aqueous_fluid_component; };

◆ aqueousPhaseIndex()

unsigned int PorousFlowFluidStateBase::aqueousPhaseIndex ( ) const
inlineinherited

The index of the aqueous phase.

Returns
aqueous phase number

Definition at line 80 of file PorousFlowFluidStateBase.h.

80 { return _aqueous_phase_number; };

◆ checkVariables()

void PorousFlowWaterNCG::checkVariables ( Real  temperature) const
protected

Check that the temperature is between the triple and critical values.

Parameters
temperaturefluid temperature (K)

Definition at line 384 of file PorousFlowWaterNCG.C.

385 {
386  // Check whether the input temperature is within the region of validity of this equation
387  // of state (T_triple <= T <= T_critical)
388  if (temperature < _water_triple_temperature || temperature > _water_critical_temperature)
389  mooseException(name() + ": temperature " + Moose::stringify(temperature) +
390  " is outside range 273.16 K <= T <= 647.096 K");
391 }

Referenced by thermophysicalProperties(), and totalMassFraction().

◆ clearFluidStateProperties()

void PorousFlowFluidStateBase::clearFluidStateProperties ( std::vector< FluidStateProperties > &  fsp) const
inherited

Clears the contents of the FluidStateProperties data structure.

Parameters
[out]fspFluidStateProperties data structure with all data initialized to 0

Definition at line 39 of file PorousFlowFluidStateBase.C.

40 {
41  std::fill(fsp.begin(), fsp.end(), _empty_fsp);
42 }

Referenced by thermophysicalProperties(), PorousFlowFluidStateSingleComponent::thermophysicalProperties(), and PorousFlowBrineCO2::thermophysicalProperties().

◆ enthalpyOfDissolution()

DualReal PorousFlowWaterNCG::enthalpyOfDissolution ( const DualReal &  temperature) const

Enthalpy of dissolution of NCG in water calculated using Henry's constant From Himmelblau, Partial molal heats and entropies of solution for gases dissolved in water from the freezing to the near critical point, J.

Phys. Chem. 63 (1959)

Parameters
temperaturefluid temperature (K)
Returns
enthalpy of dissolution (J/kg)

Definition at line 394 of file PorousFlowWaterNCG.C.

395 {
396  // Henry's constant
397  const DualReal Kh = _water97_fp.henryConstant(temperature, _ncg_henry);
398 
399  DualReal hdis = -_R * temperature * temperature * Kh.derivatives()[_Tidx] / Kh / _Mncg;
400 
401  // Derivative of enthalpy of dissolution wrt temperature requires the second derivative of
402  // Henry's constant wrt temperature. For simplicity, approximate this numerically
403  const Real dT = temperature.value() * 1.0e-8;
404  const DualReal t2 = temperature + dT;
405  const DualReal Kh2 = _water97_fp.henryConstant(t2, _ncg_henry);
406 
407  const Real dhdis_dT =
408  (-_R * t2 * t2 * Kh2.derivatives()[_Tidx] / Kh2 / _Mncg - hdis).value() / dT;
409 
410  hdis.derivatives() = temperature.derivatives() * dhdis_dT;
411 
412  return hdis;
413 }

Referenced by liquidProperties().

◆ equilibriumMassFractions()

void PorousFlowWaterNCG::equilibriumMassFractions ( const DualReal &  pressure,
const DualReal &  temperature,
DualReal &  Xncg,
DualReal &  Yh2o 
) const

Mass fractions of NCG in liquid phase and H2O in gas phase at thermodynamic equilibrium.

Calculated using Henry's law (for NCG component), and Raoult's law (for water).

Parameters
pressurephase pressure (Pa)
temperaturephase temperature (K)
[out]Xncgmass fraction of NCG in liquid (kg/kg)
[out]Yh2omass fraction of H2O in gas (kg/kg)

Definition at line 354 of file PorousFlowWaterNCG.C.

358 {
359  // Equilibrium constants for each component (Henry's law for the NCG
360  // component, and Raoult's law for water).
361  const DualReal Kh = _water97_fp.henryConstant(temperature, _ncg_henry);
362  const DualReal psat = _water_fp.vaporPressure(temperature);
363 
364  const DualReal Kncg = Kh / pressure;
365  const DualReal Kh2o = psat / pressure;
366 
367  // The mole fractions for the NCG component in the two component
368  // case can be expressed in terms of the equilibrium constants only
369  const DualReal xncg = (1.0 - Kh2o) / (Kncg - Kh2o);
370  const DualReal yncg = Kncg * xncg;
371 
372  // Convert mole fractions to mass fractions
373  Xncg = moleFractionToMassFraction(xncg);
374  Yh2o = 1.0 - moleFractionToMassFraction(yncg);
375 }

Referenced by massFractions(), and totalMassFraction().

◆ execute()

void PorousFlowFluidStateBase::execute ( )
inlinefinalinherited

Definition at line 61 of file PorousFlowFluidStateBase.h.

61 {};

◆ finalize()

void PorousFlowFluidStateBase::finalize ( )
inlinefinalinherited

Definition at line 62 of file PorousFlowFluidStateBase.h.

62 {};

◆ fluidStateName()

std::string PorousFlowWaterNCG::fluidStateName ( ) const
overridevirtual

Name of FluidState.

Implements PorousFlowFluidStateBase.

Definition at line 66 of file PorousFlowWaterNCG.C.

67 {
68  return "water-ncg";
69 }

◆ gasComponentIndex()

unsigned int PorousFlowFluidStateBase::gasComponentIndex ( ) const
inlineinherited

The index of the gas fluid component.

Returns
gas fluid component number

Definition at line 98 of file PorousFlowFluidStateBase.h.

98 { return _gas_fluid_component; };

◆ gasDensity()

DualReal PorousFlowWaterNCG::gasDensity ( const DualReal &  pressure,
const DualReal &  temperature,
std::vector< FluidStateProperties > &  fsp 
) const

Density of the gas phase.

Parameters
pressurepressure (Pa)
temperaturetemperature (K)
Returns
gas density (kg/m^3)

Definition at line 280 of file PorousFlowWaterNCG.C.

283 {
284  auto & liquid = fsp[_aqueous_phase_number];
285  auto & gas = fsp[_gas_phase_number];
286 
287  DualReal psat = _water_fp.vaporPressure(temperature);
288 
289  const DualReal Yncg = gas.mass_fraction[_gas_fluid_component];
290  const DualReal Xncg = liquid.mass_fraction[_gas_fluid_component];
291 
292  DualReal ncg_density = _ncg_fp.rho_from_p_T(Yncg * pressure, temperature);
293  DualReal vapor_density = _water_fp.rho_from_p_T((1.0 - Xncg) * psat, temperature);
294 
295  // Density is just the sum of individual component densities
296  return ncg_density + vapor_density;
297 }

Referenced by saturation(), and totalMassFraction().

◆ gasPhaseIndex()

unsigned int PorousFlowFluidStateBase::gasPhaseIndex ( ) const
inlineinherited

The index of the gas phase.

Returns
gas phase number

Definition at line 86 of file PorousFlowFluidStateBase.h.

86 { return _gas_phase_number; };

◆ gasProperties()

void PorousFlowWaterNCG::gasProperties ( const DualReal &  pressure,
const DualReal &  temperature,
std::vector< FluidStateProperties > &  fsp 
) const

Gas properties - density, viscosity and enthalpy.

Parameters
pressuregas pressure (Pa)
temperaturetemperature (K)
[out]FluidStatePropertiesdata structure

Definition at line 203 of file PorousFlowWaterNCG.C.

206 {
209 
210  const DualReal psat = _water_fp.vaporPressure(temperature);
211 
212  const DualReal Yncg = gas.mass_fraction[_gas_fluid_component];
213  const DualReal Xncg = liquid.mass_fraction[_gas_fluid_component];
214 
215  // NCG density, viscosity and enthalpy calculated using partial pressure
216  // Yncg * gas_poreressure (Dalton's law)
217  DualReal ncg_density, ncg_viscosity;
218  _ncg_fp.rho_mu_from_p_T(Yncg * pressure, temperature, ncg_density, ncg_viscosity);
219  DualReal ncg_enthalpy = _ncg_fp.h_from_p_T(Yncg * pressure, temperature);
220 
221  // Vapor density, viscosity and enthalpy calculated using partial pressure
222  // X1 * psat (Raoult's law)
223  DualReal vapor_density, vapor_viscosity;
224 
225  _water_fp.rho_mu_from_p_T((1.0 - Xncg) * psat, temperature, vapor_density, vapor_viscosity);
226  DualReal vapor_enthalpy = _water_fp.h_from_p_T((1.0 - Xncg) * psat, temperature);
227 
228  // Density is just the sum of individual component densities
229  gas.density = ncg_density + vapor_density;
230 
231  // Viscosity of the gas phase is a weighted sum of the individual viscosities
232  gas.viscosity = Yncg * ncg_viscosity + (1.0 - Yncg) * vapor_viscosity;
233 
234  // Enthalpy of the gas phase is a weighted sum of the individual enthalpies
235  gas.enthalpy = Yncg * ncg_enthalpy + (1.0 - Yncg) * vapor_enthalpy;
236 
237  // Internal energy of the gas phase (e = h - pv)
238  mooseAssert(gas.density.value() > 0.0, "Gas density must be greater than zero");
239  gas.internal_energy = gas.enthalpy - pressure / gas.density;
240 }

Referenced by thermophysicalProperties(), and twoPhaseProperties().

◆ getPressureIndex()

unsigned int PorousFlowFluidStateMultiComponentBase::getPressureIndex ( ) const
inlineinherited

Definition at line 70 of file PorousFlowFluidStateMultiComponentBase.h.

70 { return _pidx; };

◆ getTemperatureIndex()

unsigned int PorousFlowFluidStateMultiComponentBase::getTemperatureIndex ( ) const
inlineinherited

Definition at line 71 of file PorousFlowFluidStateMultiComponentBase.h.

71 { return _Tidx; };

◆ getXIndex()

unsigned int PorousFlowFluidStateMultiComponentBase::getXIndex ( ) const
inlineinherited

Definition at line 73 of file PorousFlowFluidStateMultiComponentBase.h.

73 { return _Xidx; };

◆ getZIndex()

unsigned int PorousFlowFluidStateMultiComponentBase::getZIndex ( ) const
inlineinherited

Definition at line 72 of file PorousFlowFluidStateMultiComponentBase.h.

72 { return _Zidx; };

◆ initialize()

void PorousFlowFluidStateBase::initialize ( )
inlinefinalinherited

Definition at line 60 of file PorousFlowFluidStateBase.h.

60 {};

◆ liquidDensity()

DualReal PorousFlowWaterNCG::liquidDensity ( const DualReal &  pressure,
const DualReal &  temperature 
) const

Density of the liquid phase Note: The pressure here is the gas pressure.

As a result, the liquid pressure can include a dependence on saturation due to the capillary pressure, so this method should be called after the saturation is calculated for the two phase case ie: after calling saturation(). For the single phase liquid case, it is ok to call this method by itself, as gas saturation is initialized to zero.

Parameters
pressuregas pressure (Pa)
temperaturetemperature (K)
Returns
liquid density (kg/m^3)

Definition at line 274 of file PorousFlowWaterNCG.C.

275 {
276  return _water_fp.rho_from_p_T(pressure, temperature);
277 }

Referenced by saturation(), and totalMassFraction().

◆ liquidProperties()

void PorousFlowWaterNCG::liquidProperties ( const DualReal &  pressure,
const DualReal &  temperature,
std::vector< FluidStateProperties > &  fsp 
) const

Liquid properties - density, viscosity and enthalpy Note: The pressure here is the liquid pressure.

In this class, enthalpy includes a contribution due to the enthalpy of dissolution of the NCG into the liquid phase. As a result, the derivatives can include a dependence on the capillary pressure, so this method should be called after the saturation is calculated for the two phase case ie: after calling saturation(). For the single phase liquid case, it is ok to call this method by itself, as gas saturation is initialized to zero.

Parameters
pressureliquid pressure (Pa)
temperaturetemperature (K)
[out]FluidStatePropertiesdata structure

Definition at line 243 of file PorousFlowWaterNCG.C.

246 {
248 
249  // Calculate liquid density and viscosity if in the two phase or single phase
250  // liquid region, assuming they are not affected by the presence of dissolved
251  // NCG. Note: the (small) contribution due to derivative of capillary pressure
252  // wrt pressure (using the chain rule) is not implemented.
253  DualReal liquid_density, liquid_viscosity;
254  _water_fp.rho_mu_from_p_T(pressure, temperature, liquid_density, liquid_viscosity);
255 
256  liquid.density = liquid_density;
257  liquid.viscosity = liquid_viscosity;
258 
259  // Enthalpy does include a contribution due to the enthalpy of dissolution
260  const DualReal hdis = enthalpyOfDissolution(temperature);
261 
262  const DualReal water_enthalpy = _water_fp.h_from_p_T(pressure, temperature);
263  const DualReal ncg_enthalpy = _ncg_fp.h_from_p_T(pressure, temperature);
264 
265  const DualReal Xncg = liquid.mass_fraction[_gas_fluid_component];
266  liquid.enthalpy = (1.0 - Xncg) * water_enthalpy + Xncg * (ncg_enthalpy + hdis);
267 
268  // Internal energy of the liquid phase (e = h - pv)
269  mooseAssert(liquid.density.value() > 0.0, "Liquid density must be greater than zero");
270  liquid.internal_energy = liquid.enthalpy - pressure / liquid.density;
271 }

Referenced by thermophysicalProperties(), and twoPhaseProperties().

◆ massFractions()

void PorousFlowWaterNCG::massFractions ( const DualReal &  pressure,
const DualReal &  temperature,
const DualReal &  Z,
FluidStatePhaseEnum phase_state,
std::vector< FluidStateProperties > &  fsp 
) const

Mass fractions of NCG and H2O in both phases, as well as derivatives wrt PorousFlow variables.

Values depend on the phase state (liquid, gas or two phase)

Parameters
pressurephase pressure (Pa)
temperaturephase temperature (K)
Ztotal mass fraction of NCG component
[out]PhaseStateEnumcurrent phase state
[out]FluidStateMassFractionsdata structure

Definition at line 139 of file PorousFlowWaterNCG.C.

144 {
147 
148  // Equilibrium mass fraction of NCG in liquid and H2O in gas phases
149  DualReal Xncg, Yh2o;
151 
152  DualReal Yncg = 1.0 - Yh2o;
153 
154  // Determine which phases are present based on the value of Z
155  phaseState(Z.value(), Xncg.value(), Yncg.value(), phase_state);
156 
157  // The equilibrium mass fractions calculated above are only correct in the two phase
158  // state. If only liquid or gas phases are present, the mass fractions are given by
159  // the total mass fraction Z.
160  DualReal Xh2o = 0.0;
161 
162  switch (phase_state)
163  {
165  {
166  Xncg = Z;
167  Yncg = 0.0;
168  Xh2o = 1.0 - Z;
169  Yh2o = 0.0;
170  Moose::derivInsert(Xncg.derivatives(), _pidx, 0.0);
171  Moose::derivInsert(Xncg.derivatives(), _Tidx, 0.0);
172  Moose::derivInsert(Xncg.derivatives(), _Zidx, 1.0);
173  break;
174  }
175 
177  {
178  Xncg = 0.0;
179  Yncg = Z;
180  Yh2o = 1.0 - Z;
181  Moose::derivInsert(Yncg.derivatives(), _pidx, 0.0);
182  Moose::derivInsert(Yncg.derivatives(), _Tidx, 0.0);
183  Moose::derivInsert(Yncg.derivatives(), _Zidx, 1.0);
184  break;
185  }
186 
188  {
189  // Keep equilibrium mass fractions
190  Xh2o = 1.0 - Xncg;
191  break;
192  }
193  }
194 
195  // Save the mass fractions in the FluidStateMassFractions object
197  liquid.mass_fraction[_gas_fluid_component] = Xncg;
200 }

Referenced by thermophysicalProperties().

◆ moleFractionToMassFraction()

DualReal PorousFlowWaterNCG::moleFractionToMassFraction ( const DualReal &  xmol) const
protected

Convert mole fraction to mass fraction.

Parameters
xmolmole fraction
Returns
mass fraction

Definition at line 378 of file PorousFlowWaterNCG.C.

379 {
380  return xmol * _Mncg / (xmol * _Mncg + (1.0 - xmol) * _Mh2o);
381 }

Referenced by equilibriumMassFractions().

◆ numComponents()

unsigned int PorousFlowFluidStateBase::numComponents ( ) const
inlineinherited

The maximum number of components in this model.

Returns
number of components

Definition at line 74 of file PorousFlowFluidStateBase.h.

74 { return _num_components; };

◆ numPhases()

unsigned int PorousFlowFluidStateBase::numPhases ( ) const
inlineinherited

The maximum number of phases in this model.

Returns
number of phases

Definition at line 68 of file PorousFlowFluidStateBase.h.

68 { return _num_phases; };

Referenced by PorousFlowFluidState::PorousFlowFluidState(), and PorousFlowFluidStateSingleComponent::PorousFlowFluidStateSingleComponent().

◆ phaseState()

void PorousFlowFluidStateMultiComponentBase::phaseState ( Real  Zi,
Real  Xi,
Real  Yi,
FluidStatePhaseEnum phase_state 
) const
inherited

Determines the phase state gven the total mass fraction and equilibrium mass fractions.

Parameters
Zitotal mass fraction
Xiequilibrium mass fraction in liquid
Yiequilibrium mass fraction in gas
[out]phase_statethe phase state (gas, liquid, two phase)

Definition at line 28 of file PorousFlowFluidStateMultiComponentBase.C.

32 {
33  if (Zi <= Xi)
34  {
35  // In this case, there is not enough component i to form a gas phase,
36  // so only a liquid phase is present
37  phase_state = FluidStatePhaseEnum::LIQUID;
38  }
39  else if (Zi > Xi && Zi < Yi)
40  {
41  // Two phases are present
42  phase_state = FluidStatePhaseEnum::TWOPHASE;
43  }
44  else // (Zi >= Yi)
45  {
46  // In this case, there is not enough water to form a liquid
47  // phase, so only a gas phase is present
48  phase_state = FluidStatePhaseEnum::GAS;
49  }
50 }

Referenced by massFractions(), and PorousFlowBrineCO2::massFractions().

◆ rachfordRice()

Real PorousFlowFluidStateFlash::rachfordRice ( Real  vf,
std::vector< Real > &  Zi,
std::vector< Real > &  Ki 
) const
inherited

Rachford-Rice equation for vapor fraction.

Can be solved analytically for two components in two phases, but must be solved iteratively using a root finding algorithm for more components. This equation has the nice property that it is monotonic in the interval [0,1], so that only a small number of iterations are typically required to find the root.

The Rachford-Rice equation can also be used to check whether the phase state is two phase, single phase gas, or single phase liquid. Evaluate f(v), the Rachford-Rice equation evaluated at the vapor mass fraction.

If f(0) < 0, then the mixture is below the bubble point, and only a single phase liquid can exist

If f(1) > 0, then the mixture is above the dew point, and only a single phase gas exists.

If f(0) >= 0 and f(1) <= 0, the mixture is between the bubble and dew points, and both gas and liquid phases exist.

Parameters
vfvapor fraction
Zimass fractions
Kiequilibrium constants
Returns
f(x)

Definition at line 27 of file PorousFlowFluidStateFlash.C.

30 {
31  const std::size_t num_z = Zi.size();
32  // Check that the sizes of the mass fractions and equilibrium constant vectors are correct
33  if (Ki.size() != num_z + 1)
34  mooseError("The number of mass fractions or equilibrium components passed to rachfordRice is "
35  "not correct");
36 
37  Real f = 0.0;
38  Real Z_total = 0.0;
39 
40  for (std::size_t i = 0; i < num_z; ++i)
41  {
42  f += Zi[i] * (Ki[i] - 1.0) / (1.0 + x * (Ki[i] - 1.0));
43  Z_total += Zi[i];
44  }
45 
46  // Add the last component (with total mass fraction = 1 - z_total)
47  f += (1.0 - Z_total) * (Ki[num_z] - 1.0) / (1.0 + x * (Ki[num_z] - 1.0));
48 
49  return f;
50 }

Referenced by PorousFlowFluidStateFlash::vaporMassFraction().

◆ rachfordRiceDeriv()

Real PorousFlowFluidStateFlash::rachfordRiceDeriv ( Real  vf,
std::vector< Real > &  Zi,
std::vector< Real > &  Ki 
) const
inherited

Derivative of Rachford-Rice equation wrt vapor fraction.

Has the nice property that it is strictly negative in the interval [0,1]

Parameters
vfvapor fraction
Zimass fractions
Kiequilibrium constants
Returns
f'(x)

Definition at line 53 of file PorousFlowFluidStateFlash.C.

56 {
57  const std::size_t num_Z = Zi.size();
58  // Check that the sizes of the mass fractions and equilibrium constant vectors are correct
59  if (Ki.size() != num_Z + 1)
60  mooseError("The number of mass fractions or equilibrium components passed to rachfordRice is "
61  "not correct");
62 
63  Real df = 0.0;
64  Real Z_total = 0.0;
65 
66  for (std::size_t i = 0; i < num_Z; ++i)
67  {
68  df -= Zi[i] * (Ki[i] - 1.0) * (Ki[i] - 1.0) / (1.0 + x * (Ki[i] - 1.0)) /
69  (1.0 + x * (Ki[i] - 1.0));
70  Z_total += Zi[i];
71  }
72 
73  // Add the last component (with total mass fraction = 1 - z_total)
74  df -= (1.0 - Z_total) * (Ki[num_Z] - 1.0) * (Ki[num_Z] - 1.0) / (1.0 + x * (Ki[num_Z] - 1.0)) /
75  (1.0 + x * (Ki[num_Z] - 1.0));
76 
77  return df;
78 }

Referenced by PorousFlowFluidStateFlash::vaporMassFraction().

◆ saltComponentIndex()

unsigned int PorousFlowFluidStateBase::saltComponentIndex ( ) const
inlineinherited

The index of the salt component.

Returns
salt component number

Definition at line 104 of file PorousFlowFluidStateBase.h.

104 { return _salt_component; };

◆ saturation()

DualReal PorousFlowWaterNCG::saturation ( const DualReal &  pressure,
const DualReal &  temperature,
const DualReal &  Z,
std::vector< FluidStateProperties > &  fsp 
) const

Gas saturation in the two-phase region.

Parameters
pressuregas pressure (Pa)
temperaturephase temperature (K)
Ztotal mass fraction of NCG component
[out]FluidStatePropertiesdata structure
Returns
gas saturation (-)

Definition at line 300 of file PorousFlowWaterNCG.C.

304 {
305  auto & gas = fsp[_gas_phase_number];
306  auto & liquid = fsp[_aqueous_fluid_component];
307 
308  // Approximate liquid density as saturation isn't known yet, by using the gas
309  // pressure rather than the liquid pressure. This does result in a small error
310  // in the calculated saturation, but this is below the error associated with
311  // the correlations. A more accurate saturation could be found iteraviely,
312  // at the cost of increased computational expense
313 
314  // The gas and liquid densities
315  const DualReal gas_density = gasDensity(pressure, temperature, fsp);
316  const DualReal liquid_density = liquidDensity(pressure, temperature);
317 
318  // Set mass equilibrium constants used in the calculation of vapor mass fraction
319  const DualReal Xncg = liquid.mass_fraction[_gas_fluid_component];
320  const DualReal Yncg = gas.mass_fraction[_gas_fluid_component];
321 
322  const DualReal K0 = Yncg / Xncg;
323  const DualReal K1 = (1.0 - Yncg) / (1.0 - Xncg);
324  const DualReal vapor_mass_fraction = vaporMassFraction(Z, K0, K1);
325 
326  // The gas saturation in the two phase case
327  const DualReal saturation = vapor_mass_fraction * liquid_density /
328  (gas_density + vapor_mass_fraction * (liquid_density - gas_density));
329 
330  return saturation;
331 }

Referenced by totalMassFraction(), and twoPhaseProperties().

◆ thermophysicalProperties()

void PorousFlowWaterNCG::thermophysicalProperties ( Real  pressure,
Real  temperature,
Real  Xnacl,
Real  Z,
unsigned int  qp,
std::vector< FluidStateProperties > &  fsp 
) const
overridevirtual

Determines the complete thermophysical state of the system for a given set of primary variables.

Parameters
pressuregas phase pressure (Pa)
temperaturefluid temperature (K)
Xnaclmass fraction of NaCl
Ztotal mass fraction of fluid component
qpquadpoint index
[out]fspthe FluidStateProperties struct containing all properties

Implements PorousFlowFluidStateMultiComponentBase.

Definition at line 72 of file PorousFlowWaterNCG.C.

78 {
81 
82  // Check whether the input temperature is within the region of validity
84 
85  // AD versions of primary variables
86  DualReal p = pressure;
87  Moose::derivInsert(p.derivatives(), _pidx, 1.0);
88  DualReal T = temperature;
89  Moose::derivInsert(T.derivatives(), _Tidx, 1.0);
90  DualReal Zncg = Z;
91  Moose::derivInsert(Zncg.derivatives(), _Zidx, 1.0);
92 
93  // Clear all of the FluidStateProperties data
95 
96  FluidStatePhaseEnum phase_state;
97  massFractions(p, T, Zncg, phase_state, fsp);
98 
99  switch (phase_state)
100  {
102  {
103  // Set the gas saturations
104  gas.saturation = 1.0;
105 
106  // Calculate gas properties
107  gasProperties(p, T, fsp);
108 
109  break;
110  }
111 
113  {
114  // Calculate the liquid properties
115  const DualReal liquid_pressure = p - _pc.capillaryPressure(1.0, qp);
116  liquidProperties(liquid_pressure, T, fsp);
117 
118  break;
119  }
120 
122  {
123  // Calculate the gas and liquid properties in the two phase region
124  twoPhaseProperties(p, T, Zncg, qp, fsp);
125 
126  break;
127  }
128  }
129 
130  // Liquid saturations can now be set
131  liquid.saturation = 1.0 - gas.saturation;
132 
133  // Save pressures to FluidStateProperties object
134  gas.pressure = p;
135  liquid.pressure = p - _pc.capillaryPressure(liquid.saturation, qp);
136 }

◆ totalMassFraction()

Real PorousFlowWaterNCG::totalMassFraction ( Real  pressure,
Real  temperature,
Real  Xnacl,
Real  saturation,
unsigned int  qp 
) const
overridevirtual

Total mass fraction of fluid component summed over all phases in the two-phase state for a specified gas saturation.

Parameters
pressuregas pressure (Pa)
temperaturetemperature (K)
XnaclNaCl mass fraction (kg/kg)
saturationgas saturation (-)
qpquadpoint index
Returns
total mass fraction Z (-)

Implements PorousFlowFluidStateMultiComponentBase.

Definition at line 416 of file PorousFlowWaterNCG.C.

418 {
419  // Check whether the input temperature is within the region of validity
421 
422  // As we do not require derivatives, we can simply ignore their initialisation
423  const DualReal p = pressure;
424  const DualReal T = temperature;
425 
426  // FluidStateProperties data structure
427  std::vector<FluidStateProperties> fsp(_num_phases, FluidStateProperties(_num_components));
428  auto & liquid = fsp[_aqueous_phase_number];
429  auto & gas = fsp[_gas_phase_number];
430 
431  // Calculate equilibrium mass fractions in the two-phase state
432  DualReal Xncg, Yh2o;
433  equilibriumMassFractions(p, T, Xncg, Yh2o);
434 
435  // Save the mass fractions in the FluidStateMassFractions object to calculate gas density
436  const DualReal Yncg = 1.0 - Yh2o;
437  liquid.mass_fraction[_aqueous_fluid_component] = 1.0 - Xncg;
438  liquid.mass_fraction[_gas_fluid_component] = Xncg;
439  gas.mass_fraction[_aqueous_fluid_component] = Yh2o;
440  gas.mass_fraction[_gas_fluid_component] = Yncg;
441 
442  // Gas density
443  const Real gas_density = gasDensity(p, T, fsp).value();
444 
445  // Liquid density
446  const DualReal liquid_pressure = p - _pc.capillaryPressure(1.0 - saturation, qp);
447  const Real liquid_density = liquidDensity(liquid_pressure, T).value();
448 
449  // The total mass fraction of ncg (Z) can now be calculated
450  const Real Z = (saturation * gas_density * Yncg.value() +
451  (1.0 - saturation) * liquid_density * Xncg.value()) /
452  (saturation * gas_density + (1.0 - saturation) * liquid_density);
453 
454  return Z;
455 }

◆ twoPhaseProperties()

void PorousFlowWaterNCG::twoPhaseProperties ( const DualReal &  pressure,
const DualReal &  temperature,
const DualReal &  Z,
unsigned int  qp,
std::vector< FluidStateProperties > &  fsp 
) const

Gas and liquid properties in the two-phase region.

Parameters
pressuregas pressure (Pa)
temperaturephase temperature (K)
Ztotal mass fraction of NCG component
qpquadpoint for capillary pressure
[out]FluidStatePropertiesdata structure

Definition at line 334 of file PorousFlowWaterNCG.C.

339 {
340  auto & gas = fsp[_gas_phase_number];
341 
342  // Calculate all of the gas phase properties, as these don't depend on saturation
344 
345  // The gas saturation in the two phase case
346  gas.saturation = saturation(pressure, temperature, Z, fsp);
347 
348  // The liquid pressure and properties can now be calculated
349  const DualReal liquid_pressure = pressure - _pc.capillaryPressure(1.0 - gas.saturation, qp);
350  liquidProperties(liquid_pressure, temperature, fsp);
351 }

Referenced by thermophysicalProperties().

◆ vaporMassFraction() [1/3]

DualReal PorousFlowFluidStateFlash::vaporMassFraction ( const DualReal &  Z0,
const DualReal &  K0,
const DualReal &  K1 
) const
inherited

Definition at line 87 of file PorousFlowFluidStateFlash.C.

90 {
91  return (Z0 * (K1 - K0) - (K1 - 1.0)) / ((K0 - 1.0) * (K1 - 1.0));
92 }

◆ vaporMassFraction() [2/3]

Real PorousFlowFluidStateFlash::vaporMassFraction ( Real  Z0,
Real  K0,
Real  K1 
) const
inherited

Solves Rachford-Rice equation to provide vapor mass fraction.

For two components, the analytical solution is used, while for cases with more than two components, a Newton-Raphson iterative solution is calculated.

Parameters
Zitotal mass fraction(s)
Kiequilibrium constant(s)
Returns
vapor mass fraction

Definition at line 81 of file PorousFlowFluidStateFlash.C.

82 {
83  return (Z0 * (K1 - K0) - (K1 - 1.0)) / ((K0 - 1.0) * (K1 - 1.0));
84 }

Referenced by saturation(), PorousFlowBrineCO2::saturation(), and PorousFlowFluidStateFlash::vaporMassFraction().

◆ vaporMassFraction() [3/3]

Real PorousFlowFluidStateFlash::vaporMassFraction ( std::vector< Real > &  Zi,
std::vector< Real > &  Ki 
) const
inherited

Definition at line 95 of file PorousFlowFluidStateFlash.C.

96 {
97  // Check that the sizes of the mass fractions and equilibrium constant vectors are correct
98  if (Ki.size() != Zi.size() + 1)
99  mooseError("The number of mass fractions or equilibrium components passed to rachfordRice is "
100  "not correct");
101  Real v;
102 
103  // If there are only two components, an analytical solution is possible
104  if (Ki.size() == 2)
105  v = vaporMassFraction(Zi[0], Ki[0], Ki[1]);
106  else
107  {
108  // More than two components - solve the Rachford-Rice equation using
109  // Newton-Raphson method
110  // Initial guess for vapor mass fraction
111  Real v0 = 0.5;
112  unsigned int iter = 0;
113 
114  while (std::abs(rachfordRice(v0, Zi, Ki)) > _nr_tol)
115  {
116  v0 = v0 - rachfordRice(v0, Zi, Ki) / rachfordRiceDeriv(v0, Zi, Ki);
117  iter++;
118 
119  if (iter > _nr_max_its)
120  break;
121  }
122  v = v0;
123  }
124  return v;
125 }

Member Data Documentation

◆ _aqueous_fluid_component

const unsigned int PorousFlowFluidStateBase::_aqueous_fluid_component
protectedinherited

◆ _aqueous_phase_number

const unsigned int PorousFlowFluidStateBase::_aqueous_phase_number
protectedinherited

◆ _empty_fsp

FluidStateProperties PorousFlowFluidStateBase::_empty_fsp
protectedinherited

◆ _gas_fluid_component

unsigned int PorousFlowFluidStateBase::_gas_fluid_component
protectedinherited

◆ _gas_phase_number

unsigned int PorousFlowFluidStateBase::_gas_phase_number
protectedinherited

◆ _Mh2o

const Real PorousFlowWaterNCG::_Mh2o
protected

Molar mass of water (kg/mol)

Definition at line 192 of file PorousFlowWaterNCG.h.

Referenced by moleFractionToMassFraction().

◆ _Mncg

const Real PorousFlowWaterNCG::_Mncg
protected

Molar mass of non-condensable gas (kg/mol)

Definition at line 194 of file PorousFlowWaterNCG.h.

Referenced by enthalpyOfDissolution(), and moleFractionToMassFraction().

◆ _ncg_fp

const SinglePhaseFluidProperties& PorousFlowWaterNCG::_ncg_fp
protected

Fluid properties UserObject for the NCG.

Definition at line 190 of file PorousFlowWaterNCG.h.

Referenced by gasDensity(), gasProperties(), and liquidProperties().

◆ _ncg_henry

const std::vector<Real> PorousFlowWaterNCG::_ncg_henry
protected

Henry's coefficients for the NCG.

Definition at line 200 of file PorousFlowWaterNCG.h.

Referenced by enthalpyOfDissolution(), and equilibriumMassFractions().

◆ _nr_max_its

const Real PorousFlowFluidStateFlash::_nr_max_its
protectedinherited

Maximum number of iterations for the Newton-Raphson routine.

Definition at line 80 of file PorousFlowFluidStateFlash.h.

Referenced by PorousFlowFluidStateFlash::vaporMassFraction().

◆ _nr_tol

const Real PorousFlowFluidStateFlash::_nr_tol
protectedinherited

Tolerance for Newton-Raphson iterations.

Definition at line 82 of file PorousFlowFluidStateFlash.h.

Referenced by PorousFlowFluidStateFlash::vaporMassFraction().

◆ _num_components

unsigned int PorousFlowFluidStateBase::_num_components
protectedinherited

◆ _num_phases

unsigned int PorousFlowFluidStateBase::_num_phases
protectedinherited

◆ _pc

const PorousFlowCapillaryPressure& PorousFlowFluidStateBase::_pc
protectedinherited

◆ _pidx

const unsigned int PorousFlowFluidStateMultiComponentBase::_pidx
protectedinherited

◆ _R

const Real PorousFlowFluidStateBase::_R
protectedinherited

Universal gas constant (J/mol/K)

Definition at line 133 of file PorousFlowFluidStateBase.h.

Referenced by enthalpyOfDissolution(), and PorousFlowBrineCO2::enthalpyOfDissolutionGas().

◆ _salt_component

const unsigned int PorousFlowFluidStateBase::_salt_component
protectedinherited

Salt component index.

Definition at line 131 of file PorousFlowFluidStateBase.h.

Referenced by PorousFlowFluidStateBase::saltComponentIndex().

◆ _T_c2k

const Real PorousFlowFluidStateBase::_T_c2k
protectedinherited

◆ _Tidx

const unsigned int PorousFlowFluidStateMultiComponentBase::_Tidx
protectedinherited

◆ _water97_fp

const Water97FluidProperties& PorousFlowWaterNCG::_water97_fp
protected

Fluid properties UserObject for water (used to access Henry's law)

Definition at line 188 of file PorousFlowWaterNCG.h.

Referenced by enthalpyOfDissolution(), and equilibriumMassFractions().

◆ _water_critical_temperature

const Real PorousFlowWaterNCG::_water_critical_temperature
protected

Critical temperature of water (K)

Definition at line 198 of file PorousFlowWaterNCG.h.

Referenced by checkVariables().

◆ _water_fp

const SinglePhaseFluidProperties& PorousFlowWaterNCG::_water_fp
protected

Fluid properties UserObject for water.

Definition at line 186 of file PorousFlowWaterNCG.h.

Referenced by equilibriumMassFractions(), gasDensity(), gasProperties(), liquidDensity(), liquidProperties(), and PorousFlowWaterNCG().

◆ _water_triple_temperature

const Real PorousFlowWaterNCG::_water_triple_temperature
protected

Triple point temperature of water (K)

Definition at line 196 of file PorousFlowWaterNCG.h.

◆ _Xidx

const unsigned int PorousFlowFluidStateMultiComponentBase::_Xidx
protectedinherited

◆ _Zidx

const unsigned int PorousFlowFluidStateMultiComponentBase::_Zidx
protectedinherited

The documentation for this class was generated from the following files:
PorousFlowWaterNCG::liquidDensity
DualReal liquidDensity(const DualReal &pressure, const DualReal &temperature) const
Density of the liquid phase Note: The pressure here is the gas pressure.
Definition: PorousFlowWaterNCG.C:274
SinglePhaseFluidProperties::rho_mu_from_p_T
virtual void rho_mu_from_p_T(Real p, Real T, Real &rho, Real &mu) const
Combined methods.
Definition: SinglePhaseFluidProperties.C:256
PorousFlowFluidStateBase::_empty_fsp
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
Definition: PorousFlowFluidStateBase.h:139
PorousFlowWaterNCG::moleFractionToMassFraction
DualReal moleFractionToMassFraction(const DualReal &xmol) const
Convert mole fraction to mass fraction.
Definition: PorousFlowWaterNCG.C:378
PorousFlowFluidStateBase::_gas_phase_number
unsigned int _gas_phase_number
Phase number of the gas phase.
Definition: PorousFlowFluidStateBase.h:125
SinglePhaseFluidProperties::henryCoefficients
virtual std::vector< Real > henryCoefficients() const
Henry's law coefficients for dissolution in water.
Definition: SinglePhaseFluidProperties.C:183
PorousFlowFluidStateFlash::rachfordRiceDeriv
Real rachfordRiceDeriv(Real vf, std::vector< Real > &Zi, std::vector< Real > &Ki) const
Derivative of Rachford-Rice equation wrt vapor fraction.
Definition: PorousFlowFluidStateFlash.C:53
PorousFlowWaterNCG::_ncg_fp
const SinglePhaseFluidProperties & _ncg_fp
Fluid properties UserObject for the NCG.
Definition: PorousFlowWaterNCG.h:190
PorousFlowFluidStateBase::_pc
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
Definition: PorousFlowFluidStateBase.h:137
PorousFlowFluidStateMultiComponentBase::PorousFlowFluidStateMultiComponentBase
PorousFlowFluidStateMultiComponentBase(const InputParameters &parameters)
Definition: PorousFlowFluidStateMultiComponentBase.C:21
PorousFlowWaterNCG::saturation
DualReal saturation(const DualReal &pressure, const DualReal &temperature, const DualReal &Z, std::vector< FluidStateProperties > &fsp) const
Gas saturation in the two-phase region.
Definition: PorousFlowWaterNCG.C:300
FluidStateProperties::density
DualReal density
Definition: PorousFlowFluidStateBase.h:42
FluidStateProperties::pressure
DualReal pressure
Definition: PorousFlowFluidStateBase.h:37
PorousFlowWaterNCG::gasDensity
DualReal gasDensity(const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
Density of the gas phase.
Definition: PorousFlowWaterNCG.C:280
PorousFlowWaterNCG::twoPhaseProperties
void twoPhaseProperties(const DualReal &pressure, const DualReal &temperature, const DualReal &Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const
Gas and liquid properties in the two-phase region.
Definition: PorousFlowWaterNCG.C:334
PorousFlowWaterNCG::enthalpyOfDissolution
DualReal enthalpyOfDissolution(const DualReal &temperature) const
Enthalpy of dissolution of NCG in water calculated using Henry's constant From Himmelblau,...
Definition: PorousFlowWaterNCG.C:394
PorousFlowFluidStateMultiComponentBase::_Xidx
const unsigned int _Xidx
Index of derivative wrt salt mass fraction X.
Definition: PorousFlowFluidStateMultiComponentBase.h:83
FluidStatePhaseEnum
FluidStatePhaseEnum
Phase state enum.
Definition: PorousFlowFluidStateBase.h:18
FluidStateProperties::enthalpy
DualReal enthalpy
Definition: PorousFlowFluidStateBase.h:44
FluidStateProperties::mass_fraction
std::vector< DualReal > mass_fraction
Definition: PorousFlowFluidStateBase.h:46
PorousFlowWaterNCG::_water_fp
const SinglePhaseFluidProperties & _water_fp
Fluid properties UserObject for water.
Definition: PorousFlowWaterNCG.h:186
Water97FluidProperties::henryConstant
Real henryConstant(Real temperature, const std::vector< Real > &coeffs) const
IAPWS formulation of Henry's law constant for dissolution in water From Guidelines on the Henry's con...
Definition: Water97FluidProperties.C:1866
PorousFlowFluidStateMultiComponentBase::_Tidx
const unsigned int _Tidx
Index of derivative wrt temperature.
Definition: PorousFlowFluidStateMultiComponentBase.h:81
PorousFlowWaterNCG::liquidProperties
void liquidProperties(const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
Liquid properties - density, viscosity and enthalpy Note: The pressure here is the liquid pressure.
Definition: PorousFlowWaterNCG.C:243
PorousFlowFluidStateFlash::vaporMassFraction
Real vaporMassFraction(Real Z0, Real K0, Real K1) const
Solves Rachford-Rice equation to provide vapor mass fraction.
Definition: PorousFlowFluidStateFlash.C:81
PorousFlowWaterNCG::_Mh2o
const Real _Mh2o
Molar mass of water (kg/mol)
Definition: PorousFlowWaterNCG.h:192
PorousFlowFluidStateBase::_gas_fluid_component
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
Definition: PorousFlowFluidStateBase.h:129
FluidStatePhaseEnum::LIQUID
PorousFlowFluidStateMultiComponentBase::_Zidx
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
Definition: PorousFlowFluidStateMultiComponentBase.h:79
PorousFlowWaterNCG::_water_critical_temperature
const Real _water_critical_temperature
Critical temperature of water (K)
Definition: PorousFlowWaterNCG.h:198
PorousFlowFluidStateFlash::_nr_max_its
const Real _nr_max_its
Maximum number of iterations for the Newton-Raphson routine.
Definition: PorousFlowFluidStateFlash.h:80
SinglePhaseFluidProperties::triplePointTemperature
virtual Real triplePointTemperature() const
Triple point temperature.
Definition: SinglePhaseFluidProperties.C:138
PorousFlowFluidStateFlash::_nr_tol
const Real _nr_tol
Tolerance for Newton-Raphson iterations.
Definition: PorousFlowFluidStateFlash.h:82
PorousFlowWaterNCG::gasProperties
void gasProperties(const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
Gas properties - density, viscosity and enthalpy.
Definition: PorousFlowWaterNCG.C:203
PorousFlowFluidStateBase::_salt_component
const unsigned int _salt_component
Salt component index.
Definition: PorousFlowFluidStateBase.h:131
FluidStateProperties
AD data structure to pass calculated thermophysical properties.
Definition: PorousFlowFluidStateBase.h:26
PorousFlowWaterNCG::checkVariables
void checkVariables(Real temperature) const
Check that the temperature is between the triple and critical values.
Definition: PorousFlowWaterNCG.C:384
PorousFlowCapillaryPressure::capillaryPressure
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
Definition: PorousFlowCapillaryPressure.C:64
SinglePhaseFluidProperties::criticalTemperature
virtual Real criticalTemperature() const
Critical temperature.
Definition: SinglePhaseFluidProperties.C:114
PorousFlowFluidStateBase::_aqueous_phase_number
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
Definition: PorousFlowFluidStateBase.h:123
PorousFlowFluidStateBase::_num_phases
unsigned int _num_phases
Number of phases.
Definition: PorousFlowFluidStateBase.h:119
PorousFlowWaterNCG::equilibriumMassFractions
void equilibriumMassFractions(const DualReal &pressure, const DualReal &temperature, DualReal &Xncg, DualReal &Yh2o) const
Mass fractions of NCG in liquid phase and H2O in gas phase at thermodynamic equilibrium.
Definition: PorousFlowWaterNCG.C:354
SinglePhaseFluidProperties::vaporPressure
virtual Real vaporPressure(Real T) const
Vapor pressure.
Definition: SinglePhaseFluidProperties.C:177
name
const std::string name
Definition: Setup.h:21
PorousFlowWaterNCG::_Mncg
const Real _Mncg
Molar mass of non-condensable gas (kg/mol)
Definition: PorousFlowWaterNCG.h:194
PorousFlowFluidStateBase::_num_components
unsigned int _num_components
Number of components.
Definition: PorousFlowFluidStateBase.h:121
FluidStatePhaseEnum::TWOPHASE
PorousFlowWaterNCG::_water97_fp
const Water97FluidProperties & _water97_fp
Fluid properties UserObject for water (used to access Henry's law)
Definition: PorousFlowWaterNCG.h:188
PorousFlowFluidStateBase::clearFluidStateProperties
void clearFluidStateProperties(std::vector< FluidStateProperties > &fsp) const
Clears the contents of the FluidStateProperties data structure.
Definition: PorousFlowFluidStateBase.C:39
FluidStatePhaseEnum::GAS
SinglePhaseFluidProperties::molarMass
virtual virtual std Real molarMass() const
Fluid name.
Definition: SinglePhaseFluidProperties.C:96
FluidStateProperties::internal_energy
DualReal internal_energy
Definition: PorousFlowFluidStateBase.h:45
PorousFlowFluidStateBase::_aqueous_fluid_component
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
Definition: PorousFlowFluidStateBase.h:127
NS::temperature
const std::string temperature
Definition: NS.h:26
FluidStateProperties::viscosity
DualReal viscosity
Definition: PorousFlowFluidStateBase.h:43
PorousFlowWaterNCG::_water_triple_temperature
const Real _water_triple_temperature
Triple point temperature of water (K)
Definition: PorousFlowWaterNCG.h:196
PorousFlowWaterNCG::massFractions
void massFractions(const DualReal &pressure, const DualReal &temperature, const DualReal &Z, FluidStatePhaseEnum &phase_state, std::vector< FluidStateProperties > &fsp) const
Mass fractions of NCG and H2O in both phases, as well as derivatives wrt PorousFlow variables.
Definition: PorousFlowWaterNCG.C:139
FluidStateProperties::saturation
DualReal saturation
Definition: PorousFlowFluidStateBase.h:41
PorousFlowFluidStateMultiComponentBase::_pidx
const unsigned int _pidx
Index of derivative wrt pressure.
Definition: PorousFlowFluidStateMultiComponentBase.h:73
PorousFlowFluidStateBase::_R
const Real _R
Universal gas constant (J/mol/K)
Definition: PorousFlowFluidStateBase.h:133
PorousFlowWaterNCG::_ncg_henry
const std::vector< Real > _ncg_henry
Henry's coefficients for the NCG.
Definition: PorousFlowWaterNCG.h:200
NS::pressure
const std::string pressure
Definition: NS.h:25
PorousFlowFluidStateFlash::rachfordRice
Real rachfordRice(Real vf, std::vector< Real > &Zi, std::vector< Real > &Ki) const
Rachford-Rice equation for vapor fraction.
Definition: PorousFlowFluidStateFlash.C:27
PorousFlowFluidStateMultiComponentBase::phaseState
void phaseState(Real Zi, Real Xi, Real Yi, FluidStatePhaseEnum &phase_state) const
Determines the phase state gven the total mass fraction and equilibrium mass fractions.
Definition: PorousFlowFluidStateMultiComponentBase.C:28