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

Kernel = grad(permeability*relativepermeability/viscosity * (grad(pressure) - density*gravity)) This is mass flow according to the Richards equation. More...

#include <RichardsFlux.h>

Inheritance diagram for RichardsFlux:
[legend]

Public Member Functions

 RichardsFlux (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
Real computeQpJac (unsigned int wrt_num)
 Computes diagonal and off-diagonal jacobian entries. More...
 

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 _pvar
 the index of this variable in the list of Richards variables held by _richards_name_UO. More...
 
const MaterialProperty< std::vector< RealVectorValue > > & _flux
 Richards flux. More...
 
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dflux_dv
 d(Richards flux_i)/d(variable_j), here flux_i is the i_th flux, which is itself a RealVectorValue More...
 
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dflux_dgradv
 d(Richards flux_i)/d(grad(variable_j)), here flux_i is the i_th flux, which is itself a RealVectorValue More...
 
const MaterialProperty< std::vector< std::vector< std::vector< RealVectorValue > > > > & _d2flux_dvdv
 d^2(Richards flux_i)/d(variable_j)/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue More...
 
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dgradvdv
 d^2(Richards flux_i)/d(grad(variable_j))/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue More...
 
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dvdgradv
 d^2(Richards flux_i)/d(variable_j)/d(grad(variable_k)), here flux_i is the i_th flux, which is itself a RealVectorValue More...
 
const VariableSecond & _second_u
 grad_i grad_j porepressure. This is used in SUPG More...
 
const VariablePhiSecond & _second_phi
 interpolation function for the _second_u More...
 
const MaterialProperty< std::vector< RealVectorValue > > & _tauvel_SUPG
 SUPGtau*SUPGvel (a vector of these if multiphase) More...
 
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dtauvel_SUPG_dgradv
 derivative of SUPGtau*SUPGvel_i wrt grad(variable_j) More...
 
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dtauvel_SUPG_dv
 derivative of SUPGtau*SUPGvel_i wrt variable_j More...
 

Detailed Description

Kernel = grad(permeability*relativepermeability/viscosity * (grad(pressure) - density*gravity)) This is mass flow according to the Richards equation.

Definition at line 26 of file RichardsFlux.h.

Constructor & Destructor Documentation

◆ RichardsFlux()

RichardsFlux::RichardsFlux ( const InputParameters &  parameters)

Definition at line 35 of file RichardsFlux.C.

36  : Kernel(parameters),
37  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
39 
40  // This kernel gets lots of things from the material
41  _flux(getMaterialProperty<std::vector<RealVectorValue>>("flux")),
42  _dflux_dv(getMaterialProperty<std::vector<std::vector<RealVectorValue>>>("dflux_dv")),
43  _dflux_dgradv(getMaterialProperty<std::vector<std::vector<RealTensorValue>>>("dflux_dgradv")),
45  getMaterialProperty<std::vector<std::vector<std::vector<RealVectorValue>>>>("d2flux_dvdv")),
46  _d2flux_dgradvdv(getMaterialProperty<std::vector<std::vector<std::vector<RealTensorValue>>>>(
47  "d2flux_dgradvdv")),
48  _d2flux_dvdgradv(getMaterialProperty<std::vector<std::vector<std::vector<RealTensorValue>>>>(
49  "d2flux_dvdgradv")),
50 
51  _second_u(getParam<bool>("linear_shape_fcns")
52  ? _second_zero
53  : (_is_implicit ? _var.secondSln() : _var.secondSlnOld())),
54  _second_phi(getParam<bool>("linear_shape_fcns") ? _second_phi_zero : secondPhi()),
55 
56  _tauvel_SUPG(getMaterialProperty<std::vector<RealVectorValue>>("tauvel_SUPG")),
58  getMaterialProperty<std::vector<std::vector<RealTensorValue>>>("dtauvel_SUPG_dgradv")),
60  getMaterialProperty<std::vector<std::vector<RealVectorValue>>>("dtauvel_SUPG_dv"))
61 {
62 }
const MaterialProperty< std::vector< std::vector< std::vector< RealVectorValue > > > > & _d2flux_dvdv
d^2(Richards flux_i)/d(variable_j)/d(variable_k), here flux_i is the i_th flux, which is itself a Rea...
Definition: RichardsFlux.h:63
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
Definition: RichardsFlux.h:51
const MaterialProperty< std::vector< RealVectorValue > > & _tauvel_SUPG
SUPGtau*SUPGvel (a vector of these if multiphase)
Definition: RichardsFlux.h:78
const RichardsVarNames & _richards_name_UO
holds info regarding the names of the Richards variables and methods for extracting values of these v...
Definition: RichardsFlux.h:42
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dflux_dgradv
d(Richards flux_i)/d(grad(variable_j)), here flux_i is the i_th flux, which is itself a RealVectorVal...
Definition: RichardsFlux.h:60
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dtauvel_SUPG_dgradv
derivative of SUPGtau*SUPGvel_i wrt grad(variable_j)
Definition: RichardsFlux.h:81
const VariablePhiSecond & _second_phi
interpolation function for the _second_u
Definition: RichardsFlux.h:75
const MaterialProperty< std::vector< RealVectorValue > > & _flux
Richards flux.
Definition: RichardsFlux.h:54
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dflux_dv
d(Richards flux_i)/d(variable_j), here flux_i is the i_th flux, which is itself a RealVectorValue ...
Definition: RichardsFlux.h:57
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const VariableSecond & _second_u
grad_i grad_j porepressure. This is used in SUPG
Definition: RichardsFlux.h:72
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dtauvel_SUPG_dv
derivative of SUPGtau*SUPGvel_i wrt variable_j
Definition: RichardsFlux.h:84
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dvdgradv
d^2(Richards flux_i)/d(variable_j)/d(grad(variable_k)), here flux_i is the i_th flux, which is itself a RealVectorValue
Definition: RichardsFlux.h:69
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dgradvdv
d^2(Richards flux_i)/d(grad(variable_j))/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue
Definition: RichardsFlux.h:66

