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

This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable number used internally by MOOSE, as well as the number of fluid phases and the number of fluid components. More...

#include <PorousFlowDictator.h>

Inheritance diagram for PorousFlowDictator:
[legend]

Public Member Functions

 PorousFlowDictator (const InputParameters &parameters)
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 
unsigned int numVariables () const
 The number of PorousFlow variables. More...
 
unsigned int numPhases () const
 The number of fluid phases. More...
 
unsigned int numComponents () const
 The number of fluid components. More...
 
unsigned int numAqueousEquilibrium () const
 The number of aqueous equilibrium secondary species. More...
 
unsigned int numAqueousKinetic () const
 The number of aqueous kinetic secondary species. More...
 
unsigned int aqueousPhaseNumber () const
 The aqueous phase number. More...
 
unsigned int porousFlowVariableNum (unsigned int moose_var_num) const
 The PorousFlow variable number. More...
 
unsigned int mooseVariableNum (unsigned int porous_flow_var_num) const
 The Moose variable number. More...
 
bool isPorousFlowVariable (unsigned int moose_var_num) const
 Returns true if moose_var_num is a porous flow variable. More...
 
bool notPorousFlowVariable (unsigned int moose_var_num) const
 Returns true if moose_var_num is not a porous flow variabe. More...
 
bool consistentFEType () const
 Whether the porous_flow_vars all have the same FEType or if no porous_flow_vars were provided. More...
 
FEType feType () const
 The FEType of the first porous_flow_variable. More...
 
bool usePermDerivs () const
 Check if the simulation includes derivatives of permeability Note: when the permeability is constant, expensive tensor calculations can be ignored in Jacobian calculations. More...
 
void usePermDerivs (bool flag) const
 Set the _perm_derivs flag. More...
 

Protected Attributes

const unsigned int _num_variables
 Number of PorousFlow variables. More...
 
const unsigned int _num_phases
 Number of fluid phases. More...
 
const unsigned int _num_components
 Number of fluid components. More...
 
const unsigned int _num_aqueous_equilibrium
 Number of aqueous-equilibrium secondary species. More...
 
const unsigned int _num_aqueous_kinetic
 Number of aqeuous-kinetic secondary species that are involved in mineralisation. More...
 
const unsigned int _aqueous_phase_number
 Aqueous phase number. More...
 
bool _perm_derivs
 Indicates whether the simulation includes derivatives of permeability. More...
 

Private Attributes

bool _consistent_fe_type
 Whether the porous_flow_vars all have the same fe_type. More...
 
FEType _fe_type
 FE type used by the PorousFlow variables. More...
 
std::vector< unsigned int > _moose_var_num
 _moose_var_num[i] = the moose variable number corresponding to porous flow variable i More...
 
std::vector< unsigned int > _pf_var_num
 _pf_var_num[i] = the porous flow variable corresponding to moose variable i More...
 

Detailed Description

This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable number used internally by MOOSE, as well as the number of fluid phases and the number of fluid components.

The Dictator performs sanity checks on all PorousFlow simulations and helps users rectify errors (for instance if parts of the input file suggest it is a 2-phase simulation, while other parts suggest it is 1-phase).

All PorousFlow Materials and Kernels calculate and use derivatives with respect to all the variables mentioned in this Object, at least in principal (in practice they may be lazy and not compute all derivatives).

                              `  `:;@;:.:::#@@@'.`
                       `    ,@;@@@@@@@@@@@@@@@@@@@@'';''``
                 ,;@@@@@@@@@@@@T@@@@@H@@@@@E@@@@@@@@++@@@+:.:.`
        '@@'@@@@@@@D@@@@@I@@@@@C@@@@@T@@@@@A@@@@@T@@@@@O@@@@@R@@@@@@..`
 `..,;@@@@@@@@@@@@@@@@@@@@@@@@@@@@I@@@@@S@@@@@@@@@@@@@@@@@@@@@@@@@@@;.

