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

d(fluid mass in porespace)/dt with the fluid mass being lumped to the nodes. More...

#include <RichardsLumpedMassChange.h>

Inheritance diagram for RichardsLumpedMassChange:
[legend]

Public Member Functions

 RichardsLumpedMassChange (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const RichardsVarNames_richards_name_UO
 holds info regarding the names of the Richards variables and methods for extracting values of these variables More...
 
unsigned int _num_p
 number of richards variables More...
 
unsigned int _pvar
 the index of this variable in the list of Richards variables held by _richards_name_UO. More...
 
const MaterialProperty< Real > & _porosity
 current value of the porosity More...
 
const MaterialProperty< Real > & _porosity_old
 value of the porosity at the start of the timestep More...
 
const RichardsSeff_seff_UO
 The userobject that computes effective saturation (as a function of porepressure(s)) for this variable. More...
 
const RichardsSat_sat_UO
 The userobject that computes saturation (as a function of effective saturation) for this variable. More...
 
const RichardsDensity_density_UO
 The userobject that computes fluid density (as a function of the porepressure) More...
 
std::vector< const VariableValue * > _ps_at_nodes
 Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to this variable's nodal porepressure values So: (*_ps_at_nodes[_pvar])[i] = _var.dofValues()[i]. More...
 
std::vector< const VariableValue * > _ps_old_at_nodes
 Holds the nodal values of pressures at timestep_begin, in same way as _ps_at_nodes. More...
 
std::vector< Real > _dseff
 holds nodal values of d(Seff)/dP_i More...
 

Detailed Description

d(fluid mass in porespace)/dt with the fluid mass being lumped to the nodes.

Usually this is better to use than a non-lumped version because it prevents unphysical oscillations.

Definition at line 32 of file RichardsLumpedMassChange.h.

Constructor & Destructor Documentation

◆ RichardsLumpedMassChange()

RichardsLumpedMassChange::RichardsLumpedMassChange ( const InputParameters &  parameters)

Definition at line 43 of file RichardsLumpedMassChange.C.

44  : TimeKernel(parameters),
45  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
48 
49  _porosity(getMaterialProperty<Real>("porosity")),
50  _porosity_old(getMaterialProperty<Real>("porosity_old")),
51 
52  // in the following: first get the userobject names that were inputted, then get the _pvar one
53  // of these, then get the actual userobject that this corresponds to, then finally & gives
54  // pointer to RichardsDensity (or whatever) object.
55  _seff_UO(&getUserObjectByName<RichardsSeff>(
56  getParam<std::vector<UserObjectName>>("seff_UO")[_pvar])),
57  _sat_UO(
58  &getUserObjectByName<RichardsSat>(getParam<std::vector<UserObjectName>>("sat_UO")[_pvar])),
59  _density_UO(&getUserObjectByName<RichardsDensity>(
60  getParam<std::vector<UserObjectName>>("density_UO")[_pvar]))
61 {
62  _ps_at_nodes.resize(_num_p);
63  _ps_old_at_nodes.resize(_num_p);
64 
65  for (unsigned int pnum = 0; pnum < _num_p; ++pnum)
66  {
69  }
70 
71  _dseff.resize(_num_p);
72 }
std::vector< const VariableValue * > _ps_old_at_nodes
Holds the nodal values of pressures at timestep_begin, in same way as _ps_at_nodes.
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 ...
const RichardsSat * _sat_UO
The userobject that computes saturation (as a function of effective saturation) for this variable...
const MaterialProperty< Real > & _porosity_old
value of the porosity at the start of the timestep
unsigned int num_v() const
the number of porepressure variables
const RichardsDensity * _density_UO
The userobject that computes fluid density (as a function of the porepressure)
const RichardsSeff * _seff_UO
The userobject that computes effective saturation (as a function of porepressure(s)) for this variabl...
const VariableValue * nodal_var_old(unsigned int richards_var_num) const
The old nodal variable values for the given richards_var_num.
const RichardsVarNames & _richards_name_UO
holds info regarding the names of the Richards variables and methods for extracting values of these v...
unsigned int _num_p
number of richards variables
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to...
std::vector< Real > _dseff
holds nodal values of d(Seff)/dP_i
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
const MaterialProperty< Real > & _porosity
current value of the porosity

Member Function Documentation

◆ computeQpJacobian()

Real RichardsLumpedMassChange::computeQpJacobian ( )
protectedvirtual

Definition at line 93 of file RichardsLumpedMassChange.C.

94 {
95  if (_i != _j)
96  return 0.0;
97 
98  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
99  const Real ddensity = (*_density_UO).ddensity((*_ps_at_nodes[_pvar])[_i]);
100 
101  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
102  (*_seff_UO).dseff(_ps_at_nodes, _i, _dseff);
103 
104  const Real sat = (*_sat_UO).sat(seff);
105  const Real dsat = (*_sat_UO).dsat(seff);
106 
107  const Real mass_prime = _porosity[_qp] * (ddensity * sat + density * _dseff[_pvar] * dsat);
108 
109  return _test[_i][_qp] * mass_prime / _dt;
110 }
const std::string density
Definition: NS.h:17
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to...
std::vector< Real > _dseff
holds nodal values of d(Seff)/dP_i
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
const MaterialProperty< Real > & _porosity
current value of the porosity

◆ computeQpOffDiagJacobian()

Real RichardsLumpedMassChange::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 113 of file RichardsLumpedMassChange.C.

114 {
116  return 0.0;
117  if (_i != _j)
118  return 0.0;
119  const unsigned int dvar = _richards_name_UO.richards_var_num(jvar);
120 
121  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
122 
123  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
124  (*_seff_UO).dseff(_ps_at_nodes, _i, _dseff);
125 
126  const Real dsat = (*_sat_UO).dsat(seff);
127 
128  const Real mass_prime = _porosity[_qp] * density * _dseff[dvar] * dsat;
129 
130  return _test[_i][_qp] * mass_prime / _dt;
131 }
const std::string density
Definition: NS.h:17
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
const RichardsVarNames & _richards_name_UO
holds info regarding the names of the Richards variables and methods for extracting values of these v...
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to...
std::vector< Real > _dseff
holds nodal values of d(Seff)/dP_i
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
const MaterialProperty< Real > & _porosity
current value of the porosity

◆ computeQpResidual()

Real RichardsLumpedMassChange::computeQpResidual ( )
protectedvirtual

Definition at line 75 of file RichardsLumpedMassChange.C.

76 {
77  // current values:
78  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
79  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
80  const Real sat = (*_sat_UO).sat(seff);
81  const Real mass = _porosity[_qp] * density * sat;
82 
83  // old values:
84  const Real density_old = (*_density_UO).density((*_ps_old_at_nodes[_pvar])[_i]);
85  const Real seff_old = (*_seff_UO).seff(_ps_old_at_nodes, _i);
86  const Real sat_old = (*_sat_UO).sat(seff_old);
87  const Real mass_old = _porosity_old[_qp] * density_old * sat_old;
88 
89  return _test[_i][_qp] * (mass - mass_old) / _dt;
90 }
std::vector< const VariableValue * > _ps_old_at_nodes
Holds the nodal values of pressures at timestep_begin, in same way as _ps_at_nodes.
const std::string density
Definition: NS.h:17
const MaterialProperty< Real > & _porosity_old
value of the porosity at the start of the timestep
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to...
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
const MaterialProperty< Real > & _porosity
current value of the porosity

Member Data Documentation

◆ _density_UO

const RichardsDensity* RichardsLumpedMassChange::_density_UO
protected

The userobject that computes fluid density (as a function of the porepressure)

Definition at line 75 of file RichardsLumpedMassChange.h.

◆ _dseff

std::vector<Real> RichardsLumpedMassChange::_dseff
protected

holds nodal values of d(Seff)/dP_i

Definition at line 89 of file RichardsLumpedMassChange.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and RichardsLumpedMassChange().

◆ _num_p

unsigned int RichardsLumpedMassChange::_num_p
protected

number of richards variables

Definition at line 51 of file RichardsLumpedMassChange.h.

Referenced by RichardsLumpedMassChange().

◆ _porosity

const MaterialProperty<Real>& RichardsLumpedMassChange::_porosity
protected

current value of the porosity

Definition at line 63 of file RichardsLumpedMassChange.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _porosity_old

const MaterialProperty<Real>& RichardsLumpedMassChange::_porosity_old
protected

value of the porosity at the start of the timestep

Definition at line 66 of file RichardsLumpedMassChange.h.

Referenced by computeQpResidual().

◆ _ps_at_nodes

std::vector<const VariableValue *> RichardsLumpedMassChange::_ps_at_nodes
protected

Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to this variable's nodal porepressure values So: (*_ps_at_nodes[_pvar])[i] = _var.dofValues()[i].

Definition at line 83 of file RichardsLumpedMassChange.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), computeQpResidual(), and RichardsLumpedMassChange().

◆ _ps_old_at_nodes

std::vector<const VariableValue *> RichardsLumpedMassChange::_ps_old_at_nodes
protected

Holds the nodal values of pressures at timestep_begin, in same way as _ps_at_nodes.

Definition at line 86 of file RichardsLumpedMassChange.h.

Referenced by computeQpResidual(), and RichardsLumpedMassChange().

◆ _pvar

unsigned int RichardsLumpedMassChange::_pvar
protected

the index of this variable in the list of Richards variables held by _richards_name_UO.

Eg if richards_vars = 'pwater pgas poil' in the _richards_name_UO and this kernel has variable = pgas, then _pvar = 1 This is used to index correctly into seff_UO, sat_UO, density_UO, etc.

Definition at line 60 of file RichardsLumpedMassChange.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _richards_name_UO

const RichardsVarNames& RichardsLumpedMassChange::_richards_name_UO
protected

holds info regarding the names of the Richards variables and methods for extracting values of these variables

Definition at line 48 of file RichardsLumpedMassChange.h.

Referenced by computeQpOffDiagJacobian(), and RichardsLumpedMassChange().

◆ _sat_UO

const RichardsSat* RichardsLumpedMassChange::_sat_UO
protected

The userobject that computes saturation (as a function of effective saturation) for this variable.

Definition at line 72 of file RichardsLumpedMassChange.h.

◆ _seff_UO

const RichardsSeff* RichardsLumpedMassChange::_seff_UO
protected

The userobject that computes effective saturation (as a function of porepressure(s)) for this variable.

Definition at line 69 of file RichardsLumpedMassChange.h.


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