www.mooseframework.org
Q2PSaturationDiffusion.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "Q2PSaturationDiffusion.h"
11 
13 
16 {
18  params.addRequiredParam<UserObjectName>(
19  "fluid_density",
20  "A RichardsDensity UserObject that defines the fluid density as a function of pressure.");
21  params.addRequiredParam<UserObjectName>(
22  "fluid_relperm",
23  "A RichardsRelPerm UserObject that defines the fluid relative permeability "
24  "as a function of water saturation (eg RichardsRelPermPower)");
25  params.addRequiredCoupledVar("porepressure_variable",
26  "The variable representing the porepressure");
27  params.addRequiredParam<Real>("fluid_viscosity", "The fluid dynamic viscosity");
28  params.addRequiredParam<Real>("diffusivity", "Diffusivity as a function of S");
29  params.addClassDescription("Diffusion part of the Flux according to Darcy-Richards flow. The "
30  "Variable of this Kernel must be the saturation.");
31  return params;
32 }
33 
35  : Kernel(parameters),
36  _density(getUserObject<RichardsDensity>("fluid_density")),
37  _relperm(getUserObject<RichardsRelPerm>("fluid_relperm")),
38  _pp(coupledValue("porepressure_variable")),
39  _pp_var_num(coupled("porepressure_variable")),
40  _viscosity(getParam<Real>("fluid_viscosity")),
41  _permeability(getMaterialProperty<RealTensorValue>("permeability")),
42  _diffusivity(getParam<Real>("diffusivity"))
43 {
44 }
45 
46 Real
48 {
50  return coef * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]);
51 }
52 
53 Real
55 {
58  return coefp * _phi[_j][_qp] * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]) +
59  coef * _grad_test[_i][_qp] * (_permeability[_qp] * _grad_phi[_j][_qp]);
60 }
61 
62 Real
64 {
65  if (jvar != _pp_var_num)
66  return 0.0;
68  return coefp * _phi[_j][_qp] * (_grad_test[_i][_qp] * (_permeability[_qp] * _grad_u[_qp]));
69 }
const VariableGradient & _grad_u
static InputParameters validParams()
virtual Real drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
virtual Real ddensity(Real p) const =0
derivative of fluid density wrt porepressure This must be over-ridden in derived classes to provide a...
Real _viscosity
fluid viscosity
Base class for Richards relative permeability classes that provide relative permeability as a functio...
const VariablePhiGradient & _grad_phi
const RichardsRelPerm & _relperm
water relative permeability
Q2PSaturationDiffusion(const InputParameters &parameters)
registerMooseObject("RichardsApp", Q2PSaturationDiffusion)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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...
TensorValue< Real > RealTensorValue
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< RealTensorValue > & _permeability
permeability
Diffusive Kernel that models nonzero capillary pressure in Q2P models The Variable of this Kernel sho...
unsigned int _i
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
const RichardsDensity & _density
water density
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableTestGradient & _grad_test
void addClassDescription(const std::string &doc_string)
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
const VariablePhiValue & _phi
const VariableValue & _u
unsigned int _qp