Go to the documentation of this file.
13 #include "Conversion.h"
22 params.addRequiredParam<UserObjectName>(
"water_fp",
"The name of the user object for water");
23 params.addRequiredParam<UserObjectName>(
24 "gas_fp",
"The name of the user object for the non-condensable gas");
25 params.addClassDescription(
"Fluid state class for water and non-condensable gas");
34 _Mh2o(_water_fp.molarMass()),
35 _Mncg(_ncg_fp.molarMass()),
36 _water_triple_temperature(_water_fp.triplePointTemperature()),
37 _water_critical_temperature(_water_fp.criticalTemperature()),
38 _ncg_henry(_ncg_fp.henryCoefficients())
42 paramError(
"water_fp",
"A valid water FluidProperties UserObject must be provided in water_fp");
52 paramError(
"liquid_phase_number",
53 "This value is larger than the possible number of phases ",
58 paramError(
"liquid_fluid_component",
59 "This value is larger than the possible number of fluid components",
77 std::vector<FluidStateProperties> & fsp)
const
87 Moose::derivInsert(p.derivatives(),
_pidx, 1.0);
89 Moose::derivInsert(T.derivatives(),
_Tidx, 1.0);
91 Moose::derivInsert(Zncg.derivatives(),
_Zidx, 1.0);
143 std::vector<FluidStateProperties> & fsp)
const
152 DualReal Yncg = 1.0 - Yh2o;
155 phaseState(Z.value(), Xncg.value(), Yncg.value(), phase_state);
170 Moose::derivInsert(Xncg.derivatives(),
_pidx, 0.0);
171 Moose::derivInsert(Xncg.derivatives(),
_Tidx, 0.0);
172 Moose::derivInsert(Xncg.derivatives(),
_Zidx, 1.0);
181 Moose::derivInsert(Yncg.derivatives(),
_pidx, 0.0);
182 Moose::derivInsert(Yncg.derivatives(),
_Tidx, 0.0);
183 Moose::derivInsert(Yncg.derivatives(),
_Zidx, 1.0);
205 std::vector<FluidStateProperties> & fsp)
const
217 DualReal ncg_density, ncg_viscosity;
223 DualReal vapor_density, vapor_viscosity;
229 gas.
density = ncg_density + vapor_density;
232 gas.
viscosity = Yncg * ncg_viscosity + (1.0 - Yncg) * vapor_viscosity;
235 gas.
enthalpy = Yncg * ncg_enthalpy + (1.0 - Yncg) * vapor_enthalpy;
238 mooseAssert(gas.
density.value() > 0.0,
"Gas density must be greater than zero");
245 std::vector<FluidStateProperties> & fsp)
const
253 DualReal liquid_density, liquid_viscosity;
256 liquid.
density = liquid_density;
266 liquid.
enthalpy = (1.0 - Xncg) * water_enthalpy + Xncg * (ncg_enthalpy + hdis);
269 mooseAssert(liquid.
density.value() > 0.0,
"Liquid density must be greater than zero");
282 std::vector<FluidStateProperties> & fsp)
const
296 return ncg_density + vapor_density;
303 std::vector<FluidStateProperties> & fsp)
const
322 const DualReal K0 = Yncg / Xncg;
323 const DualReal K1 = (1.0 - Yncg) / (1.0 - Xncg);
327 const DualReal
saturation = vapor_mass_fraction * liquid_density /
328 (gas_density + vapor_mass_fraction * (liquid_density - gas_density));
338 std::vector<FluidStateProperties> & fsp)
const
357 DualReal & Yh2o)
const
364 const DualReal Kncg = Kh /
pressure;
365 const DualReal Kh2o = psat /
pressure;
369 const DualReal xncg = (1.0 - Kh2o) / (Kncg - Kh2o);
370 const DualReal yncg = Kncg * xncg;
389 mooseException(
name() +
": temperature " + Moose::stringify(
temperature) +
390 " is outside range 273.16 K <= T <= 647.096 K");
407 const Real dhdis_dT =
408 (-
_R * t2 * t2 * Kh2.derivatives()[
_Tidx] / Kh2 /
_Mncg - hdis).value() / dT;
410 hdis.derivatives() =
temperature.derivatives() * dhdis_dT;
436 const DualReal Yncg = 1.0 - Yh2o;
443 const Real gas_density =
gasDensity(p, T, fsp).value();
447 const Real liquid_density =
liquidDensity(liquid_pressure, T).value();
450 const Real Z = (
saturation * gas_density * Yncg.value() +
451 (1.0 -
saturation) * liquid_density * Xncg.value()) /
DualReal liquidDensity(const DualReal &pressure, const DualReal &temperature) const
Density of the liquid phase Note: The pressure here is the gas pressure.
virtual void rho_mu_from_p_T(Real p, Real T, Real &rho, Real &mu) const
Combined methods.
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
DualReal moleFractionToMassFraction(const DualReal &xmol) const
Convert mole fraction to mass fraction.
unsigned int _gas_phase_number
Phase number of the gas phase.
Common class for single phase fluid properties.
const SinglePhaseFluidProperties & _ncg_fp
Fluid properties UserObject for the NCG.
Compositional flash routines for miscible multiphase flow classes with multiple fluid components.
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
DualReal saturation(const DualReal &pressure, const DualReal &temperature, const DualReal &Z, std::vector< FluidStateProperties > &fsp) const
Gas saturation in the two-phase region.
DualReal gasDensity(const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
Density of the gas phase.
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.
DualReal enthalpyOfDissolution(const DualReal &temperature) const
Enthalpy of dissolution of NCG in water calculated using Henry's constant From Himmelblau,...
FluidStatePhaseEnum
Phase state enum.
virtual std::string fluidStateName() const override
Name of FluidState.
std::vector< DualReal > mass_fraction
const SinglePhaseFluidProperties & _water_fp
Fluid properties UserObject for water.
registerMooseObject("PorousFlowApp", PorousFlowWaterNCG)
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...
const unsigned int _Tidx
Index of derivative wrt temperature.
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.
Real vaporMassFraction(Real Z0, Real K0, Real K1) const
Solves Rachford-Rice equation to provide vapor mass fraction.
const Real _Mh2o
Molar mass of water (kg/mol)
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
const Real _water_critical_temperature
Critical temperature of water (K)
void gasProperties(const DualReal &pressure, const DualReal &temperature, std::vector< FluidStateProperties > &fsp) const
Gas properties - density, viscosity and enthalpy.
AD data structure to pass calculated thermophysical properties.
void checkVariables(Real temperature) const
Check that the temperature is between the triple and critical values.
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
unsigned int _num_phases
Number of phases.
Water (H2O) fluid properties as a function of pressure (Pa) and temperature (K) from IAPWS-IF97: Revi...
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.
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 ...
virtual Real vaporPressure(Real T) const
Vapor pressure.
PorousFlowWaterNCG(const InputParameters ¶meters)
Specialized class for water and a non-condensable gas (NCG) Includes dissolution of gas in liquid wat...
const Real _Mncg
Molar mass of non-condensable gas (kg/mol)
unsigned int _num_components
Number of components.
InputParameters validParams< PorousFlowFluidStateMultiComponentBase >()
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.
const Water97FluidProperties & _water97_fp
Fluid properties UserObject for water (used to access Henry's law)
void clearFluidStateProperties(std::vector< FluidStateProperties > &fsp) const
Clears the contents of the FluidStateProperties data structure.
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
const std::string temperature
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.
const unsigned int _pidx
Index of derivative wrt pressure.
InputParameters validParams< PorousFlowWaterNCG >()
const Real _R
Universal gas constant (J/mol/K)
const std::vector< Real > _ncg_henry
Henry's coefficients for the NCG.
const std::string pressure
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.