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

Kernel = sum (stoichiometry * density * porosity_old * saturation * reaction_rate) where the sum is over secondary chemical species in a precipitation-dissolution reaction system. More...

#include <PorousFlowPreDis.h>

Inheritance diagram for PorousFlowPreDis:
[legend]

Public Member Functions

 PorousFlowPreDis (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)
 Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQpJacobian and computeQpOffDiagJacobian. More...
 

Protected Attributes

const std::vector< Real > _mineral_density
 Density of the mineral species. More...
 
const PorousFlowDictator_dictator
 PorousFlowDictator UserObject. More...
 
const unsigned int _aq_ph
 Aqueous phase number. More...
 
const MaterialProperty< Real > & _porosity_old
 Old value of porosity. More...
 
const MaterialProperty< std::vector< Real > > & _saturation
 Saturation. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
 d(saturation)/d(PorousFlow var) More...
 
const MaterialProperty< std::vector< Real > > & _reaction_rate
 Reaction rate of the yielding the secondary species. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dreaction_rate_dvar
 d(reaction rate)/d(porflow variable) More...
 
const std::vector< Real > _stoichiometry
 Stoichiometric coefficients. More...
 

Detailed Description

Kernel = sum (stoichiometry * density * porosity_old * saturation * reaction_rate) where the sum is over secondary chemical species in a precipitation-dissolution reaction system.

Definition at line 26 of file PorousFlowPreDis.h.

Constructor & Destructor Documentation

◆ PorousFlowPreDis()

PorousFlowPreDis::PorousFlowPreDis ( const InputParameters &  parameters)

Definition at line 34 of file PorousFlowPreDis.C.

35  : TimeKernel(parameters),
36  _mineral_density(getParam<std::vector<Real>>("mineral_density")),
37  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
39  _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")),
40  _saturation(getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")),
42  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")),
44  getMaterialProperty<std::vector<Real>>("PorousFlow_mineral_reaction_rate_nodal")),
45  _dreaction_rate_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
46  "dPorousFlow_mineral_reaction_rate_nodal_dvar")),
47  _stoichiometry(getParam<std::vector<Real>>("stoichiometry"))
48 {
49  /* Not needed due to PorousFlow_mineral_reaction_rate already checking this condition
50  if (_dictator.numPhases() < 1)
51  mooseError("PorousFlowPreDis: The number of fluid phases must not be zero");
52  */
53 
55  paramError("mineral_density",
56  "The Dictator proclaims that the number of precipitation-dissolution secondary "
57  "species in this simulation is ",
59  " whereas you have provided ",
60  _mineral_density.size(),
61  ". The Dictator does not take such mistakes lightly");
62 
64  paramError("stoichiometry",
65  "The Dictator proclaims that the number of precipitation-dissolution secondary "
66  "species in this simulation is ",
68  " whereas you have provided ",
69  _stoichiometry.size(),
70  ". The Dictator does not take such mistakes lightly");
71 }
const std::vector< Real > _stoichiometry
Stoichiometric coefficients.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< std::vector< Real > > & _saturation
Saturation.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const std::vector< Real > _mineral_density
Density of the mineral species.
unsigned int aqueousPhaseNumber() const
The aqueous phase number.
const unsigned int _aq_ph
Aqueous phase number.
const MaterialProperty< std::vector< Real > > & _reaction_rate
Reaction rate of the yielding the secondary species.
const MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow var)
unsigned int numAqueousKinetic() const
The number of aqueous kinetic secondary species.
const MaterialProperty< std::vector< std::vector< Real > > > & _dreaction_rate_dvar
d(reaction rate)/d(porflow variable)

Member Function Documentation

◆ computeQpJac()

Real PorousFlowPreDis::computeQpJac ( unsigned int  pvar)
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 112 of file PorousFlowPreDis.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