.:@@@@@@@@@@W@@@A@@@T@@@C@@@H@@@I@@@N@@@G@@@@#;:. .:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:,@@@@@@@@@@+ ,@@@@@@@@@@@';'@@@@@@@@@@:@@@@+@+:;@@@@@@@;:#';::'@@@@@@. `::;,..`::+:,;@@@@@@:. ‘’@@@'...,,.... ` ..:;@@@@@@@@+. @;;;;@;,, `:@@@@@@:` @@++';:,.;+@#:,. @@@@#+:. ‘,@@@@@@@@@@@@@@&rsquo;@@+:. ‘.:’::, @@@:,...,@@@@@, +@@@@@@@@@@@@;'@@# .,,,, @@@':::@@@@.@@@@@@@@@@@@@@@@. ,@@@` `.::, @@@@@@#@@@@@';. `@@@@@@@@;,@`@@@@@@@@@@@@@@@@@@@@@@@@@@@@@` .,@@@@.., @@@@@:.. @@@, ;@@@@@@@@@ ,@@@:@@@ ‘,’@@ . @@@@@':,,` @@@@:` @@@@@@@@@@@@@@@@@@ ,@@: `:@@@@@; ..:@@@` @@;:‘ @@@.. ’@@@@@@@@@ @@ .@@@,‘:’@. @@@@;:.@@@, `‘ @@@@@@@@@@@@@ ,@@@.’@@,‘ @+’:'';@@@@@@,, @@@@@@@@@@@' ‘.:@#@:@@’:. :;;;:@,,.@+, +. @@@@@@@@@@@@@@@@@@@@ . @@:';,,,.` .,,,,,,;;+;:.`..;,., ,,` @@@@@@@@@@@@@@@@` ,@, ` `......,,;+++#';@@@@@@. '@@@@@@; .;@@. ```,;'+@+;:'@@'@@@:. ‘ ,#@@+, .:+’@';::'+':,;,#@@@@@@@@@: .@@@@: :,,::,....,,..,,,,...,,,,,...:;@@@@; .....`,...,,,,,.....

Definition at line 71 of file PorousFlowDictator.h.

Constructor & Destructor Documentation

◆ PorousFlowDictator()

PorousFlowDictator::PorousFlowDictator ( const InputParameters &  parameters)

Definition at line 50 of file PorousFlowDictator.C.

51  : GeneralUserObject(parameters),
52  Coupleable(this, false),
53  _num_variables(coupledComponents("porous_flow_vars")),
54  _num_phases(getParam<unsigned int>("number_fluid_phases")),
55  _num_components(getParam<unsigned int>("number_fluid_components")),
56  _num_aqueous_equilibrium(getParam<unsigned int>("number_aqueous_equilibrium")),
57  _num_aqueous_kinetic(getParam<unsigned int>("number_aqueous_kinetic")),
58  _aqueous_phase_number(getParam<unsigned int>("aqueous_phase_number")),
59  _consistent_fe_type(false),
60  _fe_type(0)
61 {
63  for (unsigned int i = 0; i < _num_variables; ++i)
64  _moose_var_num[i] = coupled("porous_flow_vars", i);
65 
66  if (_num_variables > 0)
67  {
68  _consistent_fe_type = true;
69  _fe_type = FEType(getVar("porous_flow_vars", 0)->feType());
70  for (unsigned int i = 1; i < _num_variables; ++i)
71  if (getVar("porous_flow_vars", i)->feType() != _fe_type)
72  _consistent_fe_type = false;
73  }
74 
75  _pf_var_num.assign(_fe_problem.getNonlinearSystemBase().nVariables(),
76  _num_variables); // Note: the _num_variables assignment indicates that "this is
77  // not a PorousFlow variable"
78  for (unsigned int i = 0; i < _num_variables; ++i)
79  if (_moose_var_num[i] < _pf_var_num.size())
81  else
82  // should not couple AuxVariables to the Dictator (Jacobian entries are not calculated for
83  // them)
84  mooseError("PorousFlowDictator: AuxVariables variables must not be coupled into the Dictator "
85  "for this is against specification #1984. Variable number ",
86  i,
87  " is an AuxVariable.");
88 
90  mooseError("PorousflowDictator: The aqueous phase number must be less than the number of fluid "
91  "phases. The Dictator does not appreciate jokes.");
92 
93  // Don't include permeabiity derivatives in the Jacobian by default (overwrite using
94  // usePermDerivs()) when necessary in permeabiity material classes
95  _perm_derivs = false;
96 }

