12 #include "MooseVariable.h"
14 #include "libmesh/quadrature.h"
22 InputParameters params = validParams<ElementIntegralPostprocessor>();
23 params.addParam<
unsigned int>(
26 "The index corresponding to the fluid component that this Postprocessor acts on");
27 params.addRequiredParam<UserObjectName>(
28 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
29 params.addParam<std::vector<unsigned int>>(
"phase",
30 "The index of the fluid phase that this "
31 "Postprocessor is restricted to. Multiple "
32 "indices can be entered");
33 params.addRangeCheckedParam<Real>(
"saturation_threshold",
35 "saturation_threshold >= 0 & saturation_threshold <= 1",
36 "The saturation threshold below which the mass is calculated "
37 "for a specific phase. Default is 1.0. Note: only one "
38 "phase_index can be entered");
39 params.addParam<
unsigned int>(
"kernel_variable_number",
41 "The PorousFlow variable number (according to the dictator) of "
42 "the fluid-mass kernel. This is required only in the unusual "
43 "situation where a variety of different finite-element "
44 "interpolation schemes are employed in the simulation");
45 params.set<
bool>(
"use_displaced_mesh") =
true;
46 params.addClassDescription(
"Calculates the mass of a fluid component in a region");
51 : ElementIntegralPostprocessor(parameters),
54 _fluid_component(getParam<unsigned int>(
"fluid_component")),
55 _phase_index(getParam<std::vector<unsigned int>>(
"phase")),
56 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
57 _fluid_density(getMaterialProperty<std::vector<Real>>(
"PorousFlow_fluid_phase_density_nodal")),
58 _fluid_saturation(getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")),
60 getMaterialProperty<std::vector<std::vector<Real>>>(
"PorousFlow_mass_frac_nodal")),
61 _saturation_threshold(getParam<Real>(
"saturation_threshold")),
62 _var(getParam<unsigned>(
"kernel_variable_number") < _dictator.numVariables()
63 ? &_fe_problem.getStandardVariable(
66 .getCoupledStandardMooseVars()[getParam<unsigned>(
"kernel_variable_number")]
77 "The Dictator proclaims that the number of components in this simulation is ",
79 " whereas you have used a component index of ",
81 ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
86 "The Dictator decrees that the number of phases in this simulation is ",
88 " but you have entered ",
94 paramError(
"kernel_variable_number",
95 "The Dictator pronounces that the number of PorousFlow variables is ",
97 ", however you have used ",
98 getParam<unsigned>(
"kernel_variable_number"),
99 ". This is an error");
103 addMooseVariableDependency(
_var);
111 if (max_phase_num > num_phases - 1)
113 "The Dictator proclaims that the phase index ",
115 " is greater than the largest phase index possible, which is ",
121 paramError(
"saturation_threshold",
122 "A single phase_index must be entered when prescribing a saturation_threshold");
126 for (
unsigned int i = 0; i < num_phases; ++i)
141 const VariableTestValue & test =
_var->phi();
143 for (
unsigned node = 0; node < test.size(); ++node)
145 Real nodal_volume = 0.0;
146 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
147 nodal_volume += _JxW[_qp] * _coord[_qp] * test[node][_qp];
156 sum += nodal_volume *
_porosity[node] * mass;