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
 PorousFlowDictator UserObject. More...
 
const bool _var_is_porflow_var
 Whether the Variable for this Kernel is a PorousFlow 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(PorousFlow variable) More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad PorousFlow 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(PorousFlow 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(PorousFlow 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(PorousFlow variable) More...
 
const MaterialProperty< Real > & _strain_rate_qp
 Strain rate. More...
 
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
 d(strain rate)/d(PorousFlow 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 28 of file PorousFlowMassVolumetricExpansion.h.

Constructor & Destructor Documentation

◆ PorousFlowMassVolumetricExpansion()

PorousFlowMassVolumetricExpansion::PorousFlowMassVolumetricExpansion ( const InputParameters &  parameters)

Definition at line 36 of file PorousFlowMassVolumetricExpansion.C.

38  : TimeKernel(parameters),
39  _fluid_component(getParam<unsigned int>("fluid_component")),
40  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
42  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
43  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
44  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
46  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar")),
48  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
49  : nullptr),
50  _fluid_density(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")),
51  _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
52  "dPorousFlow_fluid_phase_density_nodal_dvar")),
53  _fluid_saturation(getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")),
55  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")),
56  _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
57  _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
58  "dPorousFlow_mass_frac_nodal_dvar")),
59  _strain_rate_qp(getMaterialProperty<Real>("PorousFlow_volumetric_strain_rate_qp")),
60  _dstrain_rate_qp_dvar(getMaterialProperty<std::vector<RealGradient>>(
61  "dPorousFlow_volumetric_strain_rate_qp_dvar"))
62 {
64  mooseError("The Dictator proclaims that the number of components in this simulation is ",
66  " whereas you have used the Kernel PorousFlowComponetMassVolumetricExpansion with "
67  "component = ",
69  ". The Dictator is watching you");
70 }
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(PorousFlow variable)
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow 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(PorousFlow variable)
unsigned int numComponents() const
The number of fluid components.
const MaterialProperty< std::vector< Real > > & _fluid_saturation
Fluid saturation.
const MaterialProperty< unsigned int > *const _nearest_qp
The nearest qp to the node.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const MaterialProperty< std::vector< Real > > & _fluid_density
Fluid density.
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
d(strain rate)/d(PorousFlow variable)
const MaterialProperty< Real > & _strain_rate_qp
Strain rate.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(fluid density)/d(PorousFlow variable)
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.

Member Function Documentation

◆ computedMassQpJac()

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 126 of file PorousFlowMassVolumetricExpansion.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

127 {
129  return 0.0;
130 
131  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
132  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
133 
134  const unsigned int num_phases = _fluid_density[_i].size();
135  Real dmass = 0.0;
136  for (unsigned ph = 0; ph < num_phases; ++ph)
137  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
138  _mass_frac[_i][ph][_fluid_component] * _dporosity_dgradvar[_i][pvar] *
139  _grad_phi[_j][nearest_qp];
140 
141  if (_i != _j)
142  return _test[_i][_qp] * dmass * _strain_rate_qp[_qp];
143 
144  for (unsigned ph = 0; ph < num_phases; ++ph)
145  {
146  dmass += _dfluid_density_dvar[_i][ph][pvar] * _fluid_saturation[_i][ph] *
147  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
148  dmass += _fluid_density[_i][ph] * _dfluid_saturation_dvar[_i][ph][pvar] *
149  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
150  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
151  _dmass_frac_dvar[_i][ph][_fluid_component][pvar] * _porosity[_i];
152  dmass += _fluid_density[_i][ph] * _fluid_saturation[_i][ph] *
153  _mass_frac[_i][ph][_fluid_component] * _dporosity_dvar[_i][pvar];
154  }
155 
156  return _test[_i][_qp] * dmass * _strain_rate_qp[_qp];
157 }
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(PorousFlow variable)
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow 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(PorousFlow variable)
const MaterialProperty< std::vector< Real > > & _fluid_saturation
Fluid saturation.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
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(PorousFlow variable)
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
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.

◆ computedVolQpJac()

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 108 of file PorousFlowMassVolumetricExpansion.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