Member Function Documentation

◆ computeQpJac()

Real RichardsFlux::computeQpJac ( unsigned int  wrt_num)
protected

Computes diagonal and off-diagonal jacobian entries.

Since the code is almost identical for both cases it's better to use just one function

Parameters
wrt_numtake the derivative of the residual wrt this richards variable

Definition at line 87 of file RichardsFlux.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

88 {
89  Real flux_prime = _grad_test[_i][_qp] * (_dflux_dgradv[_qp][_pvar][wrt_num] * _grad_phi[_j][_qp] +
90  _dflux_dv[_qp][_pvar][wrt_num] * _phi[_j][_qp]);
91 
92  Real supg_test = _tauvel_SUPG[_qp][_pvar] * _grad_test[_i][_qp];
93  Real supg_test_prime =
94  _grad_phi[_j][_qp] * (_dtauvel_SUPG_dgradv[_qp][_pvar][wrt_num] * _grad_test[_i][_qp]) +
95  _phi[_j][_qp] * _dtauvel_SUPG_dv[_qp][_pvar][wrt_num] * _grad_test[_i][_qp];
96  Real supg_kernel = 0.0;
97  Real supg_kernel_prime = 0.0;
98 
99  if (supg_test != 0)
100  {
101  // NOTE: since Libmesh does not correctly calculate grad(_grad_u) correctly, so following might
102  // not be correct
103  supg_kernel = -(_dflux_dgradv[_qp][_pvar][_pvar] * _second_u[_qp]).tr() -
104  _dflux_dv[_qp][_pvar][_pvar] * _grad_u[_qp];
105 
106  // NOTE: just like supg_kernel, this must be generalised for non-PPPP formulations
107  supg_kernel_prime =
108  -(_d2flux_dvdv[_qp][_pvar][_pvar][wrt_num] * _phi[_j][_qp] * _grad_u[_qp] +
109  _phi[_j][_qp] * (_d2flux_dgradvdv[_qp][_pvar][_pvar][wrt_num] * _second_u[_qp]).tr() +
110  (_d2flux_dvdgradv[_qp][_pvar][_pvar][wrt_num] * _grad_u[_qp]) * _grad_phi[_j][_qp]);
111  if (wrt_num == _pvar)
112  supg_kernel_prime -= _dflux_dv[_qp][_pvar][_pvar] * _grad_phi[_j][_qp];
113  supg_kernel_prime -= (_dflux_dgradv[_qp][_pvar][_pvar] * _second_phi[_j][_qp]).tr();
114  }
115 
116  return flux_prime + supg_test_prime * supg_kernel + supg_test * supg_kernel_prime;
117 }
const MaterialProperty< std::vector< std::vector< std::vector< RealVectorValue > > > > & _d2flux_dvdv
d^2(Richards flux_i)/d(variable_j)/d(variable_k), here flux_i is the i_th flux, which is itself a Rea...
Definition: RichardsFlux.h:63
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
Definition: RichardsFlux.h:51
const MaterialProperty< std::vector< RealVectorValue > > & _tauvel_SUPG
SUPGtau*SUPGvel (a vector of these if multiphase)
Definition: RichardsFlux.h:78
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dflux_dgradv
d(Richards flux_i)/d(grad(variable_j)), here flux_i is the i_th flux, which is itself a RealVectorVal...
Definition: RichardsFlux.h:60
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dtauvel_SUPG_dgradv
derivative of SUPGtau*SUPGvel_i wrt grad(variable_j)
Definition: RichardsFlux.h:81
const VariablePhiSecond & _second_phi
interpolation function for the _second_u
Definition: RichardsFlux.h:75
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dflux_dv
d(Richards flux_i)/d(variable_j), here flux_i is the i_th flux, which is itself a RealVectorValue ...
Definition: RichardsFlux.h:57
const VariableSecond & _second_u
grad_i grad_j porepressure. This is used in SUPG
Definition: RichardsFlux.h:72
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dtauvel_SUPG_dv
derivative of SUPGtau*SUPGvel_i wrt variable_j
Definition: RichardsFlux.h:84
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dvdgradv
d^2(Richards flux_i)/d(variable_j)/d(grad(variable_k)), here flux_i is the i_th flux, which is itself a RealVectorValue
Definition: RichardsFlux.h:69
const MaterialProperty< std::vector< std::vector< std::vector< RealTensorValue > > > > & _d2flux_dgradvdv
d^2(Richards flux_i)/d(grad(variable_j))/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue
Definition: RichardsFlux.h:66

