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
 Holds info on the PorousFlow variables. 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 ( const InputParameters &  parameters)

Check that the phase indices entered are not greater than the number of phases

Check that kernel_variable_number is OK

Definition at line 40 of file PorousFlowHeatEnergy.C.

41  : ElementIntegralPostprocessor(parameters),
42  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
45  _include_porous_skeleton(getParam<bool>("include_porous_skeleton")),
46  _phase_index(getParam<std::vector<unsigned int>>("phase")),
47  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
48  _rock_energy_nodal(getMaterialProperty<Real>("PorousFlow_matrix_internal_energy_nodal")),
51  ? &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")
52  : nullptr),
54  _fluid_present ? &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
55  : nullptr),
57  ? &getMaterialProperty<std::vector<Real>>(
58  "PorousFlow_fluid_phase_internal_energy_nodal")
59  : nullptr),
60  _var(getParam<unsigned>("kernel_variable_number") < _dictator.numVariables()
61  ? _dictator.getCoupledMooseVars()[getParam<unsigned>("kernel_variable_number")]
62  : nullptr)
63 {
64  if (!_phase_index.empty())
65  {
67  const unsigned int max_phase_num = *std::max_element(_phase_index.begin(), _phase_index.end());
68  if (max_phase_num > _num_phases - 1)
69  mooseError("The Dictator proclaims that the phase index ",
70  max_phase_num,
71  " in the Postprocessor ",
72  _name,
73  " is greater than the largest phase index possible, which is ",
74  _num_phases - 1);
75  }
76 
78  if (getParam<unsigned>("kernel_variable_number") >= _dictator.numVariables())
79  mooseError("PorousFlowHeatEnergy: The dictator pronounces that the number of porous-flow "
80  "variables is ",
82  ", however you have used kernel_variable_number = ",
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
Holds info on the PorousFlow variables.
const unsigned int _num_phases
Number of fluid phases.
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.
unsigned int numPhases() const
the number of fluid phases
const bool _include_porous_skeleton
Whether to include the heat energy of the porous skeleton in the calculations.
unsigned int numVariables() const
The number of PorousFlow variables.
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
nodal fluid saturation

Member Function Documentation

Real PorousFlowHeatEnergy::computeIntegral ( )
overrideprotectedvirtual

The use of _test in the loops below mean that the integral is exactly the same as the one computed by the PorousFlowMassTimeDerivative Kernel. Because that Kernel is lumped, this Postprocessor also needs to be lumped. Hence the use of the "nodal" Material Properties

Definition at line 88 of file PorousFlowHeatEnergy.C.

89 {
90  Real sum = 0;
91 
99  const VariableTestValue & test = _var->phi();
100 
101  for (unsigned node = 0; node < test.size(); ++node)
102  {
103  Real nodal_volume = 0.0;
104  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
105  nodal_volume += _JxW[_qp] * _coord[_qp] * test[node][_qp];
106 
107  Real energy = 0.0;
109  energy += (1.0 - _porosity[node]) * _rock_energy_nodal[node];
110 
111  for (auto ph : _phase_index)
112  energy += (*_fluid_density)[node][ph] * (*_fluid_saturation_nodal)[node][ph] *
113  (*_energy_nodal)[node][ph] * _porosity[node];
114 
115  sum += nodal_volume * energy;
116  }
117 
118  return sum;
119 }
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.
Real PorousFlowHeatEnergy::computeQpIntegral ( )
overrideprotectedvirtual

Definition at line 122 of file PorousFlowHeatEnergy.C.

123 {
124  return 0.0;
125 }

Member Data Documentation

const PorousFlowDictator& PorousFlowHeatEnergy::_dictator
protected

Holds info on the PorousFlow variables.

Definition at line 34 of file PorousFlowHeatEnergy.h.

Referenced by PorousFlowHeatEnergy().

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.

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

nodal fluid density

Definition at line 55 of file PorousFlowHeatEnergy.h.

const bool PorousFlowHeatEnergy::_fluid_present
protected

Whether fluid is present.

Definition at line 40 of file PorousFlowHeatEnergy.h.

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

nodal fluid saturation

Definition at line 58 of file PorousFlowHeatEnergy.h.

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().

const unsigned int PorousFlowHeatEnergy::_num_phases
protected

Number of fluid phases.

Definition at line 37 of file PorousFlowHeatEnergy.h.

Referenced by PorousFlowHeatEnergy().

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().

const MaterialProperty<Real>& PorousFlowHeatEnergy::_porosity
protected

Porosity.

Definition at line 49 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

const MaterialProperty<Real>& PorousFlowHeatEnergy::_rock_energy_nodal
protected

nodal rock energy density

Definition at line 52 of file PorousFlowHeatEnergy.h.

Referenced by computeIntegral().

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().


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