113 {
114  if (_i != _j)
115  return 0.0;
116 
117  Real res = 0.0;
118  Real dres = 0.0;
119  for (unsigned r = 0; r < _dictator.numAqueousKinetic(); ++r)
120  {
121  dres += _stoichiometry[r] * _mineral_density[r] * _dreaction_rate_dvar[_i][r][pvar];
122  res += _stoichiometry[r] * _mineral_density[r] * _reaction_rate[_i][r];
123  }
124 
125  return _test[_i][_qp] *
126  (dres * _saturation[_i][_aq_ph] + res * _dsaturation_dvar[_i][_aq_ph][pvar]) *
127  _porosity_old[_i];
128 }
const std::vector< Real > _stoichiometry
Stoichiometric coefficients.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< std::vector< Real > > & _saturation
Saturation.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const std::vector< Real > _mineral_density
Density of the mineral species.
const unsigned int _aq_ph
Aqueous phase number.
const MaterialProperty< std::vector< Real > > & _reaction_rate
Reaction rate of the yielding the secondary species.
const MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow var)
unsigned int numAqueousKinetic() const
The number of aqueous kinetic secondary species.
const MaterialProperty< std::vector< std::vector< Real > > > & _dreaction_rate_dvar
d(reaction rate)/d(porflow variable)

◆ computeQpJacobian()

Real PorousFlowPreDis::computeQpJacobian ( )
overrideprotectedvirtual

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

Definition at line 94 of file PorousFlowPreDis.C.

95 {
97  if (_dictator.notPorousFlowVariable(_var.number()))
98  return 0.0;
99  return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
100 }
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.
Real computeQpJac(unsigned int pvar)
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.

◆ computeQpOffDiagJacobian()

Real PorousFlowPreDis::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

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

Definition at line 103 of file PorousFlowPreDis.C.

104 {
107  return 0.0;
109 }
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.
Real computeQpJac(unsigned int pvar)
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.

◆ computeQpResidual()

Real PorousFlowPreDis::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 74 of file PorousFlowPreDis.C.

75 {
76  /*
77  *
78  * Note the use of the OLD value of porosity here.
79  * This strategy, which breaks the cyclic dependency between porosity
80  * and mineral concentration, is used in
81  * Kernel: PorousFlowPreDis
82  * Material: PorousFlowPorosity
83  * Material: PorousFlowAqueousPreDisChemistry
84  * Material: PorousFlowAqueousPreDisMineral
85  *
86  */
87  Real res = 0.0;
88  for (unsigned r = 0; r < _dictator.numAqueousKinetic(); ++r)
89  res += _stoichiometry[r] * _mineral_density[r] * _reaction_rate[_i][r];
90  return _test[_i][_qp] * res * _porosity_old[_i] * _saturation[_i][_aq_ph];
91 }
const std::vector< Real > _stoichiometry
Stoichiometric coefficients.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< std::vector< Real > > & _saturation
Saturation.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const std::vector< Real > _mineral_density
Density of the mineral species.
const unsigned int _aq_ph
Aqueous phase number.
const MaterialProperty< std::vector< Real > > & _reaction_rate
Reaction rate of the yielding the secondary species.
unsigned int numAqueousKinetic() const
The number of aqueous kinetic secondary species.

Member Data Documentation

◆ _aq_ph

const unsigned int PorousFlowPreDis::_aq_ph
protected

Aqueous phase number.

Definition at line 43 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _dictator

const PorousFlowDictator& PorousFlowPreDis::_dictator
protected

◆ _dreaction_rate_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowPreDis::_dreaction_rate_dvar
protected

d(reaction rate)/d(porflow variable)

Definition at line 58 of file PorousFlowPreDis.h.

Referenced by computeQpJac().

◆ _dsaturation_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowPreDis::_dsaturation_dvar
protected

d(saturation)/d(PorousFlow var)

Definition at line 52 of file PorousFlowPreDis.h.

Referenced by computeQpJac().

◆ _mineral_density

const std::vector<Real> PorousFlowPreDis::_mineral_density
protected

Density of the mineral species.

Definition at line 37 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), computeQpResidual(), and PorousFlowPreDis().

◆ _porosity_old

const MaterialProperty<Real>& PorousFlowPreDis::_porosity_old
protected

Old value of porosity.

Definition at line 46 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _reaction_rate

const MaterialProperty<std::vector<Real> >& PorousFlowPreDis::_reaction_rate
protected

Reaction rate of the yielding the secondary species.

Definition at line 55 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _saturation

const MaterialProperty<std::vector<Real> >& PorousFlowPreDis::_saturation
protected

Saturation.

Definition at line 49 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _stoichiometry

const std::vector<Real> PorousFlowPreDis::_stoichiometry
protected

Stoichiometric coefficients.

Definition at line 61 of file PorousFlowPreDis.h.

Referenced by computeQpJac(), computeQpResidual(), and PorousFlowPreDis().


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