109 {
111  return 0.0;
112 
113  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
114 
115  unsigned int num_phases = _fluid_density[_i].size();
116  Real mass = 0.0;
117  for (unsigned ph = 0; ph < num_phases; ++ph)
118  mass +=
119  _fluid_density[_i][ph] * _fluid_saturation[_i][ph] * _mass_frac[_i][ph][_fluid_component];
120 
121  Real dvol = _dstrain_rate_qp_dvar[_qp][pvar] * _grad_phi[_j][_qp];
122 
123  return _test[_i][_qp] * mass * _porosity[_i] * dvol;
124 }
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction.
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
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
PorousFlowDictator UserObject.
const MaterialProperty< std::vector< Real > > & _fluid_density
Fluid density.
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
d(strain rate)/d(PorousFlow variable)
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.

◆ computeQpJacobian()

Real PorousFlowMassVolumetricExpansion::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 96 of file PorousFlowMassVolumetricExpansion.C.

97 {
98  return computedMassQpJac(_var.number()) + computedVolQpJac(_var.number());
99 }
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...

◆ computeQpOffDiagJacobian()

Real PorousFlowMassVolumetricExpansion::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

Definition at line 102 of file PorousFlowMassVolumetricExpansion.C.

103 {
104  return computedMassQpJac(jvar) + computedVolQpJac(jvar);
105 }
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...

◆ computeQpResidual()

Real PorousFlowMassVolumetricExpansion::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 73 of file PorousFlowMassVolumetricExpansion.C.

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

◆ _dfluid_density_dvar

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

d(fluid density)/d(PorousFlow variable)

Definition at line 72 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _dfluid_saturation_dvar

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

d(fluid saturation)/d(PorousFlow variable)

Definition at line 78 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _dictator

const PorousFlowDictator& PorousFlowMassVolumetricExpansion::_dictator
protected

◆ _disp_var_num

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

Variable number of the displacements variables.

Definition at line 51 of file PorousFlowMassVolumetricExpansion.h.

◆ _dmass_frac_dvar

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

d(mass fraction)/d(PorousFlow variable)

Definition at line 84 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _dporosity_dgradvar

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

d(porosity)/d(grad PorousFlow variable)

Definition at line 63 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _dporosity_dvar

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

d(porosity)/d(PorousFlow variable)

Definition at line 60 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _dstrain_rate_qp_dvar

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

d(strain rate)/d(PorousFlow variable)

Definition at line 90 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedVolQpJac().

◆ _fluid_component

const unsigned int PorousFlowMassVolumetricExpansion::_fluid_component
protected

◆ _fluid_density

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

Fluid density.

Definition at line 69 of file PorousFlowMassVolumetricExpansion.h.

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

◆ _fluid_saturation

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

Fluid saturation.

Definition at line 75 of file PorousFlowMassVolumetricExpansion.h.

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

◆ _mass_frac

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

Mass fraction.

Definition at line 81 of file PorousFlowMassVolumetricExpansion.h.

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

◆ _ndisp

unsigned int PorousFlowMassVolumetricExpansion::_ndisp
protected

Number of displacement variables.

Definition at line 48 of file PorousFlowMassVolumetricExpansion.h.

◆ _nearest_qp

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

The nearest qp to the node.

Definition at line 66 of file PorousFlowMassVolumetricExpansion.h.

◆ _porosity

const MaterialProperty<Real>& PorousFlowMassVolumetricExpansion::_porosity
protected

Porosity.

Definition at line 57 of file PorousFlowMassVolumetricExpansion.h.

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

◆ _strain_at_nearest_qp

const bool PorousFlowMassVolumetricExpansion::_strain_at_nearest_qp
protected

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

Definition at line 54 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac().

◆ _strain_rate_qp

const MaterialProperty<Real>& PorousFlowMassVolumetricExpansion::_strain_rate_qp
protected

Strain rate.

Definition at line 87 of file PorousFlowMassVolumetricExpansion.h.

Referenced by computedMassQpJac(), and computeQpResidual().

◆ _var_is_porflow_var

const bool PorousFlowMassVolumetricExpansion::_var_is_porflow_var
protected

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

Definition at line 45 of file PorousFlowMassVolumetricExpansion.h.


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