Member Function Documentation

◆ aqueousPhaseNumber()

unsigned int PorousFlowDictator::aqueousPhaseNumber ( ) const

The aqueous phase number.

Definition at line 129 of file PorousFlowDictator.C.

130 {
131  return _aqueous_phase_number;
132 }

◆ consistentFEType()

bool PorousFlowDictator::consistentFEType ( ) const

Whether the porous_flow_vars all have the same FEType or if no porous_flow_vars were provided.

Definition at line 167 of file PorousFlowDictator.C.

168 {
169  return _consistent_fe_type;
170 }

Referenced by PorousFlowAdvectiveFluxCalculatorBase::PorousFlowAdvectiveFluxCalculatorBase().

◆ execute()

virtual void PorousFlowDictator::execute ( )
inlineoverridevirtual

Definition at line 77 of file PorousFlowDictator.h.

77 {};

◆ feType()

FEType PorousFlowDictator::feType ( ) const

The FEType of the first porous_flow_variable.

Note, this is meaningless if there are no named porous_flow_variables: consistentFEType() should be used to check this

Definition at line 173 of file PorousFlowDictator.C.

174 {
175  return _fe_type;
176 }

Referenced by PorousFlowDictator().

◆ finalize()

virtual void PorousFlowDictator::finalize ( )
inlineoverridevirtual

Definition at line 78 of file PorousFlowDictator.h.

78 {};

◆ initialize()

virtual void PorousFlowDictator::initialize ( )
inlineoverridevirtual

Definition at line 76 of file PorousFlowDictator.h.

76 {};

◆ isPorousFlowVariable()

bool PorousFlowDictator::isPorousFlowVariable ( unsigned int  moose_var_num) const

Returns true if moose_var_num is a porous flow variable.

Parameters
moose_var_numthe MOOSE variable number eg if porous_flow_vars = 'pwater pgas', and the variables in the simulation are 'energy pwater pgas shape' then isPorousFlowVariable(0) = false, isPorousFlowVariable(1) = true

Definition at line 155 of file PorousFlowDictator.C.

156 {
157  return !notPorousFlowVariable(moose_var_num);
158 }

◆ mooseVariableNum()

unsigned int PorousFlowDictator::mooseVariableNum ( unsigned int  porous_flow_var_num) const

The Moose variable number.

Parameters
porous_flow_var_numthe PorousFlow variable number eg if porous_flow_vars = 'pwater pgas', and the variables in the simulation are 'energy pwater pgas shape' then mooseVariableNum(1) = 2

Definition at line 145 of file PorousFlowDictator.C.

146 {
147  if (porous_flow_var_num >= _num_variables)
148  mooseError("The Dictator proclaims that there is no such PorousFlow variable with number ",
149  porous_flow_var_num,
150  ". Exiting with error code 1984.");
151  return _moose_var_num[porous_flow_var_num];
152 }

Referenced by PorousFlowFluxLimitedTVDAdvection::computeJacobian().

◆ notPorousFlowVariable()

bool PorousFlowDictator::notPorousFlowVariable ( unsigned int  moose_var_num) const

Returns true if moose_var_num is not a porous flow variabe.

Parameters
moose_var_numthe MOOSE variable number eg if porous_flow_vars = 'pwater pgas', and the variables in the simulation are 'energy pwater pgas shape' then notPorousFlowVariable(0) = true, notPorousFlowVariable(1) = false

Definition at line 161 of file PorousFlowDictator.C.

