12 #include "MooseVariable.h"
14 #include "libmesh/quadrature.h"
22 InputParameters params = validParams<ElementIntegralPostprocessor>();
23 params.addRequiredParam<UserObjectName>(
24 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
25 params.addParam<
bool>(
26 "include_porous_skeleton",
true,
"Include the heat energy of the porous skeleton");
27 params.addParam<std::vector<unsigned int>>(
"phase",
28 "The index(es) of the fluid phase that this "
29 "Postprocessor is restricted to. Multiple "
30 "indices can be entered.");
31 params.set<
bool>(
"use_displaced_mesh") =
true;
32 params.addParam<
unsigned int>(
"kernel_variable_number",
34 "The PorousFlow variable number (according to the dictatory) of "
35 "the heat-energy kernel. This is required only in the unusual "
36 "situation where a variety of different finite-element "
37 "interpolation schemes are employed in the simulation");
38 params.addClassDescription(
"Calculates the sum of heat energy of fluid phase(s) and/or the "
39 "porous skeleton in a region");
44 : ElementIntegralPostprocessor(parameters),
46 _num_phases(_dictator.numPhases()),
47 _fluid_present(_num_phases > 0),
48 _include_porous_skeleton(getParam<bool>(
"include_porous_skeleton")),
49 _phase_index(getParam<std::vector<unsigned int>>(
"phase")),
50 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
51 _rock_energy_nodal(getMaterialProperty<Real>(
"PorousFlow_matrix_internal_energy_nodal")),
52 _fluid_density(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
53 "PorousFlow_fluid_phase_density_nodal")
55 _fluid_saturation_nodal(
56 _fluid_present ? &getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")
58 _energy_nodal(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
59 "PorousFlow_fluid_phase_internal_energy_nodal")
61 _var(getParam<unsigned>(
"kernel_variable_number") < _dictator.numVariables()
62 ? &_fe_problem.getStandardVariable(
65 .getCoupledStandardMooseVars()[getParam<unsigned>(
"kernel_variable_number")]
75 "The Dictator proclaims that the phase index ",
77 " is greater than the largest phase index possible, which is ",
83 paramError(
"kernel_variable_number",
84 "The Dictator pronounces that the number of PorousFlow variables is ",
86 ", however you have used ",
87 getParam<unsigned>(
"kernel_variable_number"),
88 ". This is an error");
92 addMooseVariableDependency(
_var);
106 const VariableTestValue & test =
_var->phi();
108 for (
unsigned node = 0; node < test.size(); ++node)
110 Real nodal_volume = 0.0;
111 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
112 nodal_volume += _JxW[_qp] * _coord[_qp] * test[node][_qp];
119 energy += (*_fluid_density)[node][ph] * (*_fluid_saturation_nodal)[node][ph] *
120 (*_energy_nodal)[node][ph] *
_porosity[node];
122 sum += nodal_volume * energy;