◆ computeQpJacobian()

Real RichardsFlux::computeQpJacobian ( )
protectedvirtual

Definition at line 120 of file RichardsFlux.C.

121 {
122  return computeQpJac(_pvar);
123 }
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
Definition: RichardsFlux.h:51
Real computeQpJac(unsigned int wrt_num)
Computes diagonal and off-diagonal jacobian entries.
Definition: RichardsFlux.C:87

◆ computeQpOffDiagJacobian()

Real RichardsFlux::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 126 of file RichardsFlux.C.

127 {
129  return 0.0;
130  unsigned int dvar = _richards_name_UO.richards_var_num(jvar);
131  return computeQpJac(dvar);
132 }
const RichardsVarNames & _richards_name_UO
holds info regarding the names of the Richards variables and methods for extracting values of these v...
Definition: RichardsFlux.h:42
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
Real computeQpJac(unsigned int wrt_num)
Computes diagonal and off-diagonal jacobian entries.
Definition: RichardsFlux.C:87
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number

◆ computeQpResidual()

Real RichardsFlux::computeQpResidual ( )
protectedvirtual

Definition at line 65 of file RichardsFlux.C.

66 {
67  Real flux_part = _grad_test[_i][_qp] * _flux[_qp][_pvar];
68 
69  Real supg_test = _tauvel_SUPG[_qp][_pvar] * _grad_test[_i][_qp];
70  Real supg_kernel = 0.0;
71  if (supg_test != 0)
72  // NOTE: Libmesh does not correctly calculate grad(_grad_u) correctly, so following might not be
73  // correct
74  // NOTE: The following is -divergence(flux)
75  // NOTE: The following must be generalised if a non PPPP formalism is used
76  // NOTE: The generalisation will look like
77  // supg_kernel = sum_j {-(_dflux_dgradv[_qp][_pvar][j]*_second_u[_qp][j]).tr() -
78  // _dflux_dv[_qp][_pvar][j]*_grad_u[_qp][j]}
79  // where _grad_u[_qp][j] is the gradient of the j^th variable at the quadpoint.
80  supg_kernel = -(_dflux_dgradv[_qp][_pvar][_pvar] * _second_u[_qp]).tr() -
81  _dflux_dv[_qp][_pvar][_pvar] * _grad_u[_qp];
82 
83  return flux_part + supg_test * supg_kernel;
84 }
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
Definition: RichardsFlux.h:51
const MaterialProperty< std::vector< RealVectorValue > > & _tauvel_SUPG
SUPGtau*SUPGvel (a vector of these if multiphase)
Definition: RichardsFlux.h:78
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dflux_dgradv
d(Richards flux_i)/d(grad(variable_j)), here flux_i is the i_th flux, which is itself a RealVectorVal...
Definition: RichardsFlux.h:60
const MaterialProperty< std::vector< RealVectorValue > > & _flux
Richards flux.
Definition: RichardsFlux.h:54
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dflux_dv
d(Richards flux_i)/d(variable_j), here flux_i is the i_th flux, which is itself a RealVectorValue ...
Definition: RichardsFlux.h:57
const VariableSecond & _second_u
grad_i grad_j porepressure. This is used in SUPG
Definition: RichardsFlux.h:72

