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

Kernel = (heat_energy - heat_energy_old)/dt It is lumped to the nodes. More...

#include <PorousFlowEnergyTimeDerivative.h>

Inheritance diagram for PorousFlowEnergyTimeDerivative:
[legend]

Public Member Functions

 PorousFlowEnergyTimeDerivative (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar) override
 
Real computeQpJac (unsigned int pvar) const
 Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQpJacobian and computeQpOffDiagJacobian. More...
 

Protected Attributes

const PorousFlowDictator_dictator
 PorousFlowDictator UserObject. More...
 
const bool _var_is_porflow_var
 Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator. More...
 
const unsigned int _num_phases
 Number of fluid phases. More...
 
const bool _fluid_present
 Whether _num_phases > 0 (ie. there is a fluid present) More...
 
const bool _strain_at_nearest_qp
 Whether the porosity uses the volumetric strain at the closest quadpoint. More...
 
const MaterialProperty< Real > & _porosity
 Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps. More...
 
const MaterialProperty< Real > & _porosity_old
 Old value of porosity. More...
 
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
 d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps More...
 
const MaterialProperty< unsigned int > *const _nearest_qp
 The nearest qp to the node. More...
 
const MaterialProperty< Real > & _rock_energy_nodal
 Nodal rock energy density. More...
 
const MaterialProperty< Real > & _rock_energy_nodal_old
 Old value of nodal rock energy density. More...
 
const MaterialProperty< std::vector< Real > > & _drock_energy_nodal_dvar
 d(nodal rock energy density)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_density
 Nodal fluid density. More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_density_old
 Old value of nodal fluid density. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _dfluid_density_dvar
 d(nodal fluid density)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
 Nodal fluid saturation. More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal_old
 Old value of fluid saturation. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _dfluid_saturation_nodal_dvar
 d(nodal fluid saturation)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< Real > > *const _energy_nodal
 Internal energy of the phases, evaluated at the nodes. More...
 
const MaterialProperty< std::vector< Real > > *const _energy_nodal_old
 Old value of internal energy of the phases, evaluated at the nodes. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _denergy_nodal_dvar
 d(internal energy)/d(PorousFlow variable) More...
 

Detailed Description

Kernel = (heat_energy - heat_energy_old)/dt It is lumped to the nodes.

Definition at line 25 of file PorousFlowEnergyTimeDerivative.h.

Constructor & Destructor Documentation

◆ PorousFlowEnergyTimeDerivative()

PorousFlowEnergyTimeDerivative::PorousFlowEnergyTimeDerivative ( const InputParameters &  parameters)

Definition at line 34 of file PorousFlowEnergyTimeDerivative.C.

35  : TimeKernel(parameters),
36  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
40  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
41  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
42  _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")),
43  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
45  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar")),
47  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
48  : nullptr),
49  _rock_energy_nodal(getMaterialProperty<Real>("PorousFlow_matrix_internal_energy_nodal")),
50  _rock_energy_nodal_old(getMaterialPropertyOld<Real>("PorousFlow_matrix_internal_energy_nodal")),
52  getMaterialProperty<std::vector<Real>>("dPorousFlow_matrix_internal_energy_nodal_dvar")),
53  _fluid_density(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
54  "PorousFlow_fluid_phase_density_nodal")
55  : nullptr),
56  _fluid_density_old(_fluid_present ? &getMaterialPropertyOld<std::vector<Real>>(
57  "PorousFlow_fluid_phase_density_nodal")
58  : nullptr),
59  _dfluid_density_dvar(_fluid_present ? &getMaterialProperty<std::vector<std::vector<Real>>>(
60  "dPorousFlow_fluid_phase_density_nodal_dvar")
61  : nullptr),
63  _fluid_present ? &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
64  : nullptr),
66  _fluid_present ? &getMaterialPropertyOld<std::vector<Real>>("PorousFlow_saturation_nodal")
67  : nullptr),
69  ? &getMaterialProperty<std::vector<std::vector<Real>>>(
70  "dPorousFlow_saturation_nodal_dvar")
71  : nullptr),
72  _energy_nodal(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
73  "PorousFlow_fluid_phase_internal_energy_nodal")
74  : nullptr),
75  _energy_nodal_old(_fluid_present ? &getMaterialPropertyOld<std::vector<Real>>(
76  "PorousFlow_fluid_phase_internal_energy_nodal")
77  : nullptr),
78  _denergy_nodal_dvar(_fluid_present ? &getMaterialProperty<std::vector<std::vector<Real>>>(
79  "dPorousFlow_fluid_phase_internal_energy_nodal_dvar")
80  : nullptr)
81 {
82 }
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal_old
Old value of fluid saturation.
const MaterialProperty< std::vector< Real > > *const _fluid_density
Nodal fluid density.
const MaterialProperty< std::vector< Real > > & _drock_energy_nodal_dvar
d(nodal rock energy density)/d(PorousFlow variable)
bool isPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is a porous flow variable.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const MaterialProperty< unsigned int > *const _nearest_qp
The nearest qp to the node.
const bool _fluid_present
Whether _num_phases > 0 (ie. there is a fluid present)
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...
const MaterialProperty< std::vector< Real > > *const _fluid_density_old
Old value of nodal fluid density.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps ...
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
const MaterialProperty< std::vector< std::vector< Real > > > *const _dfluid_density_dvar
d(nodal fluid density)/d(PorousFlow variable)
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > *const _denergy_nodal_dvar
d(internal energy)/d(PorousFlow variable)
const MaterialProperty< std::vector< Real > > *const _energy_nodal
Internal energy of the phases, evaluated at the nodes.
const MaterialProperty< std::vector< Real > > *const _fluid_saturation_nodal
Nodal fluid saturation.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
unsigned int numPhases() const
The number of fluid phases.
const MaterialProperty< std::vector< Real > > *const _energy_nodal_old
Old value of internal energy of the phases, evaluated at the nodes.
const MaterialProperty< std::vector< std::vector< Real > > > *const _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(PorousFlow variable)
const MaterialProperty< Real > & _rock_energy_nodal_old
Old value of nodal rock energy density.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes ...
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.

