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 25 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  ? _dictator.getCoupledStandardMooseVars()[getParam<unsigned>("kernel_variable_number")]
63  : nullptr)
64 {
65  if (!_phase_index.empty())
66  {
67  // Check that the phase indices entered are not greater than the number of phases
68  const unsigned int max_phase_num = *std::max_element(_phase_index.begin(), _phase_index.end());
69  if (max_phase_num > _num_phases - 1)
70  paramError("phase",
71  "The Dictator proclaims that the phase index ",
72  max_phase_num,
73  " is greater than the largest phase index possible, which is ",
74  _num_phases - 1);
75  }
76 
77  // Check that kernel_variable_number is OK
78  if (getParam<unsigned>("kernel_variable_number") >= _dictator.numVariables())
79  paramError("kernel_variable_number",
80  "The Dictator pronounces that the number of PorousFlow variables is ",
82  ", however you have used ",
83  getParam<unsigned>("kernel_variable_number"),
84  ". This is an error");
85 }
const MaterialProperty< std::vector< Real > > *const _fluid_density
Nodal fluid density.
const bool _fluid_present
Whether fluid is present.
const MaterialProperty< Real > & _porosity
Porosity.
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const unsigned int _num_phases
Number of fluid phases.
unsigned int numPhases() const
The number of fluid phases.
unsigned int numVariables() const
The number of PorousFlow variables.
MooseVariable *const _var
The variable for the corresponding PorousFlowEnergyTimeDerivative Kernel: this provides test function...
const MaterialProperty< std::vector< Real > > *const _energy_nodal
Internal energy of the phases, evaluated at the nodes.
std::vector< unsigned int > _phase_index
The phase indices that this Postprocessor is restricted to.
const bool _include_porous_skeleton
Whether to include the heat energy of the porous skeleton in the calculations.
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
Nodal fluid saturation.

Member Function Documentation

◆ computeIntegral()

Real PorousFlowHeatEnergy::computeIntegral ( )
overrideprotectedvirtual

Definition at line 88 of file PorousFlowHeatEnergy.C.

89 {
90  Real sum = 0;
91 
92  // The use of _test in the loops below mean that the
93  // integral is exactly the same as the one computed
94  // by the PorousFlowMassTimeDerivative Kernel. Because that
95  // Kernel is lumped, this Postprocessor also needs to
96  // be lumped. Hence the use of the "nodal" Material
97  // Properties
98  const VariableTestValue & test = _var->phi();
99 
100  for (unsigned node = 0; node < test.size(); ++node)
101  {
102  Real nodal_volume = 0.0;
103  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
104  nodal_volume += _JxW[_qp] * _coord[_qp] * test[node][_qp];
105 
106  Real energy = 0.0;
108  energy += (1.0 - _porosity[node]) * _rock_energy_nodal[node];
109 
110  for (auto ph : _phase_index)
111  energy += (*_fluid_density)[node][ph] * (*_fluid_saturation_nodal)[node][ph] *
112  (*_energy_nodal)[node][ph] * _porosity[node];
113 
114  sum += nodal_volume * energy;
115  }
116 
117  return sum;
118 }
const MaterialProperty< Real > & _porosity
Porosity.
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
MooseVariable *const _var
The variable for the corresponding PorousFlowEnergyTimeDerivative Kernel: this provides test function...
std::vector< unsigned int > _phase_index
The phase indices that this Postprocessor is restricted to.
const bool _include_porous_skeleton
Whether to include the heat energy of the porous skeleton in the calculations.

◆ computeQpIntegral()

Real PorousFlowHeatEnergy::computeQpIntegral ( )
overrideprotectedvirtual

Definition at line 121 of file PorousFlowHeatEnergy.C.

122 {
123  return 0.0;
124 }

Member Data Documentation

◆ _dictator

const PorousFlowDictator& PorousFlowHeatEnergy::_dictator
protected

PorousFlowDictator UserObject.

Definition at line 35 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 62 of file PorousFlowHeatEnergy.h.

◆ _fluid_density

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

Nodal fluid density.

Definition at line 56 of file PorousFlowHeatEnergy.h.

◆ _fluid_present

const bool PorousFlowHeatEnergy::_fluid_present
protected

Whether fluid is present.

Definition at line 41 of file PorousFlowHeatEnergy.h.

◆ _fluid_saturation_nodal

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

Nodal fluid saturation.

Definition at line 59 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 44 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

◆ _num_phases

const unsigned int PorousFlowHeatEnergy::_num_phases
protected

Number of fluid phases.

Definition at line 38 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 47 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral(), and PorousFlowHeatEnergy().

◆ _porosity

const MaterialProperty<Real>& PorousFlowHeatEnergy::_porosity
protected

Porosity.

Definition at line 50 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 53 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 65 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().


The documentation for this class was generated from the following files: