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

This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels, etc, and the variable number used internally by MOOSE. More...

#include <RichardsVarNames.h>

Inheritance diagram for RichardsVarNames:
[legend]

Public Member Functions

 RichardsVarNames (const InputParameters &parameters)
 
void initialize ()
 
void execute ()
 
void finalize ()
 
unsigned int num_v () const
 the number of porepressure variables More...
 
unsigned int richards_var_num (unsigned int moose_var_num) const
 the richards variable number More...
 
bool not_richards_var (unsigned int moose_var_num) const
 returns true if moose_var_num is not a richards var More...
 
std::string richards_names () const
 a space-separated string of richards variable names eg richards_names() = 'pwater pgas' More...
 
const VariableValue * richards_vals (unsigned int richards_var_num) const
 a vector of pointers to VariableValues More...
 
const VariableValue * richards_vals_old (unsigned int richards_var_num) const
 a vector of pointers to old VariableValues More...
 
const VariableGradient * grad_var (unsigned int richards_var_num) const
 a vector of pointers to grad(Variable) More...
 
const VariableValue * nodal_var (unsigned int richards_var_num) const
 The nodal variable values for the given richards_var_num To extract a the value of pressure variable "pvar", at node i, use (*RichardsVarNames.nodal_var(pvar))[i]. More...
 
const VariableValue * nodal_var_old (unsigned int richards_var_num) const
 The old nodal variable values for the given richards_var_num. More...
 
std::string var_types () const
 return the _var_types string More...
 

Protected Attributes

unsigned int _num_v
 number of richards variables More...
 
MooseEnum _var_types
 physical meaning of the variables. Eg 'pppp' means 'all variables are pressure variables' More...
 
std::vector< unsigned int > _moose_var_num
 _moose_var_num[i] = the moose variable number corresponding to richards variable i More...
 
std::vector< unsigned int > _ps_var_num
 _pressure_var_num[i] = the richards variable corresponding to moose variable i More...
 
std::vector< const VariableValue * > _moose_var_value
 moose_var_value[i] = values of richards variable i More...
 
std::vector< const VariableValue * > _moose_var_value_old
 moose_var_value_old[i] = old values of richards variable i More...
 
std::vector< const VariableValue * > _moose_nodal_var_value
 moose_var_value[i] = values of richards variable i More...
 
std::vector< const VariableValue * > _moose_nodal_var_value_old
 moose_var_value_old[i] = old values of richards variable i More...
 
std::vector< const VariableGradient * > _moose_grad_var
 moose_grad_var[i] = gradient values of richards variable i More...
 

Detailed Description

This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels, etc, and the variable number used internally by MOOSE.

Definition at line 26 of file RichardsVarNames.h.

Constructor & Destructor Documentation

◆ RichardsVarNames()

RichardsVarNames::RichardsVarNames ( const InputParameters &  parameters)

Definition at line 38 of file RichardsVarNames.C.

39  : GeneralUserObject(parameters),
40  Coupleable(this, false),
41  _num_v(coupledComponents("richards_vars")),
42  _var_types(getParam<MooseEnum>("var_types"))
43 {
44  unsigned int max_moose_var_num_seen = 0;
45 
46  _moose_var_num.resize(_num_v);
47  _moose_var_value.resize(_num_v);
51  _moose_grad_var.resize(_num_v);
52  for (unsigned int i = 0; i < _num_v; ++i)
53  {
54  _moose_var_num[i] = coupled("richards_vars", i);
55  max_moose_var_num_seen =
56  (max_moose_var_num_seen > _moose_var_num[i] ? max_moose_var_num_seen : _moose_var_num[i]);
57  _moose_var_value[i] = &coupledValue("richards_vars", i); // coupledValue returns a reference (an
58  // alias) to a VariableValue, and the &
59  // turns it into a pointer
60  _moose_var_value_old[i] = (_is_transient ? &coupledValueOld("richards_vars", i) : &_zero);
61  _moose_nodal_var_value[i] = &coupledNodalValue("richards_vars", i); // coupledNodalValue returns
62  // a reference (an alias) to
63  // a VariableValue, and the
64  // & turns it into a pointer
66  (_is_transient ? &coupledNodalValueOld("richards_vars", i) : &_zero);
67  _moose_grad_var[i] = &coupledGradient("richards_vars", i);
68  }
69 
70  _ps_var_num.resize(max_moose_var_num_seen + 1);
71  for (unsigned int i = 0; i < max_moose_var_num_seen + 1; ++i)
72  _ps_var_num[i] = _num_v; // NOTE: indicates that i is not a richards variable
73  for (unsigned int i = 0; i < _num_v; ++i)
75 }
std::vector< const VariableValue * > _moose_nodal_var_value
moose_var_value[i] = values of richards variable i
std::vector< const VariableValue * > _moose_nodal_var_value_old
moose_var_value_old[i] = old values of richards variable i
std::vector< unsigned int > _moose_var_num
_moose_var_num[i] = the moose variable number corresponding to richards variable i ...
std::vector< const VariableValue * > _moose_var_value
moose_var_value[i] = values of richards variable i
std::vector< unsigned int > _ps_var_num
_pressure_var_num[i] = the richards variable corresponding to moose variable i
std::vector< const VariableGradient * > _moose_grad_var
moose_grad_var[i] = gradient values of richards variable i
MooseEnum _var_types
physical meaning of the variables. Eg &#39;pppp&#39; means &#39;all variables are pressure variables&#39; ...
unsigned int _num_v
number of richards variables
std::vector< const VariableValue * > _moose_var_value_old
moose_var_value_old[i] = old values of richards variable i

Member Function Documentation

◆ execute()

void RichardsVarNames::execute ( )

Definition at line 83 of file RichardsVarNames.C.

84 {
85 }

◆ finalize()

void RichardsVarNames::finalize ( )

Definition at line 88 of file RichardsVarNames.C.

89 {
90 }

◆ grad_var()

const VariableGradient * RichardsVarNames::grad_var ( unsigned int  richards_var_num) const

a vector of pointers to grad(Variable)

Parameters
richards_var_numthe richards variable number eg if richards_vars = 'pwater pgas', then (*grad_var(1))[qp] = grad(pgas) evaluated at quadpoint qp Also grad_var(i) = &coupledGradient

Definition at line 130 of file RichardsVarNames.C.

Referenced by RichardsMaterial::computePandSeff().

131 {
133 }
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
std::vector< const VariableGradient * > _moose_grad_var
moose_grad_var[i] = gradient values of richards variable i

◆ initialize()

void RichardsVarNames::initialize ( )

Definition at line 78 of file RichardsVarNames.C.

79 {
80 }

◆ nodal_var()

const VariableValue * RichardsVarNames::nodal_var ( unsigned int  richards_var_num) const

The nodal variable values for the given richards_var_num To extract a the value of pressure variable "pvar", at node i, use (*RichardsVarNames.nodal_var(pvar))[i].

Parameters
richards_var_numthe richards variable number

Definition at line 142 of file RichardsVarNames.C.

Referenced by RichardsBorehole::RichardsBorehole(), RichardsFullyUpwindFlux::RichardsFullyUpwindFlux(), RichardsLumpedMassChange::RichardsLumpedMassChange(), and RichardsPiecewiseLinearSink::RichardsPiecewiseLinearSink().

143 {
145 }
std::vector< const VariableValue * > _moose_nodal_var_value
moose_var_value[i] = values of richards variable i
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number

◆ nodal_var_old()

const VariableValue * RichardsVarNames::nodal_var_old ( unsigned int  richards_var_num) const

The old nodal variable values for the given richards_var_num.

Parameters
richards_var_numthe richards variable number