162 {
163  return moose_var_num >= _pf_var_num.size() || _pf_var_num[moose_var_num] == _num_variables;
164 }

Referenced by PorousFlowHeatVolumetricExpansion::computedEnergyQpJac(), PorousFlowMassVolumetricExpansion::computedMassQpJac(), PorousFlowHeatVolumetricExpansion::computedVolQpJac(), PorousFlowMassVolumetricExpansion::computedVolQpJac(), PorousFlowPolyLineSink::computeQpBaseOutflowJacobian(), PorousFlowPeacemanBorehole::computeQpBaseOutflowJacobian(), PorousFlowDispersiveFlux::computeQpJac(), PorousFlowDesorpedMassTimeDerivative::computeQpJac(), PorousFlowDesorpedMassVolumetricExpansion::computeQpJac(), PorousFlowPreDis::computeQpJacobian(), PorousFlowEffectiveStressCoupling::computeQpJacobian(), PorousFlowHeatConduction::computeQpOffDiagJacobian(), PorousFlowBasicAdvection::computeQpOffDiagJacobian(), PorousFlowPlasticHeatEnergy::computeQpOffDiagJacobian(), PorousFlowEnergyTimeDerivative::computeQpOffDiagJacobian(), PorousFlowFullySaturatedMassTimeDerivative::computeQpOffDiagJacobian(), PorousFlowPreDis::computeQpOffDiagJacobian(), PorousFlowFullySaturatedDarcyBase::computeQpOffDiagJacobian(), PorousFlowMassTimeDerivative::computeQpOffDiagJacobian(), PorousFlowEffectiveStressCoupling::computeQpOffDiagJacobian(), PorousFlowMassRadioactiveDecay::computeQpOffDiagJacobian(), PorousFlowDarcyBase::computeResidualAndJacobian(), PorousFlowDarcyBase::darcyQpJacobian(), isPorousFlowVariable(), PorousFlowLineSink::jac(), and PorousFlowSink::jac().

◆ numAqueousEquilibrium()

unsigned int PorousFlowDictator::numAqueousEquilibrium ( ) const

The number of aqueous equilibrium secondary species.

Definition at line 117 of file PorousFlowDictator.C.

118 {
120 }

Referenced by PorousFlowPropertyAux::PorousFlowPropertyAux().

◆ numAqueousKinetic()

unsigned int PorousFlowDictator::numAqueousKinetic ( ) const

The number of aqueous kinetic secondary species.

Definition at line 123 of file PorousFlowDictator.C.

124 {
125  return _num_aqueous_kinetic;
126 }

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

◆ numComponents()

unsigned int PorousFlowDictator::numComponents ( ) const

◆ numPhases()

unsigned int PorousFlowDictator::numPhases ( ) const

◆ numVariables()

unsigned int PorousFlowDictator::numVariables ( ) const

The number of PorousFlow variables.

Materials and Kernels will calculate and use derivatives with respect to these variables in the Jacobian

Definition at line 99 of file PorousFlowDictator.C.

100 {
101  return _num_variables;
102 }

Referenced by PorousFlowFluxLimitedTVDAdvection::computeJacobian(), PorousFlowFluidMass::PorousFlowFluidMass(), and PorousFlowHeatEnergy::PorousFlowHeatEnergy().

◆ porousFlowVariableNum()

unsigned int PorousFlowDictator::porousFlowVariableNum ( unsigned int  moose_var_num) const

The PorousFlow variable number.

Parameters
moose_var_numthe MOOSE variable number eg if porous_flow_vars = 'pwater pgas', and the variables in the simulation are 'energy pwater pgas shape' then porousFlowVariableNum(2) = 1

Definition at line 135 of file PorousFlowDictator.C.

136 {
137  if (moose_var_num >= _pf_var_num.size() || _pf_var_num[moose_var_num] == _num_variables)
138  mooseError("The Dictator proclaims that the moose variable with number ",
139  moose_var_num,
140  " is not a PorousFlow variable. Exiting with error code 1984.");
141  return _pf_var_num[moose_var_num];
142 }