Member Function Documentation

◆ computeQpJac()

Real PorousFlowEnergyTimeDerivative::computeQpJac ( unsigned int  pvar) const
protected

Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQpJacobian and computeQpOffDiagJacobian.

Parameters
pvartake the derivative of the residual wrt this PorousFlow variable

Definition at line 119 of file PorousFlowEnergyTimeDerivative.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

120 {
121  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
122 
123  // porosity is dependent on variables that are lumped to the nodes,
124  // but it can depend on the gradient
125  // of variables, which are NOT lumped to the nodes, hence:
126  Real denergy = -_dporosity_dgradvar[_i][pvar] * _grad_phi[_j][_i] * _rock_energy_nodal[_i];
127  for (unsigned ph = 0; ph < _num_phases; ++ph)
128  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
129  (*_energy_nodal)[_i][ph] * _dporosity_dgradvar[_i][pvar] * _grad_phi[_j][nearest_qp];
130 
131  if (_i != _j)
132  return _test[_i][_qp] * denergy / _dt;
133 
134  // As the fluid energy is lumped to the nodes, only non-zero terms are for _i==_j
135  denergy += -_dporosity_dvar[_i][pvar] * _rock_energy_nodal[_i];
136  denergy += (1.0 - _porosity[_i]) * _drock_energy_nodal_dvar[_i][pvar];
137  for (unsigned ph = 0; ph < _num_phases; ++ph)
138  {
139  denergy += (*_dfluid_density_dvar)[_i][ph][pvar] * (*_fluid_saturation_nodal)[_i][ph] *
140  (*_energy_nodal)[_i][ph] * _porosity[_i];
141  denergy += (*_fluid_density)[_i][ph] * (*_dfluid_saturation_nodal_dvar)[_i][ph][pvar] *
142  (*_energy_nodal)[_i][ph] * _porosity[_i];
143  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
144  (*_denergy_nodal_dvar)[_i][ph][pvar] * _porosity[_i];
145  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
146  (*_energy_nodal)[_i][ph] * _dporosity_dvar[_i][pvar];
147  }
148  return _test[_i][_qp] * denergy / _dt;
149 }
const MaterialProperty< std::vector< Real > > *const _fluid_density
Nodal fluid density.
const MaterialProperty< std::vector< Real > > & _drock_energy_nodal_dvar
d(nodal rock energy density)/d(PorousFlow variable)
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps ...
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes ...
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.

◆ computeQpJacobian()

Real PorousFlowEnergyTimeDerivative::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 101 of file PorousFlowEnergyTimeDerivative.C.

102 {
103  // If the variable is not a PorousFlow variable (very unusual), the diag Jacobian terms are 0
104  if (!_var_is_porflow_var)
105  return 0.0;
106  return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
107 }
Real computeQpJac(unsigned int pvar) const
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.

◆ computeQpOffDiagJacobian()

Real PorousFlowEnergyTimeDerivative::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

Definition at line 110 of file PorousFlowEnergyTimeDerivative.C.

111 {
112  // If the variable is not a PorousFlow variable, the OffDiag Jacobian terms are 0
114  return 0.0;
116 }
Real computeQpJac(unsigned int pvar) const
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.

◆ computeQpResidual()

Real PorousFlowEnergyTimeDerivative::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 85 of file PorousFlowEnergyTimeDerivative.C.

