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 98 std::vector<FluidStateProperties> & fsp)
const 156 std::vector<FluidStateProperties> & fsp)
const 168 phaseState(
Z.value(), Xncg.value(), Yncg.value(), phase_state);
212 std::vector<FluidStateProperties> & fsp)
const 224 ADReal ncg_density, ncg_viscosity;
230 ADReal vapor_density, vapor_viscosity;
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");
252 std::vector<FluidStateProperties> & fsp)
const 260 ADReal liquid_density, liquid_viscosity;
263 liquid.
density = liquid_density;
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");
289 std::vector<FluidStateProperties> & fsp)
const 303 return ncg_density + vapor_density;
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));
345 std::vector<FluidStateProperties> & fsp)
const 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");
414 const Real dhdis_dT =
417 hdis.derivatives() =
temperature.derivatives() * dhdis_dT;
443 const ADReal Yncg = 1.0 - Yh2o;
458 (1.0 -
saturation) * liquid_density * Xncg.value()) /
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
unsigned int _num_phases
Number of phases.
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...
virtual std::string fluidStateName() const override
Name of FluidState.
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.
const std::vector< Real > _ncg_henry
Henry's coefficients for the NCG.
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
const unsigned int _Tidx
Index of derivative wrt temperature.
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...
ADReal moleFractionToMassFraction(const ADReal &xmol) const
Convert mole fraction to mass fraction.
unsigned int _gas_phase_number
Phase number of the gas phase.
void clearFluidStateProperties(std::vector< FluidStateProperties > &fsp) const
Clears the contents of the FluidStateProperties data structure.
unsigned int _num_components
Number of components.
Compositional flash routines for miscible multiphase flow classes with multiple fluid components...
static const std::string temperature
DualNumber< Real, DNDerivativeType, true > ADReal
virtual const std::string & name() const
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.
static InputParameters validParams()
const unsigned int _pidx
Index of derivative wrt pressure.
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
ADReal saturation(const ADReal &pressure, const ADReal &temperature, const ADReal &Z, std::vector< FluidStateProperties > &fsp) const
Gas saturation in the two-phase region.
const SinglePhaseFluidProperties & _water_fp
Fluid properties UserObject for water.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
PorousFlowWaterNCG(const InputParameters ¶meters)
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 Real _R
Universal gas constant (J/mol/K)
const Water97FluidProperties & _water97_fp
Fluid properties UserObject for water (used to access Henry's law)
AD data structure to pass calculated thermophysical properties.
Common class for single phase fluid properties.
FluidStatePhaseEnum
Phase state enum.
void paramError(const std::string ¶m, Args... args) const
std::string stringify(const T &t)
ADReal enthalpyOfDissolution(const ADReal &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.
ADReal gasDensity(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Density of the gas phase.
const Real _Mh2o
Molar mass of water (kg/mol)
Specialized class for water and a non-condensable gas (NCG) Includes dissolution of gas in liquid wat...
const Real _water_critical_temperature
Critical temperature of water (K)
virtual void rho_mu_from_p_T(Real p, Real T, Real &rho, Real &mu) const
Combined methods.
static const std::string Z
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
static InputParameters validParams()
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.
void checkVariables(Real temperature) const
Check that the temperature is between the triple and critical values.
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 ...
Real vaporMassFraction(Real Z0, Real K0, Real K1) const
Solves Rachford-Rice equation to provide vapor mass fraction.
Water (H2O) fluid properties as a function of pressure (Pa) and temperature (K) from IAPWS-IF97: Revi...
static const std::string pressure
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
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...
ADReal liquidDensity(const ADReal &pressure, const ADReal &temperature) const
Density of the liquid phase Note: The pressure here is the gas pressure.
const Real _Mncg
Molar mass of non-condensable gas (kg/mol)
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.
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N >> &derivs, libMesh::dof_id_type index, Real value)
const unsigned int _Xidx
Index of derivative wrt salt mass fraction X.
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
virtual Real vaporPressure(Real T) const
Vapor pressure.
void gasProperties(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Gas properties - density, viscosity and enthalpy.
std::vector< ADReal > mass_fraction
registerMooseObject("PorousFlowApp", PorousFlowWaterNCG)
const SinglePhaseFluidProperties & _ncg_fp
Fluid properties UserObject for the NCG.