Referenced by PorousFlowHeatVolumetricExpansion::computedEnergyQpJac(), PorousFlowMassVolumetricExpansion::computedMassQpJac(), PorousFlowHeatVolumetricExpansion::computedVolQpJac(), PorousFlowMassVolumetricExpansion::computedVolQpJac(), PorousFlowPolyLineSink::computeQpBaseOutflowJacobian(), PorousFlowPeacemanBorehole::computeQpBaseOutflowJacobian(), PorousFlowDispersiveFlux::computeQpJac(), PorousFlowDesorpedMassTimeDerivative::computeQpJac(), PorousFlowDesorpedMassVolumetricExpansion::computeQpJac(), PorousFlowEnergyTimeDerivative::computeQpJacobian(), PorousFlowFullySaturatedMassTimeDerivative::computeQpJacobian(), PorousFlowPreDis::computeQpJacobian(), PorousFlowMassTimeDerivative::computeQpJacobian(), PorousFlowMassRadioactiveDecay::computeQpJacobian(), PorousFlowEffectiveStressCoupling::computeQpJacobian(), PorousFlowHeatConduction::computeQpOffDiagJacobian(), PorousFlowBasicAdvection::computeQpOffDiagJacobian(), PorousFlowPlasticHeatEnergy::computeQpOffDiagJacobian(), PorousFlowEnergyTimeDerivative::computeQpOffDiagJacobian(), PorousFlowFullySaturatedMassTimeDerivative::computeQpOffDiagJacobian(), PorousFlowFullySaturatedDarcyBase::computeQpOffDiagJacobian(), PorousFlowPreDis::computeQpOffDiagJacobian(), PorousFlowMassTimeDerivative::computeQpOffDiagJacobian(), PorousFlowMassRadioactiveDecay::computeQpOffDiagJacobian(), PorousFlowEffectiveStressCoupling::computeQpOffDiagJacobian(), PorousFlowDarcyBase::computeResidualAndJacobian(), PorousFlowDarcyBase::darcyQpJacobian(), PorousFlowLineSink::jac(), and PorousFlowSink::jac().

◆ usePermDerivs() [1/2]

bool PorousFlowDictator::usePermDerivs ( ) const
inline

Check if the simulation includes derivatives of permeability Note: when the permeability is constant, expensive tensor calculations can be ignored in Jacobian calculations.

Definition at line 156 of file PorousFlowDictator.h.

156 { return _perm_derivs; };

◆ usePermDerivs() [2/2]

void PorousFlowDictator::usePermDerivs ( bool  flag) const
inline

Set the _perm_derivs flag.

Definition at line 161 of file PorousFlowDictator.h.

161 { _perm_derivs = flag; };

Member Data Documentation

◆ _aqueous_phase_number

const unsigned int PorousFlowDictator::_aqueous_phase_number
protected

Aqueous phase number.

Definition at line 180 of file PorousFlowDictator.h.

Referenced by aqueousPhaseNumber(), and PorousFlowDictator().

◆ _consistent_fe_type

bool PorousFlowDictator::_consistent_fe_type
private

Whether the porous_flow_vars all have the same fe_type.

Definition at line 187 of file PorousFlowDictator.h.

Referenced by consistentFEType(), and PorousFlowDictator().

◆ _fe_type

FEType PorousFlowDictator::_fe_type
private

FE type used by the PorousFlow variables.

Definition at line 190 of file PorousFlowDictator.h.

Referenced by feType(), and PorousFlowDictator().

◆ _moose_var_num

std::vector<unsigned int> PorousFlowDictator::_moose_var_num
private

_moose_var_num[i] = the moose variable number corresponding to porous flow variable i

Definition at line 193 of file PorousFlowDictator.h.

Referenced by mooseVariableNum(), and PorousFlowDictator().

◆ _num_aqueous_equilibrium

const unsigned int PorousFlowDictator::_num_aqueous_equilibrium
protected

Number of aqueous-equilibrium secondary species.

