22 "Variable that is the porepressure of phase " 23 "0 (eg, the water phase). It will be <= " 24 "phase1_porepressure.");
26 "Variable that is the porepressure of phase 1 (eg, the gas phase)");
28 "Name of the UserObject defining the capillary pressure");
29 params.
addClassDescription(
"This Material calculates the 2 porepressures and the 2 saturations " 30 "in a 2-phase situation, and derivatives of these with " 31 "respect to the PorousFlowVariables");
39 _phase0_porepressure(_nodal_material
40 ? this->template coupledGenericDofValue<is_ad>(
"phase0_porepressure")
41 : this->template coupledGenericValue<is_ad>(
"phase0_porepressure")),
42 _phase0_gradp_qp(this->template coupledGenericGradient<is_ad>(
"phase0_porepressure")),
43 _phase0_porepressure_varnum(coupled(
"phase0_porepressure")),
44 _p0var(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
45 ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
48 _phase1_porepressure(_nodal_material
49 ? this->template coupledGenericDofValue<is_ad>(
"phase1_porepressure")
50 : this->template coupledGenericValue<is_ad>(
"phase1_porepressure")),
51 _phase1_gradp_qp(this->template coupledGenericGradient<is_ad>(
"phase1_porepressure")),
52 _phase1_porepressure_varnum(coupled(
"phase1_porepressure")),
53 _p1var(_dictator.isPorousFlowVariable(_phase1_porepressure_varnum)
54 ? _dictator.porousFlowVariableNum(_phase1_porepressure_varnum)
59 mooseError(
"The Dictator announces that the number of phases is ",
60 _dictator.numPhases(),
61 " whereas PorousFlow2PhasePP can only be used for 2-phase simulation. When you " 62 "have an efficient government, you have a dictatorship.");
80 const auto pc = buildQpPPSS();
81 const auto ds = _pc_uo.dSaturation(pc);
85 (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
86 (*_gradp_qp)[_qp][1] = _phase1_gradp_qp[_qp];
87 (*_grads_qp)[_qp][0] = ds * ((*_gradp_qp)[_qp][0] - (*_gradp_qp)[_qp][1]);
88 (*_grads_qp)[_qp][1] = -(*_grads_qp)[_qp][0];
95 if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
97 (*_dporepressure_dvar)[_qp][0][_p0var] = 1.0;
99 (*_dgradp_qp_dgradv)[_qp][0][_p0var] = 1.0;
102 if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
104 (*_dporepressure_dvar)[_qp][1][_p1var] = 1.0;
105 if (!_nodal_material)
106 (*_dgradp_qp_dgradv)[_qp][1][_p1var] = 1.0;
109 if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
111 (*_dsaturation_dvar)[_qp][0][_p0var] = ds;
112 (*_dsaturation_dvar)[_qp][1][_p0var] = -ds;
115 if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
117 (*_dsaturation_dvar)[_qp][0][_p1var] = -ds;
118 (*_dsaturation_dvar)[_qp][1][_p1var] = ds;
121 if (!_nodal_material)
123 const auto d2s_qp = _pc_uo.d2Saturation(pc);
125 if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
127 (*_dgrads_qp_dgradv)[_qp][0][_p0var] = ds;
128 (*_dgrads_qp_dv)[_qp][0][_p0var] = d2s_qp * _phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp];
129 (*_dgrads_qp_dgradv)[_qp][1][_p0var] = -ds;
130 (*_dgrads_qp_dv)[_qp][1][_p0var] = -d2s_qp * _phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp];
133 if (_dictator.isPorousFlowVariable(_phase1_porepressure_varnum))
135 (*_dgrads_qp_dgradv)[_qp][0][_p1var] = -ds;
136 (*_dgrads_qp_dv)[_qp][0][_p1var] = -d2s_qp * _phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp];
137 (*_dgrads_qp_dgradv)[_qp][1][_p1var] = ds;
138 (*_dgrads_qp_dv)[_qp][1][_p1var] = d2s_qp * _phase0_gradp_qp[_qp] - _phase1_gradp_qp[_qp];
144 template <
bool is_ad>
148 _porepressure[_qp][0] = _phase0_porepressure[_qp];
149 _porepressure[_qp][1] = _phase1_porepressure[_qp];
151 const auto pc = _phase0_porepressure[_qp] - _phase1_porepressure[_qp];
152 const auto sat = _pc_uo.saturation(pc);
153 _saturation[_qp][0] = sat;
154 _saturation[_qp][1] = 1.0 - sat;
virtual void computeQpProperties() override
virtual void initQpStatefulProperties() override
Moose::GenericType< Real, is_ad > GenericReal
void mooseError(Args &&... args)
static InputParameters validParams()
Base class for capillary pressure for multiphase flow in porous media.
static InputParameters validParams()
GenericReal< is_ad > buildQpPPSS()
Assemble std::vectors of porepressure and saturation at the nodes and quadpoints, and return the capi...
Base class for thermophysical variable materials, which assemble materials for primary variables such...
registerMooseObject("PorousFlowApp", PorousFlow2PhasePP)
virtual void initQpStatefulProperties() override
const unsigned int _num_phases
Number of phases.
Material designed to calculate fluid phase porepressure and saturation for the two-phase situation as...
PorousFlow2PhasePPTempl(const InputParameters ¶meters)
virtual void computeQpProperties() override