18 MooseEnum unit_choice(
"Kelvin=0 Celsius=1",
"Kelvin");
20 "temperature_unit", unit_choice,
"The unit of the temperature variable");
22 "Name of the UserObject defining the capillary pressure");
24 params.
addClassDescription(
"Base class for fluid state calculations using persistent primary " 25 "variables and a vapor-liquid flash");
33 _T_c2k(this->template getParam<
MooseEnum>(
"temperature_unit") == 0 ? 0.0 : 273.15),
36 _sfx(_nodal_material ?
"_nodal" :
"_qp"),
37 _mass_frac(this->template declareGenericProperty<
std::vector<
std::vector<
Real>>, is_ad>(
38 "PorousFlow_mass_frac" + _sfx)),
42 : &this->template declareGenericProperty<
std::vector<
std::vector<
RealGradient>>, is_ad>(
43 "PorousFlow_grad_mass_frac" + _sfx)),
46 : &this->template declareProperty<
std::vector<
std::vector<
std::vector<
Real>>>>(
47 "dPorousFlow_mass_frac" + _sfx +
"_dvar")),
48 _fluid_density(this->template declareGenericProperty<
std::vector<
Real>, is_ad>(
49 "PorousFlow_fluid_phase_density" + _sfx)),
50 _dfluid_density_dvar(is_ad ? nullptr
51 : &this->template declareProperty<
std::vector<
std::vector<
Real>>>(
52 "dPorousFlow_fluid_phase_density" + _sfx +
"_dvar")),
53 _fluid_viscosity(this->template declareGenericProperty<
std::vector<
Real>, is_ad>(
54 "PorousFlow_viscosity" + _sfx)),
55 _dfluid_viscosity_dvar(is_ad ? nullptr
56 : &this->template declareProperty<
std::vector<
std::vector<
Real>>>(
57 "dPorousFlow_viscosity" + _sfx +
"_dvar")),
58 _fluid_enthalpy(this->template declareGenericProperty<
std::vector<
Real>, is_ad>(
59 "PorousFlow_fluid_phase_enthalpy" + _sfx)),
60 _dfluid_enthalpy_dvar(is_ad ? nullptr
61 : &this->template declareProperty<
std::vector<
std::vector<
Real>>>(
62 "dPorousFlow_fluid_phase_enthalpy" + _sfx +
"_dvar")),
63 _fluid_internal_energy(this->template declareGenericProperty<
std::vector<
Real>, is_ad>(
64 "PorousFlow_fluid_phase_internal_energy" + _sfx)),
65 _dfluid_internal_energy_dvar(
67 : &this->template declareProperty<
std::vector<
std::vector<
Real>>>(
68 "dPorousFlow_fluid_phase_internal_energy" + _sfx +
"_dvar"))
97 setMaterialVectorSize();
99 thermophysicalProperties();
104 if (_nodal_material || is_ad)
105 for (
unsigned int ph = 0; ph < _num_phases; ++ph)
107 _saturation[_qp][ph] = genericValue(_fsp[ph].saturation);
108 _porepressure[_qp][ph] = genericValue(_fsp[ph].
pressure);
109 _fluid_density[_qp][ph] = genericValue(_fsp[ph].
density);
110 _fluid_viscosity[_qp][ph] = genericValue(_fsp[ph].viscosity);
111 _fluid_enthalpy[_qp][ph] = genericValue(_fsp[ph].enthalpy);
112 _fluid_internal_energy[_qp][ph] = genericValue(_fsp[ph].
internal_energy);
114 for (
unsigned int comp = 0; comp < _num_components; ++comp)
115 _mass_frac[_qp][ph][comp] = genericValue(_fsp[ph].mass_fraction[comp]);
119 template <
bool is_ad>
128 setMaterialVectorSize();
131 thermophysicalProperties();
133 for (
unsigned int ph = 0; ph < _num_phases; ++ph)
135 _saturation[_qp][ph] = genericValue(_fsp[ph].saturation);
136 _porepressure[_qp][ph] = genericValue(_fsp[ph].
pressure);
137 _fluid_density[_qp][ph] = genericValue(_fsp[ph].
density);
138 _fluid_viscosity[_qp][ph] = genericValue(_fsp[ph].viscosity);
139 _fluid_enthalpy[_qp][ph] = genericValue(_fsp[ph].enthalpy);
140 _fluid_internal_energy[_qp][ph] = genericValue(_fsp[ph].
internal_energy);
142 for (
unsigned int comp = 0; comp < _num_components; ++comp)
143 _mass_frac[_qp][ph][comp] = genericValue(_fsp[ph].mass_fraction[comp]);
147 template <
bool is_ad>
151 _fluid_density[_qp].resize(_num_phases, 0.0);
152 _fluid_viscosity[_qp].resize(_num_phases, 0.0);
153 _fluid_enthalpy[_qp].resize(_num_phases, 0.0);
154 _fluid_internal_energy[_qp].resize(_num_phases, 0.0);
155 _mass_frac[_qp].resize(_num_phases);
157 for (
unsigned int ph = 0; ph < _num_phases; ++ph)
158 _mass_frac[_qp][ph].resize(_num_components);
164 if (!_nodal_material || is_ad)
166 (*_grad_mass_frac_qp)[_qp].resize(_num_phases);
168 for (
unsigned int ph = 0; ph < _num_phases; ++ph)
169 (*_grad_mass_frac_qp)[_qp][ph].assign(_num_components,
RealGradient());
175 (*_dfluid_density_dvar)[_qp].resize(_num_phases);
176 (*_dfluid_viscosity_dvar)[_qp].resize(_num_phases);
177 (*_dfluid_enthalpy_dvar)[_qp].resize(_num_phases);
178 (*_dfluid_internal_energy_dvar)[_qp].resize(_num_phases);
179 (*_dmass_frac_dvar)[_qp].resize(_num_phases);
181 for (
unsigned int ph = 0; ph < _num_phases; ++ph)
183 (*_dfluid_density_dvar)[_qp][ph].assign(_num_pf_vars, 0.0);
184 (*_dfluid_viscosity_dvar)[_qp][ph].assign(_num_pf_vars, 0.0);
185 (*_dfluid_enthalpy_dvar)[_qp][ph].assign(_num_pf_vars, 0.0);
186 (*_dfluid_internal_energy_dvar)[_qp][ph].assign(_num_pf_vars, 0.0);
187 (*_dmass_frac_dvar)[_qp][ph].resize(_num_components);
189 for (
unsigned int comp = 0; comp < _num_components; ++comp)
190 (*_dmass_frac_dvar)[_qp][ph][comp].assign(_num_pf_vars, 0.0);
virtual void computeQpProperties() override
Moose::GenericType< Real, is_ad > GenericReal
virtual void initQpStatefulProperties() override
static const std::string density
static InputParameters validParams()
GenericReal< is_ad > genericValue(const ADReal &value)
Templated method that takes an ADReal value, and returns the raw value when is_ad = false...
Base class for capillary pressure for multiphase flow in porous media.
Base class for thermophysical variable materials, which assemble materials for primary variables such...
virtual void setMaterialVectorSize() const
Size material property vectors and initialise with zeros.
static InputParameters validParams()
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
virtual void computeQpProperties() override
AD data structure to pass calculated thermophysical properties.
const unsigned int _num_components
Number of components.
virtual void initQpStatefulProperties() override
Fluid state base class using a persistent set of primary variables for multiphase, single and multicomponent cases.
const unsigned int _num_phases
Number of phases.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string pressure
std::vector< FluidStateProperties > _fsp
FluidStateProperties data for each fluid component in each fluid phase.
static const std::string internal_energy
PorousFlowFluidStateBaseMaterialTempl(const InputParameters ¶meters)