86 {
87  Real energy = (1.0 - _porosity[_i]) * _rock_energy_nodal[_i];
88  Real energy_old = (1.0 - _porosity_old[_i]) * _rock_energy_nodal_old[_i];
89  for (unsigned ph = 0; ph < _num_phases; ++ph)
90  {
91  energy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
92  (*_energy_nodal)[_i][ph] * _porosity[_i];
93  energy_old += (*_fluid_density_old)[_i][ph] * (*_fluid_saturation_nodal_old)[_i][ph] *
94  (*_energy_nodal_old)[_i][ph] * _porosity_old[_i];
95  }
96 
97  return _test[_i][_qp] * (energy - energy_old) / _dt;
98 }
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...
const MaterialProperty< Real > & _rock_energy_nodal
Nodal rock energy density.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< Real > & _rock_energy_nodal_old
Old value of nodal rock energy density.

Member Data Documentation

◆ _denergy_nodal_dvar

const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowEnergyTimeDerivative::_denergy_nodal_dvar
protected

d(internal energy)/d(PorousFlow variable)

Definition at line 99 of file PorousFlowEnergyTimeDerivative.h.

◆ _dfluid_density_dvar

const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowEnergyTimeDerivative::_dfluid_density_dvar
protected

d(nodal fluid density)/d(PorousFlow variable)

Definition at line 81 of file PorousFlowEnergyTimeDerivative.h.

◆ _dfluid_saturation_nodal_dvar

const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowEnergyTimeDerivative::_dfluid_saturation_nodal_dvar
protected

d(nodal fluid saturation)/d(PorousFlow variable)

Definition at line 90 of file PorousFlowEnergyTimeDerivative.h.

◆ _dictator

const PorousFlowDictator& PorousFlowEnergyTimeDerivative::_dictator
protected

PorousFlowDictator UserObject.

Definition at line 36 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

◆ _dporosity_dgradvar

const MaterialProperty<std::vector<RealGradient> >& PorousFlowEnergyTimeDerivative::_dporosity_dgradvar
protected

d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps

Definition at line 60 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

◆ _dporosity_dvar

const MaterialProperty<std::vector<Real> >& PorousFlowEnergyTimeDerivative::_dporosity_dvar
protected

d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes

Definition at line 57 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

◆ _drock_energy_nodal_dvar

const MaterialProperty<std::vector<Real> >& PorousFlowEnergyTimeDerivative::_drock_energy_nodal_dvar
protected

d(nodal rock energy density)/d(PorousFlow variable)

Definition at line 72 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

◆ _energy_nodal

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

Internal energy of the phases, evaluated at the nodes.

Definition at line 93 of file PorousFlowEnergyTimeDerivative.h.

◆ _energy_nodal_old

const MaterialProperty<std::vector<Real> >* const PorousFlowEnergyTimeDerivative::_energy_nodal_old
protected

Old value of internal energy of the phases, evaluated at the nodes.

Definition at line 96 of file PorousFlowEnergyTimeDerivative.h.

◆ _fluid_density

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

Nodal fluid density.

Definition at line 75 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

◆ _fluid_density_old

const MaterialProperty<std::vector<Real> >* const PorousFlowEnergyTimeDerivative::_fluid_density_old
protected

Old value of nodal fluid density.

Definition at line 78 of file PorousFlowEnergyTimeDerivative.h.

◆ _fluid_present

const bool PorousFlowEnergyTimeDerivative::_fluid_present
protected

Whether _num_phases > 0 (ie. there is a fluid present)

Definition at line 45 of file PorousFlowEnergyTimeDerivative.h.

◆ _fluid_saturation_nodal

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

Nodal fluid saturation.

Definition at line 84 of file PorousFlowEnergyTimeDerivative.h.

◆ _fluid_saturation_nodal_old

const MaterialProperty<std::vector<Real> >* const PorousFlowEnergyTimeDerivative::_fluid_saturation_nodal_old
protected

Old value of fluid saturation.

Definition at line 87 of file PorousFlowEnergyTimeDerivative.h.

◆ _nearest_qp

const MaterialProperty<unsigned int>* const PorousFlowEnergyTimeDerivative::_nearest_qp
protected

The nearest qp to the node.

Definition at line 63 of file PorousFlowEnergyTimeDerivative.h.

◆ _num_phases

const unsigned int PorousFlowEnergyTimeDerivative::_num_phases
protected

Number of fluid phases.

Definition at line 42 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _porosity

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_porosity
protected

Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps.

Definition at line 51 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _porosity_old

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_porosity_old
protected

Old value of porosity.

Definition at line 54 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpResidual().

◆ _rock_energy_nodal

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_rock_energy_nodal
protected

Nodal rock energy density.

Definition at line 66 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _rock_energy_nodal_old

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_rock_energy_nodal_old
protected

Old value of nodal rock energy density.

Definition at line 69 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpResidual().

◆ _strain_at_nearest_qp

const bool PorousFlowEnergyTimeDerivative::_strain_at_nearest_qp
protected

Whether the porosity uses the volumetric strain at the closest quadpoint.

Definition at line 48 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

◆ _var_is_porflow_var

const bool PorousFlowEnergyTimeDerivative::_var_is_porflow_var
protected

Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.

Definition at line 39 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJacobian().


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