Definition at line 148 of file RichardsVarNames.C.

Referenced by RichardsLumpedMassChange::RichardsLumpedMassChange().

149 {
151 }
std::vector< const VariableValue * > _moose_nodal_var_value_old
moose_var_value_old[i] = old values of richards variable i
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number

◆ not_richards_var()

bool RichardsVarNames::not_richards_var ( unsigned int  moose_var_num) const

returns true if moose_var_num is not a richards var

Parameters
moose_var_numthe MOOSE variable number eg if richards_vars = 'pwater pgas', and the variables in the simulation are 'temperature pwater pgas displacement' then not_pressure_var(0) = true, no_pressure_var(1) = false

Definition at line 109 of file RichardsVarNames.C.

Referenced by RichardsFlux::computeQpOffDiagJacobian(), RichardsMassChange::computeQpOffDiagJacobian(), RichardsHalfGaussianSink::computeQpOffDiagJacobian(), RichardsLumpedMassChange::computeQpOffDiagJacobian(), RichardsPolyLineSink::computeQpOffDiagJacobian(), RichardsPiecewiseLinearSink::computeQpOffDiagJacobian(), RichardsBorehole::computeQpOffDiagJacobian(), and RichardsFullyUpwindFlux::upwind().

110 {
111  if (moose_var_num >= _ps_var_num.size() || _ps_var_num[moose_var_num] == _num_v)
112  return true;
113  return false;
114 }
std::vector< unsigned int > _ps_var_num
_pressure_var_num[i] = the richards variable corresponding to moose variable i
unsigned int _num_v
number of richards variables

◆ num_v()

unsigned int RichardsVarNames::num_v ( ) const

the number of porepressure variables

Definition at line 93 of file RichardsVarNames.C.

94 {
95  return _num_v;
96 }
unsigned int _num_v
number of richards variables

◆ richards_names()

std::string RichardsVarNames::richards_names ( ) const

a space-separated string of richards variable names eg richards_names() = 'pwater pgas'

◆ richards_vals()

const VariableValue * RichardsVarNames::richards_vals ( unsigned int  richards_var_num) const

a vector of pointers to VariableValues

Parameters
richards_var_numthe pressure variable number eg if richards_vars = 'pwater pgas', then (*richards_vals(1))[qp] = pgas evaluated at quadpoint qp Also richards_vals(i) = &coupledValue

Definition at line 117 of file RichardsVarNames.C.

Referenced by RichardsMaterial::computePandSeff().

118 {
119  return _moose_var_value[richards_var_num]; // moose_var_value is a vector of pointers to
120  // VariableValuees
121 }
std::vector< const VariableValue * > _moose_var_value
moose_var_value[i] = values of richards variable i
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number

◆ richards_vals_old()

const VariableValue * RichardsVarNames::richards_vals_old ( unsigned int  richards_var_num) const

a vector of pointers to old VariableValues

Parameters
richards_var_numthe richards variable number eg if richards_vars = 'pwater pgas', then (*richards_vals_old(1))[qp] = old pgas evaluated at quadpoint qp Also richards_vals_old(i) = &coupledValueOld

Definition at line 124 of file RichardsVarNames.C.

Referenced by RichardsMaterial::computePandSeff().

125 {
127 }
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
std::vector< const VariableValue * > _moose_var_value_old
moose_var_value_old[i] = old values of richards variable i

◆ richards_var_num()

unsigned int RichardsVarNames::richards_var_num ( unsigned int  moose_var_num) const

the richards variable number

Parameters
moose_var_numthe MOOSE variable number eg if richards_vars = 'pwater pgas', and the variables in the simulation are 'temperature pwater pgas displacement' then richards_var_num(2) = 1

Definition at line 99 of file RichardsVarNames.C.

