www.mooseframework.org
RichardsRelPermVG.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 "RichardsRelPermVG.h"
11 #include "libmesh/utility.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<RichardsRelPerm>();
20  params.addRequiredRangeCheckedParam<Real>(
21  "simm",
22  "simm >= 0 & simm < 1",
23  "Immobile saturation. Must be between 0 and 1. Define s = "
24  "(seff - simm)/(1 - simm). Then relperm = s^(1/2) * (1 - (1 "
25  "- s^(1/m))^m)^2");
26  params.addRequiredRangeCheckedParam<Real>(
27  "m",
28  "m > 0 & m < 1",
29  "van-Genuchten m parameter. Must be between 0 and 1, and optimally "
30  "should be set >0.5. Define s = (seff - simm)/(1 - simm). Then "
31  "relperm = s^(1/2) * (1 - (1 - s^(1/m))^m)^2");
32  params.addClassDescription("VG form of relative permeability. Define s = (seff - simm)/(1 - "
33  "simm). Then relperm = s^(1/2) * (1 - (1 - s^(1/m))^m)^2, if s>0, "
34  "and relperm=0 otherwise");
35  return params;
36 }
37 
38 RichardsRelPermVG::RichardsRelPermVG(const InputParameters & parameters)
39  : RichardsRelPerm(parameters), _simm(getParam<Real>("simm")), _m(getParam<Real>("m"))
40 {
41 }
42 
43 Real
45 {
46  if (seff >= 1.0)
47  return 1.0;
48 
49  if (seff <= _simm)
50  return 0.0;
51 
52  Real s_internal = (seff - _simm) / (1.0 - _simm);
53  Real krel = std::sqrt(s_internal) *
54  Utility::pow<2>(1.0 - std::pow(1.0 - std::pow(s_internal, 1.0 / _m), _m));
55 
56  // bound, just in case
57  if (krel < 0.0)
58  krel = 0.0;
59  if (krel > 1.0)
60  krel = 1.0;
61 
62  return krel;
63 }
64 
65 Real
67 {
68  if (seff >= 1.0)
69  return 0.0;
70 
71  if (seff <= _simm)
72  return 0.0;
73 
74  Real s_internal = (seff - _simm) / (1.0 - _simm);
75  Real tmp = 1.0 - std::pow(s_internal, 1.0 / _m);
76  Real tmpp = -1.0 / _m * std::pow(s_internal, 1.0 / _m - 1.0);
77  Real tmp2 = 1.0 - std::pow(tmp, _m);
78  Real tmp2p = -_m * std::pow(tmp, _m - 1.0) * tmpp;
79  // Real krel = std::sqrt(s_internal)*std::pow(tmp2, 2);
80  Real krelp =
81  0.5 * std::pow(s_internal, -0.5) * tmp2 * tmp2 + 2.0 * std::sqrt(s_internal) * tmp2 * tmp2p;
82  return krelp / (1.0 - _simm);
83 }
84 
85 Real
87 {
88  if (seff >= 1.0)
89  return 0.0;
90 
91  if (seff <= _simm)
92  return 0.0;
93 
94  Real s_internal = (seff - _simm) / (1.0 - _simm);
95  Real tmp = 1.0 - std::pow(s_internal, 1.0 / _m);
96  Real tmpp = -1.0 / _m * std::pow(s_internal, 1.0 / _m - 1.0);
97  Real tmppp = -1.0 / _m * (1.0 / _m - 1.0) * std::pow(s_internal, 1.0 / _m - 2);
98  Real tmp2 = 1.0 - std::pow(tmp, _m);
99  Real tmp2p = -_m * std::pow(tmp, _m - 1.0) * tmpp;
100  Real tmp2pp = -_m * (_m - 1.0) * std::pow(tmp, _m - 2.0) * tmpp * tmpp -
101  _m * std::pow(tmp, _m - 1.0) * tmppp;
102  // Real krel = std::sqrt(s_internal)*std::pow(tmp2, 2);
103  // Real krelp = 0.5 * std::pow(s_internal, -0.5)*std::pow(tmp2, 2) +
104  // 2*std::sqrt(s_internal)*tmp2*tmp2p;
105  Real krelpp = -0.25 * std::pow(s_internal, -1.5) * tmp2 * tmp2 +
106  2.0 * 0.5 * std::pow(s_internal, -0.5) * 2.0 * tmp2 * tmp2p +
107  2.0 * std::sqrt(s_internal) * (tmp2p * tmp2p + tmp2 * tmp2pp);
108 
109  return krelpp / Utility::pow<2>(1.0 - _simm);
110 }
RichardsRelPermVG::relperm
Real relperm(Real seff) const
relative permeability as a function of effective saturation
Definition: RichardsRelPermVG.C:44
RichardsRelPerm
Base class for Richards relative permeability classes that provide relative permeability as a functio...
Definition: RichardsRelPerm.h:23
RichardsRelPermVG::drelperm
Real drelperm(Real seff) const
derivative of relative permeability wrt effective saturation
Definition: RichardsRelPermVG.C:66
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
registerMooseObject
registerMooseObject("RichardsApp", RichardsRelPermVG)
RichardsRelPermVG::d2relperm
Real d2relperm(Real seff) const
second derivative of relative permeability wrt effective saturation
Definition: RichardsRelPermVG.C:86
RichardsRelPermVG::_simm
Real _simm
immobile saturation
Definition: RichardsRelPermVG.h:48
RichardsRelPermVG.h
RichardsRelPermVG::_m
Real _m
van Genuchten m parameter
Definition: RichardsRelPermVG.h:51
RichardsRelPermVG
Van-Genuchten form of relative permeability as a function of effective saturation.
Definition: RichardsRelPermVG.h:23
validParams< RichardsRelPerm >
InputParameters validParams< RichardsRelPerm >()
Definition: RichardsRelPerm.C:16
validParams< RichardsRelPermVG >
InputParameters validParams< RichardsRelPermVG >()
Definition: RichardsRelPermVG.C:17
RichardsRelPermVG::RichardsRelPermVG
RichardsRelPermVG(const InputParameters &parameters)
Definition: RichardsRelPermVG.C:38