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

Kernel = mass_component * d(volumetric_strain)/dt where mass_component = porosity*sum_phases(density_phase*saturation_phase*massfrac_phase^component) which is lumped to the nodes. More...

#include <PorousFlowMassVolumetricExpansion.h>

Inheritance diagram for PorousFlowMassVolumetricExpansion:
[legend]

Public Member Functions

 PorousFlowMassVolumetricExpansion (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar) override
 
Real computedMassQpJac (unsigned int jvar) const
 Derivative of mass part of the residual with respect to the Variable with variable number jvar. More...
 
Real computedVolQpJac (unsigned int jvar) const
 Derivative of volumetric-strain part of the residual with respect to the Variable with variable number jvar. More...
 

Protected Attributes

const unsigned int _fluid_component
 the fluid component index More...
 
const PorousFlowDictator_dictator
 holds info on the Porous Flow variables More...
 
const bool _var_is_porflow_var
 whether the Variable for this Kernel is a porous-flow variable according to the Dictator More...
 
unsigned int _ndisp
 number of displacement variables More...
 
std::vector< unsigned int > _disp_var_num
 variable number of the displacements variables More...
 
const bool _strain_at_nearest_qp
 whether the porosity uses the volumetric strain at the closest quadpoint More...
 
const MaterialProperty< Real > & _porosity
 porosity More...
 
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
 d(porosity)/d(porous-flow variable) More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad porous-flow variable) More...
 
const MaterialProperty< unsigned int > *const _nearest_qp
 the nearest qp to the node More...
 
const MaterialProperty< std::vector< Real > > & _fluid_density
 fluid density More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
 d(fluid density)/d(porous-flow variable) More...
 
const MaterialProperty< std::vector< Real > > & _fluid_saturation
 fluid saturation More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_dvar
 d(fluid saturation)/d(porous-flow variable) More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
 mass fraction More...
 
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
 d(mass fraction)/d(porous-flow variable) More...
 
const MaterialProperty< Real > & _strain_rate_qp
 strain rate More...
 
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
 d(strain rate)/d(porous-flow variable) More...
 

Detailed Description

Kernel = mass_component * d(volumetric_strain)/dt where mass_component = porosity*sum_phases(density_phase*saturation_phase*massfrac_phase^component) which is lumped to the nodes.

Definition at line 27 of file PorousFlowMassVolumetricExpansion.h.

Constructor & Destructor Documentation

PorousFlowMassVolumetricExpansion::PorousFlowMassVolumetricExpansion ( const InputParameters &  parameters)

Definition at line 33 of file PorousFlowMassVolumetricExpansion.C.

35  : TimeKernel(parameters),
36  _fluid_component(getParam<unsigned int>("fluid_component")),
37  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
39  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
40  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
41  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
43  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar")),
45  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
46  : nullptr),
47  _fluid_density(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")),
48  _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
49  "dPorousFlow_fluid_phase_density_nodal_dvar")),
50  _fluid_saturation(getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")),
52  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")),
53  _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
54  _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
55  "dPorousFlow_mass_frac_nodal_dvar")),
56  _strain_rate_qp(getMaterialProperty<Real>("PorousFlow_volumetric_strain_rate_qp")),
57  _dstrain_rate_qp_dvar(getMaterialProperty<std::vector<RealGradient>>(
58  "dPorousFlow_volumetric_strain_rate_qp_dvar"))
59 {
61  mooseError("The Dictator proclaims that the number of components in this simulation is ",
63  " whereas you have used the Kernel PorousFlowComponetMassVolumetricExpansion with "
64  "component = ",
66  ". The Dictator is watching you");
67 }
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
mass fraction
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_dvar
d(fluid saturation)/d(porous-flow variable)
const bool _var_is_porflow_var
whether the Variable for this Kernel is a porous-flow variable according to the Dictator ...
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow variable)
const MaterialProperty< Real > & _porosity
porosity
const unsigned int _fluid_component
the fluid component index
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(mass fraction)/d(porous-flow variable)
const MaterialProperty< std::vector< Real > > & _fluid_saturation
fluid saturation
unsigned int numComponents() const
the number of fluid components
const MaterialProperty< unsigned int > *const _nearest_qp
the nearest qp to the node
const PorousFlowDictator & _dictator
holds info on the Porous Flow variables
const MaterialProperty< std::vector< Real > > & _fluid_density
fluid density
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
d(strain rate)/d(porous-flow variable)
const MaterialProperty< Real > & _strain_rate_qp
strain rate
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(fluid density)/d(porous-flow variable)
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad porous-flow variable)
bool notPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is not a porous flow variabe
const bool _strain_at_nearest_qp
whether the porosity uses the volumetric strain at the closest quadpoint

