www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowHeatEnergy Class Reference

Postprocessor produces the sum of heat energy of the porous skeleton and/or fluid components in a region. More...

#include <PorousFlowHeatEnergy.h>

Inheritance diagram for PorousFlowHeatEnergy:
[legend]

Public Member Functions

 PorousFlowHeatEnergy (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeIntegral () override
 
virtual Real computeQpIntegral () override
 

Protected Attributes

const PorousFlowDictator_dictator
 PorousFlowDictator UserObject. More...
 
const unsigned int _num_phases
 Number of fluid phases. More...
 
const bool _fluid_present
 Whether fluid is present. More...
 
const bool _include_porous_skeleton
 Whether to include the heat energy of the porous skeleton in the calculations. More...
 
std::vector< unsigned int > _phase_index
 The phase indices that this Postprocessor is restricted to. More...
 
const MaterialProperty< Real > & _porosity
 Porosity. More...
 
const MaterialProperty< Real > & _rock_energy_nodal
 Nodal rock energy density. More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_density
 Nodal fluid density. More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
 Nodal fluid saturation. More...
 
const MaterialProperty< std::vector< Real > > *const _energy_nodal
 Internal energy of the phases, evaluated at the nodes. More...
 
MooseVariable *const _var
 The variable for the corresponding PorousFlowEnergyTimeDerivative Kernel: this provides test functions. More...
 

Detailed Description

Postprocessor produces the sum of heat energy of the porous skeleton and/or fluid components in a region.

Definition at line 24 of file PorousFlowHeatEnergy.h.

Constructor & Destructor Documentation

◆ PorousFlowHeatEnergy()

PorousFlowHeatEnergy::PorousFlowHeatEnergy ( const InputParameters &  parameters)

Definition at line 43 of file PorousFlowHeatEnergy.C.

44  : ElementIntegralPostprocessor(parameters),
45  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
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")
54  : nullptr),
56  _fluid_present ? &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
57  : nullptr),
58  _energy_nodal(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
59  "PorousFlow_fluid_phase_internal_energy_nodal")
60  : nullptr),
61  _var(getParam<unsigned>("kernel_variable_number") < _dictator.numVariables()
62  ? &_fe_problem.getStandardVariable(
63  _tid,
64  _dictator
65  .getCoupledStandardMooseVars()[getParam<unsigned>("kernel_variable_number")]
66  ->name())
67  : nullptr)
68 {
69  if (!_phase_index.empty())
70  {
71  // Check that the phase indices entered are not greater than the number of phases
72  const unsigned int max_phase_num = *std::max_element(_phase_index.begin(), _phase_index.end());
73  if (max_phase_num > _num_phases - 1)
74  paramError("phase",
75  "The Dictator proclaims that the phase index ",
76  max_phase_num,
77  " is greater than the largest phase index possible, which is ",
78  _num_phases - 1);
79  }
80 
81  // Check that kernel_variable_number is OK
82  if (getParam<unsigned>("kernel_variable_number") >= _dictator.numVariables())
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");
89 
90  // Now that we know kernel_variable_number is OK, _var must be OK,
91  // so ensure that reinit is called on _var:
92  addMooseVariableDependency(_var);
93 }

Member Function Documentation

◆ computeIntegral()

Real PorousFlowHeatEnergy::computeIntegral ( )
overrideprotectedvirtual

Definition at line 96 of file PorousFlowHeatEnergy.C.

97 {
98  Real sum = 0;
99 
100  // The use of _test in the loops below mean that the
101  // integral is exactly the same as the one computed
102  // by the PorousFlowMassTimeDerivative Kernel. Because that
103  // Kernel is lumped, this Postprocessor also needs to
104  // be lumped. Hence the use of the "nodal" Material
105  // Properties
106  const VariableTestValue & test = _var->phi();
107 
108  for (unsigned node = 0; node < test.size(); ++node)
109  {
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];
113 
114  Real energy = 0.0;
116  energy += (1.0 - _porosity[node]) * _rock_energy_nodal[node];
117 
118  for (auto ph : _phase_index)
119  energy += (*_fluid_density)[node][ph] * (*_fluid_saturation_nodal)[node][ph] *
120  (*_energy_nodal)[node][ph] * _porosity[node];
121 
122  sum += nodal_volume * energy;
123  }
124 
125  return sum;
126 }

◆ computeQpIntegral()

Real PorousFlowHeatEnergy::computeQpIntegral ( )
overrideprotectedvirtual

Definition at line 129 of file PorousFlowHeatEnergy.C.

130 {
131  return 0.0;
132 }

Member Data Documentation

◆ _dictator

const PorousFlowDictator& PorousFlowHeatEnergy::_dictator
protected

