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.nodalSln()[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 30 of file RichardsLumpedMassChange.h.

Constructor & Destructor Documentation

RichardsLumpedMassChange::RichardsLumpedMassChange ( const InputParameters &  parameters)

Definition at line 39 of file RichardsLumpedMassChange.C.

40  : TimeKernel(parameters),
41  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
44 
45  _porosity(getMaterialProperty<Real>("porosity")),
46  _porosity_old(getMaterialProperty<Real>("porosity_old")),
47 
48  // in the following: first get the userobject names that were inputted, then get the _pvar one
49  // of these, then get the actual userobject that this corresponds to, then finally & gives
50  // pointer to RichardsDensity (or whatever) object.
51  _seff_UO(&getUserObjectByName<RichardsSeff>(
52  getParam<std::vector<UserObjectName>>("seff_UO")[_pvar])),
53  _sat_UO(
54  &getUserObjectByName<RichardsSat>(getParam<std::vector<UserObjectName>>("sat_UO")[_pvar])),
55  _density_UO(&getUserObjectByName<RichardsDensity>(
56  getParam<std::vector<UserObjectName>>("density_UO")[_pvar]))
57 {
58  _ps_at_nodes.resize(_num_p);
59  _ps_old_at_nodes.resize(_num_p);
60 
61  for (unsigned int pnum = 0; pnum < _num_p; ++pnum)
62  {
65  }
66 
67  _dseff.resize(_num_p);
68 }
const VariableValue * nodal_var_old(unsigned int richards_var_num) const
The old nodal variable values for the given richards_var_num.
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
const RichardsDensity * _density_UO
The userobject that computes fluid density (as a function of the porepressure)
unsigned int num_v() const
the number of porepressure variables
const RichardsSeff * _seff_UO
The userobject that computes effective saturation (as a function of porepressure(s)) for this variabl...
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
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.
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const MaterialProperty< Real > & _porosity
current value of the porosity

Member Function Documentation

Real RichardsLumpedMassChange::computeQpJacobian ( )
protectedvirtual

Definition at line 89 of file RichardsLumpedMassChange.C.

90 {
91  if (_i != _j)
92  return 0.0;
93 
94  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
95  const Real ddensity = (*_density_UO).ddensity((*_ps_at_nodes[_pvar])[_i]);
96 
97  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
98  (*_seff_UO).dseff(_ps_at_nodes, _i, _dseff);
99 
100  const Real sat = (*_sat_UO).sat(seff);
101  const Real dsat = (*_sat_UO).dsat(seff);
102 
103  const Real mass_prime = _porosity[_qp] * (ddensity * sat + density * _dseff[_pvar] * dsat);
104 
105  return _test[_i][_qp] * mass_prime / _dt;
106 }
const std::string density
Definition: NS.h:15
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
Real RichardsLumpedMassChange::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 109 of file RichardsLumpedMassChange.C.

110 {
112  return 0.0;
113  if (_i != _j)
114  return 0.0;
115  const unsigned int dvar = _richards_name_UO.richards_var_num(jvar);
116 
117  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
118 
119  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
120  (*_seff_UO).dseff(_ps_at_nodes, _i, _dseff);
121 
122  const Real dsat = (*_sat_UO).dsat(seff);
123 
124  const Real mass_prime = _porosity[_qp] * density * _dseff[dvar] * dsat;
125 
126  return _test[_i][_qp] * mass_prime / _dt;
127 }
const std::string density
Definition: NS.h:15
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...
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.
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const MaterialProperty< Real > & _porosity
current value of the porosity
Real RichardsLumpedMassChange::computeQpResidual ( )
protectedvirtual

Definition at line 71 of file RichardsLumpedMassChange.C.

72 {
73  // current values:
74  const Real density = (*_density_UO).density((*_ps_at_nodes[_pvar])[_i]);
75  const Real seff = (*_seff_UO).seff(_ps_at_nodes, _i);
76  const Real sat = (*_sat_UO).sat(seff);
77  const Real mass = _porosity[_qp] * density * sat;
78 
79  // old values:
80  const Real density_old = (*_density_UO).density((*_ps_old_at_nodes[_pvar])[_i]);
81  const Real seff_old = (*_seff_UO).seff(_ps_old_at_nodes, _i);
82  const Real sat_old = (*_sat_UO).sat(seff_old);
83  const Real mass_old = _porosity_old[_qp] * density_old * sat_old;
84 
85  return _test[_i][_qp] * (mass - mass_old) / _dt;
86 }
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:15
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

const RichardsDensity* RichardsLumpedMassChange::_density_UO
protected

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

Definition at line 73 of file RichardsLumpedMassChange.h.

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

holds nodal values of d(Seff)/dP_i

Definition at line 87 of file RichardsLumpedMassChange.h.

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

unsigned int RichardsLumpedMassChange::_num_p
protected

number of richards variables

Definition at line 49 of file RichardsLumpedMassChange.h.

Referenced by RichardsLumpedMassChange().

const MaterialProperty<Real>& RichardsLumpedMassChange::_porosity
protected

current value of the porosity

Definition at line 61 of file RichardsLumpedMassChange.h.

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

const MaterialProperty<Real>& RichardsLumpedMassChange::_porosity_old
protected

value of the porosity at the start of the timestep

Definition at line 64 of file RichardsLumpedMassChange.h.

Referenced by computeQpResidual().

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.nodalSln()[i].

Definition at line 81 of file RichardsLumpedMassChange.h.

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

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 84 of file RichardsLumpedMassChange.h.

Referenced by computeQpResidual(), and RichardsLumpedMassChange().

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 58 of file RichardsLumpedMassChange.h.

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

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 46 of file RichardsLumpedMassChange.h.

Referenced by computeQpOffDiagJacobian(), and RichardsLumpedMassChange().

const RichardsSat* RichardsLumpedMassChange::_sat_UO
protected

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

Definition at line 70 of file RichardsLumpedMassChange.h.

const RichardsSeff* RichardsLumpedMassChange::_seff_UO
protected

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

Definition at line 67 of file RichardsLumpedMassChange.h.


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