14 #include "libmesh/quadrature.h" 27 "The index corresponding to the fluid component that this Postprocessor acts on");
29 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
30 params.
addParam<std::vector<unsigned int>>(
"phase",
32 "The index of the fluid phase that this " 33 "Postprocessor is restricted to. Multiple " 34 "indices can be entered");
37 "saturation_threshold >= 0 & saturation_threshold <= 1",
38 "The saturation threshold below which the mass is calculated " 39 "for a specific phase. Default is 1.0. Note: only one " 40 "phase_index can be entered");
41 params.
addParam<
unsigned int>(
"kernel_variable_number",
43 "The PorousFlow variable number (according to the dictator) of " 44 "the fluid-mass kernel. This is required only in the unusual " 45 "situation where a variety of different finite-element " 46 "interpolation schemes are employed in the simulation");
49 "For non-mechanically-coupled systems with no TensorMechanics strain calculators, base_name " 50 "need not be set. For mechanically-coupled systems, base_name should be the same base_name " 51 "as given to the TensorMechanics object that computes strain, so that this Postprocessor can " 52 "correctly account for changes in mesh volume. For non-mechanically-coupled systems, " 53 "base_name should not be the base_name of any TensorMechanics strain calculators.");
54 params.
set<
bool>(
"use_displaced_mesh") =
false;
65 _fluid_component(getParam<unsigned
int>(
"fluid_component")),
66 _phase_index(getParam<
std::vector<unsigned
int>>(
"phase")),
67 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
68 _has_total_strain(hasMaterialProperty<
RankTwoTensor>(_base_name +
"total_strain")),
69 _total_strain(_has_total_strain
70 ? &getMaterialProperty<
RankTwoTensor>(_base_name +
"total_strain")
72 _porosity(getGenericMaterialProperty<
Real, is_ad>(
"PorousFlow_porosity_nodal")),
73 _fluid_density(getGenericMaterialProperty<
std::vector<
Real>, is_ad>(
74 "PorousFlow_fluid_phase_density_nodal")),
76 getGenericMaterialProperty<
std::vector<
Real>, is_ad>(
"PorousFlow_saturation_nodal")),
77 _mass_fraction(getGenericMaterialProperty<
std::vector<
std::vector<
Real>>, is_ad>(
78 "PorousFlow_mass_frac_nodal")),
79 _saturation_threshold(getParam<
Real>(
"saturation_threshold")),
80 _var(getParam<unsigned>(
"kernel_variable_number") < _dictator.numVariables()
81 ? &_fe_problem.getStandardVariable(
84 .getCoupledStandardMooseVars()[getParam<unsigned>(
"kernel_variable_number")]
95 "The Dictator proclaims that the number of components in this simulation is ",
97 " whereas you have used a component index of ",
99 ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
104 "The Dictator decrees that the number of phases in this simulation is ",
106 " but you have entered ",
113 "The Dictator pronounces that the number of PorousFlow variables is ",
115 ", however you have used ",
116 getParam<unsigned>(
"kernel_variable_number"),
117 ". This is an error");
129 if (max_phase_num > num_phases - 1)
131 "The Dictator proclaims that the phase index ",
133 " is greater than the largest phase index possible, which is ",
140 "A single phase_index must be entered when prescribing a saturation_threshold");
144 for (
unsigned int i = 0; i < num_phases; ++i)
148 template <
bool is_ad>
162 for (
unsigned node = 0; node < test.size(); ++node)
164 Real nodal_volume = 0.0;
165 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
167 const Real n_v = _JxW[_qp] * _coord[_qp] * test[node][_qp];
168 if (_has_total_strain)
169 nodal_volume += n_v * (1.0 + (*_total_strain)[_qp].trace());
175 for (
auto ph : _phase_index)
179 _mass_fraction[node][ph][_fluid_component]);
187 template <
bool is_ad>
virtual Real computeIntegral() override
virtual Real computeQpIntegral() override
const unsigned int _fluid_component
The fluid component index that this Postprocessor applies to.
Postprocessor produces the mass of a given fluid component in a region.
unsigned int numComponents() const
The number of fluid components.
MooseVariable *const _var
The variable for the corresponding PorousFlowMassTimeDerivative Kernel: this provides test functions...
PorousFlowFluidMassTempl(const InputParameters ¶meters)
registerMooseObject("PorousFlowApp", PorousFlowFluidMass)
static InputParameters validParams()
std::vector< unsigned int > _phase_index
The phase indices that this Postprocessor is restricted to.
OutputTools< Real >::VariableTestValue VariableTestValue
void paramError(const std::string ¶m, Args... args) const
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int numPhases() const
The number of fluid phases.
unsigned int numVariables() const
The number of PorousFlow variables.
const Real _saturation_threshold
Saturation threshold - only fluid mass at saturations below this are calculated.
void addMooseVariableDependency(MooseVariableFieldBase *var)
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...
static InputParameters validParams()
void ErrorVector unsigned int