21 params.
addRequiredParam<UserObjectName>(
"water_fp",
"The name of the user object for water");
23 "gas_fp",
"The name of the user object for the non-condensable gas");
33 _Mh2o(_water_fp.molarMass()),
34 _Mncg(_ncg_fp.molarMass()),
35 _water_triple_temperature(_water_fp.triplePointTemperature()),
36 _water_critical_temperature(_water_fp.criticalTemperature()),
37 _ncg_henry(_ncg_fp.henryCoefficients())
41 paramError(
"water_fp",
"A valid water FluidProperties UserObject must be provided in water_fp");
52 "This value is larger than the possible number of phases ",
58 "This value is larger than the possible number of fluid components",
76 std::vector<FluidStateProperties> & fsp)
const
94 const ADReal & temperature,
98 std::vector<FluidStateProperties> & fsp)
const
153 const ADReal & temperature,
156 std::vector<FluidStateProperties> & fsp)
const
168 phaseState(Z.value(), Xncg.value(), Yncg.value(), phase_state);
211 const ADReal & temperature,
212 std::vector<FluidStateProperties> & fsp)
const
224 ADReal ncg_density, ncg_viscosity;
226 ADReal ncg_enthalpy =
_ncg_fp.h_from_p_T(Yncg * pressure, temperature);
230 ADReal vapor_density, vapor_viscosity;
233 ADReal vapor_enthalpy =
_water_fp.h_from_p_T((1.0 - Xncg) * psat, temperature);
236 gas.
density = ncg_density + vapor_density;
239 gas.
viscosity = Yncg * ncg_viscosity + (1.0 - Yncg) * vapor_viscosity;
242 gas.
enthalpy = Yncg * ncg_enthalpy + (1.0 - Yncg) * vapor_enthalpy;
245 mooseAssert(gas.
density.value() > 0.0,
"Gas density must be greater than zero");
251 const ADReal & temperature,
252 std::vector<FluidStateProperties> & fsp)
const
260 ADReal liquid_density, liquid_viscosity;
263 liquid.
density = liquid_density;
269 const ADReal water_enthalpy =
_water_fp.h_from_p_T(pressure, temperature);
270 const ADReal ncg_enthalpy =
_ncg_fp.h_from_p_T(pressure, temperature);
273 liquid.
enthalpy = (1.0 - Xncg) * water_enthalpy + Xncg * (ncg_enthalpy + hdis);
276 mooseAssert(liquid.
density.value() > 0.0,
"Liquid density must be greater than zero");
283 return _water_fp.rho_from_p_T(pressure, temperature);
288 const ADReal & temperature,
289 std::vector<FluidStateProperties> & fsp)
const
299 ADReal ncg_density =
_ncg_fp.rho_from_p_T(Yncg * pressure, temperature);
300 ADReal vapor_density =
_water_fp.rho_from_p_T((1.0 - Xncg) * psat, temperature);
303 return ncg_density + vapor_density;
308 const ADReal & temperature,
310 std::vector<FluidStateProperties> & fsp)
const
329 const ADReal K0 = Yncg / Xncg;
330 const ADReal K1 = (1.0 - Yncg) / (1.0 - Xncg);
335 (gas_density + vapor_mass_fraction * (liquid_density - gas_density));
342 const ADReal & temperature,
345 std::vector<FluidStateProperties> & fsp)
const
353 gas.saturation =
saturation(pressure, temperature, Z, fsp);
362 const ADReal & temperature,
371 const ADReal Kncg = Kh / pressure;
372 const ADReal Kh2o = psat / pressure;
376 const ADReal xncg = (1.0 - Kh2o) / (Kncg - Kh2o);
377 const ADReal yncg = Kncg * xncg;
397 " is outside range 273.16 K <= T <= 647.096 K");
410 const Real dT = temperature.value() * 1.0e-8;
411 const ADReal t2 = temperature + dT;
414 const Real dhdis_dT =
415 (-
_R * t2 * t2 * Kh2.derivatives()[
_Tidx] / Kh2 /
_Mncg - hdis).value() / dT;
417 hdis.derivatives() = temperature.derivatives() * dhdis_dT;
424 Real pressure, Real temperature, Real , Real saturation,
unsigned int qp)
const
443 const ADReal Yncg = 1.0 - Yh2o;
454 const Real liquid_density =
liquidDensity(liquid_pressure,
T).value();
457 const Real Z = (
saturation * gas_density * Yncg.value() +
458 (1.0 -
saturation) * liquid_density * Xncg.value()) /
DualNumber< Real, DNDerivativeType, true > ADReal
FluidStatePhaseEnum
Phase state enum.
registerMooseObject("PorousFlowApp", PorousFlowWaterNCG)
void paramError(const std::string ¶m, Args... args) const
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
unsigned int _num_components
Number of components.
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
unsigned int _gas_phase_number
Phase number of the gas phase.
const Real _R
Universal gas constant (J/mol/K)
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
void clearFluidStateProperties(std::vector< FluidStateProperties > &fsp) const
Clears the contents of the FluidStateProperties data structure.
unsigned int _num_phases
Number of phases.
Real vaporMassFraction(Real Z0, Real K0, Real K1) const
Solves Rachford-Rice equation to provide vapor mass fraction.
Compositional flash routines for miscible multiphase flow classes with multiple fluid components.
const unsigned int _Xidx
Index of derivative wrt salt mass fraction X.
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
const unsigned int _pidx
Index of derivative wrt pressure.
const unsigned int _Tidx
Index of derivative wrt temperature.
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
static InputParameters validParams()
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
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.
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)
void checkVariables(Real temperature) const
Check that the temperature is between the triple and critical values.
static InputParameters validParams()
ADReal gasDensity(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Density of the gas phase.
ADReal saturation(const ADReal &pressure, const ADReal &temperature, const ADReal &Z, std::vector< FluidStateProperties > &fsp) const
Gas saturation in the two-phase region.
void massFractions(const ADReal &pressure, const ADReal &temperature, const ADReal &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.
ADReal enthalpyOfDissolution(const ADReal &temperature) const
Enthalpy of dissolution of NCG in water calculated using Henry's constant From Himmelblau,...
const Water97FluidProperties & _water97_fp
Fluid properties UserObject for water (used to access Henry's law)
void liquidProperties(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Liquid properties - density, viscosity and enthalpy Note: The pressure here is the liquid pressure.
const std::vector< Real > _ncg_henry
Henry's coefficients for the NCG.
ADReal liquidDensity(const ADReal &pressure, const ADReal &temperature) const
Density of the liquid phase Note: The pressure here is the gas pressure.
const Real _water_critical_temperature
Critical temperature of water (K)
const SinglePhaseFluidProperties & _ncg_fp
Fluid properties UserObject for the NCG.
void gasProperties(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Gas properties - density, viscosity and enthalpy.
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.
PorousFlowWaterNCG(const InputParameters ¶meters)
ADReal moleFractionToMassFraction(const ADReal &xmol) const
Convert mole fraction to mass fraction.
virtual std::string fluidStateName() const override
Name of FluidState.
const SinglePhaseFluidProperties & _water_fp
Fluid properties UserObject for water.
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 ...
const Real _Mh2o
Molar mass of water (kg/mol)
void twoPhaseProperties(const ADReal &pressure, const ADReal &temperature, const ADReal &Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const
Gas and liquid properties in the two-phase region.
void equilibriumMassFractions(const ADReal &pressure, const ADReal &temperature, ADReal &Xncg, ADReal &Yh2o) const
Mass fractions of NCG in liquid phase and H2O in gas phase at thermodynamic equilibrium.
Common class for single phase fluid properties.
virtual Real vaporPressure(Real T) const
Vapor pressure.
e e e e s T T T T T rho v v T e p T T virtual T std::string fluidName() const
Fluid name.
virtual void rho_mu_from_p_T(Real p, Real T, Real &rho, Real &mu) const
Combined methods.
Water (H2O) fluid properties as a function of pressure (Pa) and temperature (K) from IAPWS-IF97: Revi...
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...
std::string stringify(const T &t)
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
AD data structure to pass calculated thermophysical properties.
std::vector< ADReal > mass_fraction