25 MooseEnum coupling_type(
"Hydro ThermoHydro HydroMechanical ThermoHydroMechanical",
"Hydro");
29 "The type of simulation. For simulations involving Mechanical deformations, you will need " 30 "to supply the correct Biot coefficient. For simulations involving Thermal flows, you will " 31 "need an associated ConstantThermalExpansionCoefficient Material");
33 "biot_coefficient", 1.0,
"biot_coefficient>=0 & biot_coefficient<=1",
"Biot coefficient");
34 params.
addParam<
bool>(
"multiply_by_density",
36 "If true, then this Kernel is the time derivative of the fluid mass. If " 37 "false, then this Kernel is the derivative of the fluid volume (which is " 38 "common in poro-mechanics)");
40 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
42 "Fully-saturated version of the single-component, single-phase fluid mass derivative wrt " 52 _var_is_porflow_var(_dictator.isPorousFlowVariable(_var.number())),
53 _multiply_by_density(this->template getParam<bool>(
"multiply_by_density")),
60 _biot_coefficient(this->template getParam<
Real>(
"biot_coefficient")),
61 _biot_modulus(this->template getMaterialProperty<
Real>(
"PorousFlow_constant_biot_modulus_qp")),
62 _thermal_coeff(_includes_thermal ? &this->template getMaterialProperty<
Real>(
63 "PorousFlow_constant_thermal_expansion_coefficient_qp")
65 _fluid_density(_multiply_by_density
66 ? &this->template getGenericMaterialProperty<
std::vector<
Real>, is_ad>(
67 "PorousFlow_fluid_phase_density_qp")
69 _dfluid_density_dvar(_multiply_by_density && !is_ad
70 ? &this->template getMaterialProperty<
std::vector<
std::vector<
Real>>>(
71 "dPorousFlow_fluid_phase_density_qp_dvar")
73 _pp(this->template getGenericMaterialProperty<
std::vector<
Real>, is_ad>(
74 "PorousFlow_porepressure_qp")),
75 _pp_old(this->template getMaterialPropertyOld<
std::vector<
Real>>(
"PorousFlow_porepressure_qp")),
76 _dpp_dvar(is_ad ? nullptr
77 : &this->template getMaterialProperty<
std::vector<
std::vector<
Real>>>(
78 "dPorousFlow_porepressure_qp_dvar")),
79 _temperature(_includes_thermal ? &this->template getGenericMaterialProperty<
Real, is_ad>(
80 "PorousFlow_temperature_qp")
82 _temperature_old(_includes_thermal
83 ? &this->template getMaterialPropertyOld<
Real>(
"PorousFlow_temperature_qp")
85 _dtemperature_dvar(_includes_thermal && !is_ad
86 ? &this->template getMaterialProperty<
std::vector<
Real>>(
87 "dPorousFlow_temperature_qp_dvar")
89 _strain_rate(_includes_mechanical ? &this->template getMaterialProperty<
Real>(
90 "PorousFlow_volumetric_strain_rate_qp")
92 _dstrain_rate_dvar(_includes_mechanical && !is_ad
94 "dPorousFlow_volumetric_strain_rate_qp_dvar")
98 mooseError(
"PorousFlowFullySaturatedMassTimeDerivative is only applicable to single-phase, " 99 "single-component fluid-flow problems. The Dictator proclaims that you have more " 100 "than one phase or more than one fluid component. The Dictator does not take such " 104 template <
bool is_ad>
108 const unsigned phase = 0;
110 if (_includes_thermal)
111 volume -= (*_thermal_coeff)[_qp] * ((*_temperature)[_qp] - (*_temperature_old)[_qp]) / _dt;
112 if (_includes_mechanical)
113 volume += _biot_coefficient * (*_strain_rate)[_qp];
114 if (_multiply_by_density)
115 return _test[_i][_qp] * (*_fluid_density)[_qp][phase] *
volume;
116 return _test[_i][_qp] *
volume;
119 template <
bool is_ad>
123 if constexpr (!is_ad)
125 if (!_var_is_porflow_var)
127 return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
132 template <
bool is_ad>
136 if constexpr (!is_ad)
138 if (_dictator.notPorousFlowVariable(jvar))
140 return computeQpJac(_dictator.porousFlowVariableNum(jvar));
147 template <
bool is_ad>
151 if constexpr (!is_ad)
153 const unsigned phase = 0;
154 Real volume = (_pp[_qp][phase] - _pp_old[_qp][phase]) / _dt / _biot_modulus[_qp];
155 Real dvolume = (*_dpp_dvar)[_qp][phase][pvar] / _dt / _biot_modulus[_qp] * _phi[_j][_qp];
156 if (_includes_thermal)
158 volume -= (*_thermal_coeff)[_qp] * ((*_temperature)[_qp] - (*_temperature_old)[_qp]) / _dt;
159 dvolume -= (*_thermal_coeff)[_qp] * (*_dtemperature_dvar)[_qp][pvar] / _dt * _phi[_j][_qp];
161 if (_includes_mechanical)
163 volume += _biot_coefficient * (*_strain_rate)[_qp];
164 dvolume += _biot_coefficient * (*_dstrain_rate_dvar)[_qp][pvar] * _grad_phi[_j][_qp];
166 if (_multiply_by_density)
167 return _test[_i][_qp] * ((*_fluid_density)[_qp][phase] * dvolume +
168 (*_dfluid_density_dvar)[_qp][phase][pvar] * _phi[_j][_qp] *
volume);
169 return _test[_i][_qp] * dvolume;
Moose::GenericType< Real, is_ad > GenericReal
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
Time derivative of fluid mass for fully-saturated, single-phase, single-component simulations...
static InputParameters validParams()
CouplingTypeEnum
Determines whether mechanical and/or thermal contributions should be added to the residual...
unsigned int numComponents() const
The number of fluid components.
Real computeQpJac(unsigned int pvar)
Jacobian contribution for PorousFlow variable pvar (non-AD path only)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
registerMooseObject("PorousFlowApp", PorousFlowFullySaturatedMassTimeDerivative)
void libmesh_ignore(const Args &...)
static InputParameters validParams()
virtual GenericReal< is_ad > computeQpResidual() override
unsigned int numPhases() const
The number of fluid phases.
virtual Real computeQpJacobian() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
void mooseError(Args &&... args) const