www.mooseframework.org
Q2PSaturationDiffusion.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Kernel>();
15  params.addRequiredParam<UserObjectName>(
16  "fluid_density",
17  "A RichardsDensity UserObject that defines the fluid density as a function of pressure.");
18  params.addRequiredParam<UserObjectName>(
19  "fluid_relperm",
20  "A RichardsRelPerm UserObject that defines the fluid relative permeability "
21  "as a function of water saturation (eg RichardsRelPermPower)");
22  params.addRequiredCoupledVar("porepressure_variable",
23  "The variable representing the porepressure");
24  params.addRequiredParam<Real>("fluid_viscosity", "The fluid dynamic viscosity");
25  params.addRequiredParam<Real>("diffusivity", "Diffusivity as a function of S");
26  params.addClassDescription("Diffusion part of the Flux according to Darcy-Richards flow. The "
27  "Variable of this Kernel must be the saturation.");
28  return params;
29 }
30 
31 Q2PSaturationDiffusion::Q2PSaturationDiffusion(const InputParameters & parameters)
32  : Kernel(parameters),
33  _density(getUserObject<RichardsDensity>("fluid_density")),
34  _relperm(getUserObject<RichardsRelPerm>("fluid_relperm")),
35  _pp(coupledValue("porepressure_variable")),
36  _pp_var_num(coupled("porepressure_variable")),
37  _viscosity(getParam<Real>("fluid_viscosity")),
38  _permeability(getMaterialProperty<RealTensorValue>("permeability")),
39  _diffusivity(getParam<Real>("diffusivity"))
40 {
41 }
42 
43 Real
45 {
46  Real coef = _diffusivity * _relperm.relperm(_u[_qp]) * _density.density(_pp[_qp]) / _viscosity;
47  return coef * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]);
48 }
49 
50 Real
52 {
53  Real coef = _diffusivity * _relperm.relperm(_u[_qp]) * _density.density(_pp[_qp]) / _viscosity;
54  Real coefp = _diffusivity * _relperm.drelperm(_u[_qp]) * _density.density(_pp[_qp]) / _viscosity;
55  return coefp * _phi[_j][_qp] * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]) +
56  coef * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_phi[_j][_qp]);
57 }
58 
59 Real
61 {
62  if (jvar != _pp_var_num)
63  return 0.0;
64  Real coefp = _diffusivity * _relperm.relperm(_u[_qp]) * _density.ddensity(_pp[_qp]) / _viscosity;
65  return coefp * _phi[_j][_qp] * (_grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]));
66 }
virtual Real drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
Real _viscosity
fluid viscosity
Base class for Richards relative permeability classes that provide relative permeability as a functio...
const RichardsRelPerm & _relperm
water relative permeability
Q2PSaturationDiffusion(const InputParameters &parameters)
virtual Real density(Real p) const =0
fluid density as a function of porepressure This must be over-ridden in derived classes to provide an...
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< RealTensorValue > & _permeability
permeability
InputParameters validParams< Q2PSaturationDiffusion >()
const RichardsDensity & _density
water density
virtual Real ddensity(Real p) const =0
derivative of fluid density wrt porepressure This must be over-ridden in derived classes to provide a...
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
unsigned int _pp_var_num
variable number of the porepressure variable
const VariableValue & _pp
porepressure at the quadpoints