Member Function Documentation

Real PorousFlowMassVolumetricExpansion::computedMassQpJac ( unsigned int  jvar) const
protected

Derivative of mass part of the residual with respect to the Variable with variable number jvar.

This is used by both computeQpJacobian and computeQpOffDiagJacobian

Parameters
jvartake the derivative of the mass part of the residual wrt this variable number

Definition at line 125 of file PorousFlowMassVolumetricExpansion.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

126 {
128  return 0.0;
129 
130  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
131  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
132 
133  const unsigned int num_phases = _fluid_density[_i].size();
134  Real dmass = 0.0;
135  for (unsigned ph = 0; ph < num_phases; ++ph)
136  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
137  _mass_frac[_i][ph][_fluid_component] * _dporosity_dgradvar[_i][pvar] *
138  _grad_phi[_j][nearest_qp];
139 
140  if (_i != _j)
141  return _test[_i][_qp] * dmass * _strain_rate_qp[_qp];
142 
143  for (unsigned ph = 0; ph < num_phases; ++ph)
144  {
145  dmass += _dfluid_density_dvar[_i][ph][pvar] * _fluid_saturation[_i][ph] *
146  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
147  dmass += _fluid_density[_i][ph] * _dfluid_saturation_dvar[_i][ph][pvar] *
148  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
149  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
150  _dmass_frac_dvar[_i][ph][_fluid_component][pvar] * _porosity[_i];
151  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
152  _mass_frac[_i][ph][_fluid_component] * _dporosity_dvar[_i][pvar];
153  }
154 
155  return _test[_i][_qp] * dmass * _strain_rate_qp[_qp];
156 }
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
mass fraction
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_dvar
d(fluid saturation)/d(porous-flow variable)
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow variable)
const MaterialProperty< Real > & _porosity
porosity
const unsigned int _fluid_component
the fluid component index
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(mass fraction)/d(porous-flow variable)
const MaterialProperty< std::vector< Real > > & _fluid_saturation
fluid saturation
const PorousFlowDictator & _dictator
holds info on the Porous Flow variables
const MaterialProperty< std::vector< Real > > & _fluid_density
fluid density
const MaterialProperty< Real > & _strain_rate_qp
strain rate
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(fluid density)/d(porous-flow variable)
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad porous-flow variable)
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
const bool _strain_at_nearest_qp
whether the porosity uses the volumetric strain at the closest quadpoint
Real PorousFlowMassVolumetricExpansion::computedVolQpJac ( unsigned int  jvar) const
protected

Derivative of volumetric-strain part of the residual with respect to the Variable with variable number jvar.

This is used by both computeQpJacobian and computeQpOffDiagJacobian

Parameters
jvartake the derivative of the volumetric-strain part of the residual wrt this variable number

Definition at line 107 of file PorousFlowMassVolumetricExpansion.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

108 {
110  return 0.0;
111 
112  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
113 
114  unsigned int num_phases = _fluid_density[_i].size();
115  Real mass = 0.0;
116  for (unsigned ph = 0; ph < num_phases; ++ph)
117  mass +=
118  _fluid_density[_i][ph] * _fluid_saturation[_i][ph] * _mass_frac[_i][ph][_fluid_component];
119 
120  Real dvol = _dstrain_rate_qp_dvar[_qp][pvar] * _grad_phi[_j][_qp];
121 
122  return _test[_i][_qp] * mass * _porosity[_i] * dvol;
123 }
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
mass fraction
const MaterialProperty< Real > & _porosity
porosity
const unsigned int _fluid_component
the fluid component index
const MaterialProperty< std::vector< Real > > & _fluid_saturation
fluid saturation
const PorousFlowDictator & _dictator
holds info on the Porous Flow variables
const MaterialProperty< std::vector< Real > > & _fluid_density
fluid density
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
d(strain rate)/d(porous-flow variable)
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 PorousFlowMassVolumetricExpansion::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 95 of file PorousFlowMassVolumetricExpansion.C.

96 {
97  return computedMassQpJac(_var.number()) + computedVolQpJac(_var.number());
98 }
Real computedMassQpJac(unsigned int jvar) const
Derivative of mass part of the residual with respect to the Variable with variable number jvar...
Real computedVolQpJac(unsigned int jvar) const
Derivative of volumetric-strain part of the residual with respect to the Variable with variable numbe...
Real PorousFlowMassVolumetricExpansion::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

Definition at line 101 of file PorousFlowMassVolumetricExpansion.C.

