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
 holds info on the PorousFlow variables More...
 
const bool _var_is_porflow_var
 whether the Variable for this Kernel is a porous-flow variable according to the Dictator More...
 
const unsigned int _num_phases
 number of fluid phases More...
 
const bool _fluid_present
 whether _num_phases > 0 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(porous-flow variable) - these derivatives will be wrt variables at the nodes More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad porous-flow 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(porous-flow 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(porous-flow 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 24 of file PorousFlowEnergyTimeDerivative.h.

Constructor & Destructor Documentation

PorousFlowEnergyTimeDerivative::PorousFlowEnergyTimeDerivative ( const InputParameters &  parameters)

Definition at line 31 of file PorousFlowEnergyTimeDerivative.C.

32  : TimeKernel(parameters),
33  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
37  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
38  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
39  _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")),
40  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
42  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar")),
44  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
45  : nullptr),
46  _rock_energy_nodal(getMaterialProperty<Real>("PorousFlow_matrix_internal_energy_nodal")),
47  _rock_energy_nodal_old(getMaterialPropertyOld<Real>("PorousFlow_matrix_internal_energy_nodal")),
49  getMaterialProperty<std::vector<Real>>("dPorousFlow_matrix_internal_energy_nodal_dvar")),
52  ? &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")
53  : nullptr),
56  ? &getMaterialPropertyOld<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")
57  : nullptr),
59  ? &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),
73  ? &getMaterialProperty<std::vector<Real>>(
74  "PorousFlow_fluid_phase_internal_energy_nodal")
75  : nullptr),
77  ? &getMaterialPropertyOld<std::vector<Real>>(
78  "PorousFlow_fluid_phase_internal_energy_nodal")
79  : nullptr),
81  ? &getMaterialProperty<std::vector<std::vector<Real>>>(
82  "dPorousFlow_fluid_phase_internal_energy_nodal_dvar")
83  : nullptr)
84 {
85 }
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)
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
const MaterialProperty< unsigned int > *const _nearest_qp
the nearest qp to the node
const bool _fluid_present
whether _num_phases > 0
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 porous-flow 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(porous-flow 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
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(porous-flow variable)
unsigned int numPhases() const
the number of fluid phases
bool isPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is a porous flow 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(porous-flow variable) - these derivatives will be wrt variables at the nodes ...
const bool _var_is_porflow_var
whether the Variable for this Kernel is a porous-flow 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

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

As the fluid energy is lumped to the nodes, only non-zero terms are for _i==_j

Definition at line 122 of file PorousFlowEnergyTimeDerivative.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

123 {
124  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
125 
126  // porosity is dependent on variables that are lumped to the nodes,
127  // but it can depend on the gradient
128  // of variables, which are NOT lumped to the nodes, hence:
129  Real denergy = -_dporosity_dgradvar[_i][pvar] * _grad_phi[_j][_i] * _rock_energy_nodal[_i];
130  for (unsigned ph = 0; ph < _num_phases; ++ph)
131  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
132  (*_energy_nodal)[_i][ph] * _dporosity_dgradvar[_i][pvar] * _grad_phi[_j][nearest_qp];
133 
134  if (_i != _j)
135  return _test[_i][_qp] * denergy / _dt;
136 
138  denergy += -_dporosity_dvar[_i][pvar] * _rock_energy_nodal[_i];
139  denergy += (1.0 - _porosity[_i]) * _drock_energy_nodal_dvar[_i][pvar];
140  for (unsigned ph = 0; ph < _num_phases; ++ph)
141  {
142  denergy += (*_dfluid_density_dvar)[_i][ph][pvar] * (*_fluid_saturation_nodal)[_i][ph] *
143  (*_energy_nodal)[_i][ph] * _porosity[_i];
144  denergy += (*_fluid_density)[_i][ph] * (*_dfluid_saturation_nodal_dvar)[_i][ph][pvar] *
145  (*_energy_nodal)[_i][ph] * _porosity[_i];
146  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
147  (*_denergy_nodal_dvar)[_i][ph][pvar] * _porosity[_i];
148  denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
149  (*_energy_nodal)[_i][ph] * _dporosity_dvar[_i][pvar];
150  }
151  return _test[_i][_qp] * denergy / _dt;
152 }
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 porous-flow 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(porous-flow 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
Real PorousFlowEnergyTimeDerivative::computeQpJacobian ( )
overrideprotectedvirtual

If the variable is not a PorousFlow variable (very unusual), the diag Jacobian terms are 0

Definition at line 104 of file PorousFlowEnergyTimeDerivative.C.

105 {
107  if (!_var_is_porflow_var)
108  return 0.0;
109  return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
110 }
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
Real computeQpJac(unsigned int pvar) const
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...
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 porous-flow variable according to the Dictator ...
Real PorousFlowEnergyTimeDerivative::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

If the variable is not a PorousFlow variable, the OffDiag Jacobian terms are 0

Definition at line 113 of file PorousFlowEnergyTimeDerivative.C.

114 {
117  return 0.0;
119 }
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
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
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
the PorousFlow variable number
Real PorousFlowEnergyTimeDerivative::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 88 of file PorousFlowEnergyTimeDerivative.C.

89 {
90  Real energy = (1.0 - _porosity[_i]) * _rock_energy_nodal[_i];
91  Real energy_old = (1.0 - _porosity_old[_i]) * _rock_energy_nodal_old[_i];
92  for (unsigned ph = 0; ph < _num_phases; ++ph)
93  {
94  energy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
95  (*_energy_nodal)[_i][ph] * _porosity[_i];
96  energy_old += (*_fluid_density_old)[_i][ph] * (*_fluid_saturation_nodal_old)[_i][ph] *
97  (*_energy_nodal_old)[_i][ph] * _porosity_old[_i];
98  }
99 
100  return _test[_i][_qp] * (energy - energy_old) / _dt;
101 }
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

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

d(internal energy)/d(PorousFlow variable)

Definition at line 98 of file PorousFlowEnergyTimeDerivative.h.

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

d(nodal fluid density)/d(porous-flow variable)

Definition at line 80 of file PorousFlowEnergyTimeDerivative.h.

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

d(nodal fluid saturation)/d(porous-flow variable)

Definition at line 89 of file PorousFlowEnergyTimeDerivative.h.

const PorousFlowDictator& PorousFlowEnergyTimeDerivative::_dictator
protected

holds info on the PorousFlow variables

Definition at line 35 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

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

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

Definition at line 59 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

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

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

Definition at line 56 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

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

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

Definition at line 71 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

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

internal energy of the phases, evaluated at the nodes

Definition at line 92 of file PorousFlowEnergyTimeDerivative.h.

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 95 of file PorousFlowEnergyTimeDerivative.h.

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

nodal fluid density

Definition at line 74 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

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

old value of nodal fluid density

Definition at line 77 of file PorousFlowEnergyTimeDerivative.h.

const bool PorousFlowEnergyTimeDerivative::_fluid_present
protected

whether _num_phases > 0

Definition at line 44 of file PorousFlowEnergyTimeDerivative.h.

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

nodal fluid saturation

Definition at line 83 of file PorousFlowEnergyTimeDerivative.h.

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

old value of fluid saturation

Definition at line 86 of file PorousFlowEnergyTimeDerivative.h.

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

the nearest qp to the node

Definition at line 62 of file PorousFlowEnergyTimeDerivative.h.

const unsigned int PorousFlowEnergyTimeDerivative::_num_phases
protected

number of fluid phases

Definition at line 41 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

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 50 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_porosity_old
protected

old value of porosity

Definition at line 53 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_rock_energy_nodal
protected

nodal rock energy density

Definition at line 65 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac(), and computeQpResidual().

const MaterialProperty<Real>& PorousFlowEnergyTimeDerivative::_rock_energy_nodal_old
protected

old value of nodal rock energy density

Definition at line 68 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpResidual().

const bool PorousFlowEnergyTimeDerivative::_strain_at_nearest_qp
protected

whether the porosity uses the volumetric strain at the closest quadpoint

Definition at line 47 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJac().

const bool PorousFlowEnergyTimeDerivative::_var_is_porflow_var
protected

whether the Variable for this Kernel is a porous-flow variable according to the Dictator

Definition at line 38 of file PorousFlowEnergyTimeDerivative.h.

Referenced by computeQpJacobian().


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