Referenced by RichardsFlux::computeQpOffDiagJacobian(), RichardsMassChange::computeQpOffDiagJacobian(), RichardsHalfGaussianSink::computeQpOffDiagJacobian(), RichardsLumpedMassChange::computeQpOffDiagJacobian(), RichardsPolyLineSink::computeQpOffDiagJacobian(), RichardsPiecewiseLinearSink::computeQpOffDiagJacobian(), RichardsBorehole::computeQpOffDiagJacobian(), grad_var(), nodal_var(), nodal_var_old(), richards_vals(), richards_vals_old(), and RichardsFullyUpwindFlux::upwind().

100 {
101  if (moose_var_num >= _ps_var_num.size() || _ps_var_num[moose_var_num] == _num_v)
102  mooseError("The moose variable with number ",
103  moose_var_num,
104  " is not a richards according to the RichardsVarNames UserObject");
105  return _ps_var_num[moose_var_num];
106 }
std::vector< unsigned int > _ps_var_num
_pressure_var_num[i] = the richards variable corresponding to moose variable i
unsigned int _num_v
number of richards variables

◆ var_types()

std::string RichardsVarNames::var_types ( ) const

return the _var_types string

Definition at line 136 of file RichardsVarNames.C.

Referenced by RichardsMaterial::computePandSeff().

137 {
138  return _var_types;
139 }
MooseEnum _var_types
physical meaning of the variables. Eg &#39;pppp&#39; means &#39;all variables are pressure variables&#39; ...

Member Data Documentation

◆ _moose_grad_var

std::vector<const VariableGradient *> RichardsVarNames::_moose_grad_var
protected

moose_grad_var[i] = gradient values of richards variable i

Definition at line 134 of file RichardsVarNames.h.

Referenced by grad_var(), and RichardsVarNames().

◆ _moose_nodal_var_value

std::vector<const VariableValue *> RichardsVarNames::_moose_nodal_var_value
protected

moose_var_value[i] = values of richards variable i

Definition at line 128 of file RichardsVarNames.h.

Referenced by nodal_var(), and RichardsVarNames().

◆ _moose_nodal_var_value_old

std::vector<const VariableValue *> RichardsVarNames::_moose_nodal_var_value_old
protected

moose_var_value_old[i] = old values of richards variable i

Definition at line 131 of file RichardsVarNames.h.

Referenced by nodal_var_old(), and RichardsVarNames().

◆ _moose_var_num

std::vector<unsigned int> RichardsVarNames::_moose_var_num
protected

_moose_var_num[i] = the moose variable number corresponding to richards variable i

Definition at line 114 of file RichardsVarNames.h.

Referenced by RichardsVarNames().

◆ _moose_var_value

std::vector<const VariableValue *> RichardsVarNames::_moose_var_value
protected

moose_var_value[i] = values of richards variable i

Definition at line 121 of file RichardsVarNames.h.

Referenced by richards_vals(), and RichardsVarNames().

◆ _moose_var_value_old

std::vector<const VariableValue *> RichardsVarNames::_moose_var_value_old
protected

moose_var_value_old[i] = old values of richards variable i

Definition at line 124 of file RichardsVarNames.h.

Referenced by richards_vals_old(), and RichardsVarNames().

◆ _num_v

unsigned int RichardsVarNames::_num_v
protected

number of richards variables

Definition at line 108 of file RichardsVarNames.h.

Referenced by not_richards_var(), num_v(), richards_var_num(), and RichardsVarNames().

◆ _ps_var_num

std::vector<unsigned int> RichardsVarNames::_ps_var_num
protected

_pressure_var_num[i] = the richards variable corresponding to moose variable i

Definition at line 117 of file RichardsVarNames.h.

Referenced by not_richards_var(), richards_var_num(), and RichardsVarNames().

◆ _var_types

MooseEnum RichardsVarNames::_var_types
protected

physical meaning of the variables. Eg 'pppp' means 'all variables are pressure variables'

Definition at line 111 of file RichardsVarNames.h.

Referenced by var_types().


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