102 {
103  return computedMassQpJac(jvar) + computedVolQpJac(jvar);
104 }
Real computedMassQpJac(unsigned int jvar) const
Derivative of mass part of the residual with respect to the Variable with variable number jvar...
Real computedVolQpJac(unsigned int jvar) const
Derivative of volumetric-strain part of the residual with respect to the Variable with variable numbe...
Real PorousFlowMassVolumetricExpansion::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 70 of file PorousFlowMassVolumetricExpansion.C.

71 {
72  mooseAssert(_fluid_component < _mass_frac[_i][0].size(),
73  "PorousFlowMassVolumetricExpansion: fluid_component is given as "
75  << " which must be less than the number of fluid components described by the "
76  "mass-fraction matrix, which is "
77  << _mass_frac[_i][0].size());
78  unsigned int num_phases = _fluid_density[_i].size();
79  mooseAssert(num_phases == _fluid_saturation[_i].size(),
80  "PorousFlowMassVolumetricExpansion: Size of fluid density = "
81  << num_phases
82  << " size of fluid saturation = "
83  << _fluid_saturation[_i].size()
84  << " but both these must be equal to the number of phases in the system");
85 
86  Real mass = 0.0;
87  for (unsigned ph = 0; ph < num_phases; ++ph)
88  mass +=
89  _fluid_density[_i][ph] * _fluid_saturation[_i][ph] * _mass_frac[_i][ph][_fluid_component];
90 
91  return _test[_i][_qp] * mass * _porosity[_i] * _strain_rate_qp[_qp];
92 }
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
mass fraction
const MaterialProperty< Real > & _porosity
porosity
const unsigned int _fluid_component
the fluid component index
const MaterialProperty< std::vector< Real > > & _fluid_saturation
fluid saturation
const MaterialProperty< std::vector< Real > > & _fluid_density
fluid density
const MaterialProperty< Real > & _strain_rate_qp
strain rate

Member Data Documentation

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassVolumetricExpansion::_dfluid_density_dvar
protected

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

Definition at line 71 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassVolumetricExpansion::_dfluid_saturation_dvar
protected

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

Definition at line 77 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

const PorousFlowDictator& PorousFlowMassVolumetricExpansion::_dictator
protected

holds info on the Porous Flow variables

Definition at line 41 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), computedVolQpJac(), and PorousFlowMassVolumetricExpansion().

std::vector<unsigned int> PorousFlowMassVolumetricExpansion::_disp_var_num
protected

variable number of the displacements variables

Definition at line 50 of file PorousFlowMassVolumetricExpansion.h.

const MaterialProperty<std::vector<std::vector<std::vector<Real> > > >& PorousFlowMassVolumetricExpansion::_dmass_frac_dvar
protected

d(mass fraction)/d(porous-flow variable)

Definition at line 83 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

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

d(porosity)/d(grad porous-flow variable)

Definition at line 62 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

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

d(porosity)/d(porous-flow variable)

Definition at line 59 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

const MaterialProperty<std::vector<RealGradient> >& PorousFlowMassVolumetricExpansion::_dstrain_rate_qp_dvar
protected

d(strain rate)/d(porous-flow variable)

Definition at line 89 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedVolQpJac().

const unsigned int PorousFlowMassVolumetricExpansion::_fluid_component
protected
const MaterialProperty<std::vector<Real> >& PorousFlowMassVolumetricExpansion::_fluid_density
protected

fluid density

Definition at line 68 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), computedVolQpJac(), and computeQpResidual().

const MaterialProperty<std::vector<Real> >& PorousFlowMassVolumetricExpansion::_fluid_saturation
protected

fluid saturation

Definition at line 74 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), computedVolQpJac(), and computeQpResidual().

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassVolumetricExpansion::_mass_frac
protected

mass fraction

Definition at line 80 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), computedVolQpJac(), and computeQpResidual().

unsigned int PorousFlowMassVolumetricExpansion::_ndisp
protected

number of displacement variables

Definition at line 47 of file PorousFlowMassVolumetricExpansion.h.

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

the nearest qp to the node

Definition at line 65 of file PorousFlowMassVolumetricExpansion.h.

const MaterialProperty<Real>& PorousFlowMassVolumetricExpansion::_porosity
protected

porosity

Definition at line 56 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), computedVolQpJac(), and computeQpResidual().

const bool PorousFlowMassVolumetricExpansion::_strain_at_nearest_qp
protected

whether the porosity uses the volumetric strain at the closest quadpoint

Definition at line 53 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

const MaterialProperty<Real>& PorousFlowMassVolumetricExpansion::_strain_rate_qp
protected

strain rate

Definition at line 86 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), and computeQpResidual().

const bool PorousFlowMassVolumetricExpansion::_var_is_porflow_var
protected

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

Definition at line 44 of file PorousFlowMassVolumetricExpansion.h.


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