Definition at line 174 of file PorousFlowDictator.h.

Referenced by numAqueousEquilibrium().

◆ _num_aqueous_kinetic

const unsigned int PorousFlowDictator::_num_aqueous_kinetic
protected

Number of aqeuous-kinetic secondary species that are involved in mineralisation.

Definition at line 177 of file PorousFlowDictator.h.

Referenced by numAqueousKinetic().

◆ _num_components

const unsigned int PorousFlowDictator::_num_components
protected

Number of fluid components.

Definition at line 171 of file PorousFlowDictator.h.

Referenced by numComponents().

◆ _num_phases

const unsigned int PorousFlowDictator::_num_phases
protected

Number of fluid phases.

Definition at line 168 of file PorousFlowDictator.h.

Referenced by numPhases(), and PorousFlowDictator().

◆ _num_variables

const unsigned int PorousFlowDictator::_num_variables
protected

Number of PorousFlow variables.

Definition at line 161 of file PorousFlowDictator.h.

Referenced by mooseVariableNum(), notPorousFlowVariable(), numVariables(), PorousFlowDictator(), and porousFlowVariableNum().

◆ _perm_derivs

bool PorousFlowDictator::_perm_derivs
mutableprotected

Indicates whether the simulation includes derivatives of permeability.

Definition at line 183 of file PorousFlowDictator.h.

Referenced by PorousFlowDictator(), and usePermDerivs().

◆ _pf_var_num

std::vector<unsigned int> PorousFlowDictator::_pf_var_num
private

_pf_var_num[i] = the porous flow variable corresponding to moose variable i

Definition at line 196 of file PorousFlowDictator.h.

Referenced by notPorousFlowVariable(), PorousFlowDictator(), and porousFlowVariableNum().


The documentation for this class was generated from the following files:
PorousFlowDictator::_pf_var_num
std::vector< unsigned int > _pf_var_num
_pf_var_num[i] = the porous flow variable corresponding to moose variable i
Definition: PorousFlowDictator.h:196
PorousFlowDictator::_num_phases
const unsigned int _num_phases
Number of fluid phases.
Definition: PorousFlowDictator.h:168
PorousFlowDictator::_num_aqueous_equilibrium
const unsigned int _num_aqueous_equilibrium
Number of aqueous-equilibrium secondary species.
Definition: PorousFlowDictator.h:174
PorousFlowDictator::_num_aqueous_kinetic
const unsigned int _num_aqueous_kinetic
Number of aqeuous-kinetic secondary species that are involved in mineralisation.
Definition: PorousFlowDictator.h:177
PorousFlowDictator::notPorousFlowVariable
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
Definition: PorousFlowDictator.C:161
PorousFlowDictator::_num_variables
const unsigned int _num_variables
Number of PorousFlow variables.
Definition: PorousFlowDictator.h:161
PorousFlowDictator::_fe_type
FEType _fe_type
FE type used by the PorousFlow variables.
Definition: PorousFlowDictator.h:190
PorousFlowDictator::_moose_var_num
std::vector< unsigned int > _moose_var_num
_moose_var_num[i] = the moose variable number corresponding to porous flow variable i
Definition: PorousFlowDictator.h:193
PorousFlowDictator::feType
FEType feType() const
The FEType of the first porous_flow_variable.
Definition: PorousFlowDictator.C:173
PorousFlowDictator::_consistent_fe_type
bool _consistent_fe_type
Whether the porous_flow_vars all have the same fe_type.
Definition: PorousFlowDictator.h:187
PorousFlowDictator::_aqueous_phase_number
const unsigned int _aqueous_phase_number
Aqueous phase number.
Definition: PorousFlowDictator.h:180
PorousFlowDictator::_num_components
const unsigned int _num_components
Number of fluid components.
Definition: PorousFlowDictator.h:171
PorousFlowDictator::_perm_derivs
bool _perm_derivs
Indicates whether the simulation includes derivatives of permeability.
Definition: PorousFlowDictator.h:183