PorousFlowDictator UserObject.

Definition at line 34 of file PorousFlowHeatEnergy.h.

Referenced by PorousFlowHeatEnergy().

◆ _energy_nodal

const MaterialProperty<std::vector<Real> >* const PorousFlowHeatEnergy::_energy_nodal
protected

Internal energy of the phases, evaluated at the nodes.

Definition at line 61 of file PorousFlowHeatEnergy.h.

◆ _fluid_density

const MaterialProperty<std::vector<Real> >* const PorousFlowHeatEnergy::_fluid_density
protected

Nodal fluid density.

Definition at line 55 of file PorousFlowHeatEnergy.h.

◆ _fluid_present

const bool PorousFlowHeatEnergy::_fluid_present
protected

Whether fluid is present.

Definition at line 40 of file PorousFlowHeatEnergy.h.

◆ _fluid_saturation_nodal

const MaterialProperty<std::vector<Real> >* const PorousFlowHeatEnergy::_fluid_saturation_nodal
protected

Nodal fluid saturation.

Definition at line 58 of file PorousFlowHeatEnergy.h.

◆ _include_porous_skeleton

const bool PorousFlowHeatEnergy::_include_porous_skeleton
protected

Whether to include the heat energy of the porous skeleton in the calculations.

Definition at line 43 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

◆ _num_phases

const unsigned int PorousFlowHeatEnergy::_num_phases
protected

Number of fluid phases.

Definition at line 37 of file PorousFlowHeatEnergy.h.

Referenced by PorousFlowHeatEnergy().

◆ _phase_index

std::vector<unsigned int> PorousFlowHeatEnergy::_phase_index
protected

The phase indices that this Postprocessor is restricted to.

Definition at line 46 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral(), and PorousFlowHeatEnergy().

◆ _porosity

const MaterialProperty<Real>& PorousFlowHeatEnergy::_porosity
protected

Porosity.

Definition at line 49 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

◆ _rock_energy_nodal

const MaterialProperty<Real>& PorousFlowHeatEnergy::_rock_energy_nodal
protected

Nodal rock energy density.

Definition at line 52 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

◆ _var

MooseVariable* const PorousFlowHeatEnergy::_var
protected

The variable for the corresponding PorousFlowEnergyTimeDerivative Kernel: this provides test functions.

Definition at line 64 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral(), and PorousFlowHeatEnergy().


The documentation for this class was generated from the following files:
PorousFlowHeatEnergy::_var
MooseVariable *const _var
The variable for the corresponding PorousFlowEnergyTimeDerivative Kernel: this provides test function...
Definition: PorousFlowHeatEnergy.h:64
PorousFlowHeatEnergy::_phase_index
std::vector< unsigned int > _phase_index
The phase indices that this Postprocessor is restricted to.
Definition: PorousFlowHeatEnergy.h:46
PorousFlowHeatEnergy::_energy_nodal
const MaterialProperty< std::vector< Real > > *const _energy_nodal
Internal energy of the phases, evaluated at the nodes.
Definition: PorousFlowHeatEnergy.h:61
PorousFlowHeatEnergy::_dictator
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
Definition: PorousFlowHeatEnergy.h:34
PorousFlowHeatEnergy::_num_phases
const unsigned int _num_phases
Number of fluid phases.
Definition: PorousFlowHeatEnergy.h:37
PorousFlowHeatEnergy::_include_porous_skeleton
const bool _include_porous_skeleton
Whether to include the heat energy of the porous skeleton in the calculations.
Definition: PorousFlowHeatEnergy.h:43
PorousFlowHeatEnergy::_porosity
const MaterialProperty< Real > & _porosity
Porosity.
Definition: PorousFlowHeatEnergy.h:49
PorousFlowDictator::numPhases
unsigned int numPhases() const
The number of fluid phases.
Definition: PorousFlowDictator.C:105
PorousFlowHeatEnergy::_fluid_present
const bool _fluid_present
Whether fluid is present.
Definition: PorousFlowHeatEnergy.h:40
PorousFlowDictator::numVariables
unsigned int numVariables() const
The number of PorousFlow variables.
Definition: PorousFlowDictator.C:99
PorousFlowHeatEnergy::_fluid_density
const MaterialProperty< std::vector< Real > > *const _fluid_density
Nodal fluid density.
Definition: PorousFlowHeatEnergy.h:55
name
const std::string name
Definition: Setup.h:21
PorousFlowHeatEnergy::_rock_energy_nodal
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
Definition: PorousFlowHeatEnergy.h:52
PorousFlowHeatEnergy::_fluid_saturation_nodal
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
Nodal fluid saturation.
Definition: PorousFlowHeatEnergy.h:58