Member Data Documentation

◆ _d2flux_dgradvdv

const MaterialProperty<std::vector<std::vector<std::vector<RealTensorValue> > > >& RichardsFlux::_d2flux_dgradvdv
protected

d^2(Richards flux_i)/d(grad(variable_j))/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue

Definition at line 66 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _d2flux_dvdgradv

const MaterialProperty<std::vector<std::vector<std::vector<RealTensorValue> > > >& RichardsFlux::_d2flux_dvdgradv
protected

d^2(Richards flux_i)/d(variable_j)/d(grad(variable_k)), here flux_i is the i_th flux, which is itself a RealVectorValue

Definition at line 69 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _d2flux_dvdv

const MaterialProperty<std::vector<std::vector<std::vector<RealVectorValue> > > >& RichardsFlux::_d2flux_dvdv
protected

d^2(Richards flux_i)/d(variable_j)/d(variable_k), here flux_i is the i_th flux, which is itself a RealVectorValue

Definition at line 63 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _dflux_dgradv

const MaterialProperty<std::vector<std::vector<RealTensorValue> > >& RichardsFlux::_dflux_dgradv
protected

d(Richards flux_i)/d(grad(variable_j)), here flux_i is the i_th flux, which is itself a RealVectorValue

Definition at line 60 of file RichardsFlux.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _dflux_dv

const MaterialProperty<std::vector<std::vector<RealVectorValue> > >& RichardsFlux::_dflux_dv
protected

d(Richards flux_i)/d(variable_j), here flux_i is the i_th flux, which is itself a RealVectorValue

Definition at line 57 of file RichardsFlux.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _dtauvel_SUPG_dgradv

const MaterialProperty<std::vector<std::vector<RealTensorValue> > >& RichardsFlux::_dtauvel_SUPG_dgradv
protected

derivative of SUPGtau*SUPGvel_i wrt grad(variable_j)

Definition at line 81 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _dtauvel_SUPG_dv

const MaterialProperty<std::vector<std::vector<RealVectorValue> > >& RichardsFlux::_dtauvel_SUPG_dv
protected

derivative of SUPGtau*SUPGvel_i wrt variable_j

Definition at line 84 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _flux

const MaterialProperty<std::vector<RealVectorValue> >& RichardsFlux::_flux
protected

Richards flux.

Definition at line 54 of file RichardsFlux.h.

Referenced by computeQpResidual().

◆ _pvar

unsigned int RichardsFlux::_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 _viscosity, _seff, etc

Definition at line 51 of file RichardsFlux.h.

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

◆ _richards_name_UO

const RichardsVarNames& RichardsFlux::_richards_name_UO
protected

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

Definition at line 42 of file RichardsFlux.h.

Referenced by computeQpOffDiagJacobian().

◆ _second_phi

const VariablePhiSecond& RichardsFlux::_second_phi
protected

interpolation function for the _second_u

Definition at line 75 of file RichardsFlux.h.

Referenced by computeQpJac().

◆ _second_u

const VariableSecond& RichardsFlux::_second_u
protected

grad_i grad_j porepressure. This is used in SUPG

Definition at line 72 of file RichardsFlux.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _tauvel_SUPG

const MaterialProperty<std::vector<RealVectorValue> >& RichardsFlux::_tauvel_SUPG
protected

SUPGtau*SUPGvel (a vector of these if multiphase)

Definition at line 78 of file RichardsFlux.h.

Referenced by computeQpJac(), and computeQpResidual().


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