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

"Broadbridge-White" form of effective saturation for Kn small as a function of porepressure (not capillary pressure, so Seff = 1 for p>=0). More...

#include <RichardsSeff1BWsmall.h>

Inheritance diagram for RichardsSeff1BWsmall:
[legend]

Public Member Functions

 RichardsSeff1BWsmall (const InputParameters &parameters)
 
Real LambertW (const double z) const
 LambertW function, returned value satisfies W(z)*exp(W(z))=z. More...
 
Real seff (std::vector< const VariableValue *> p, unsigned int qp) const
 effective saturation as a function of porepressure More...
 
void dseff (std::vector< const VariableValue *> p, unsigned int qp, std::vector< Real > &result) const
 derivative of effective saturation as a function of porepressure More...
 
void d2seff (std::vector< const VariableValue *> p, unsigned int qp, std::vector< std::vector< Real >> &result) const
 second derivative of effective saturation as a function of porepressure More...
 
void initialize ()
 
void execute ()
 
void finalize ()
 

Protected Attributes

Real _sn
 BW's initial effective saturation. More...
 
Real _ss
 Effective saturation where porepressure = 0. More...
 
Real _c
 BW's C parameter. More...
 
Real _las
 BW's lambda_s parameter multiplied by (fluiddensity*gravity) More...
 

Detailed Description

"Broadbridge-White" form of effective saturation for Kn small as a function of porepressure (not capillary pressure, so Seff = 1 for p>=0).

See P Broadbridge and I White `‘Constant rate rainfall infiltration: A versatile nonlinear model 1. Analytic Solution’', Water Resources Research 24 (1988) 145-154

Definition at line 27 of file RichardsSeff1BWsmall.h.

Constructor & Destructor Documentation

◆ RichardsSeff1BWsmall()

RichardsSeff1BWsmall::RichardsSeff1BWsmall ( const InputParameters &  parameters)

Definition at line 53 of file RichardsSeff1BWsmall.C.

54  : RichardsSeff(parameters),
55  _sn(getParam<Real>("Sn")),
56  _ss(getParam<Real>("Ss")),
57  _c(getParam<Real>("C")),
58  _las(getParam<Real>("las"))
59 {
60  if (_ss <= _sn)
61  mooseError("In BW effective saturation Sn set to ",
62  _sn,
63  " and Ss set to ",
64  _ss,
65  " but these must obey Ss > Sn");
66 }
RichardsSeff(const InputParameters &parameters)
Definition: RichardsSeff.C:24
Real _las
BW&#39;s lambda_s parameter multiplied by (fluiddensity*gravity)
Real _sn
BW&#39;s initial effective saturation.
Real _c
BW&#39;s C parameter.
Real _ss
Effective saturation where porepressure = 0.

Member Function Documentation

◆ d2seff()

void RichardsSeff1BWsmall::d2seff ( std::vector< const VariableValue *>  p,
unsigned int  qp,
std::vector< std::vector< Real >> &  result 
) const
virtual

second derivative of effective saturation as a function of porepressure

Parameters
pporepressure in the element. Note that (*p[0])[qp] is the porepressure at quadpoint qp
qpthe quad point to evaluate effective saturation at
resultthe derivtives will be placed in this array

Implements RichardsSeff.

Definition at line 176 of file RichardsSeff1BWsmall.C.

179 {
180  result[0][0] = 0.0;
181 
182  Real pp = (*p[0])[qp];
183  if (pp >= 0)
184  return;
185 
186  Real x = (_c - 1) * std::exp(_c - 1 - _c * pp / _las);
187  Real lamw = LambertW(x);
188  result[0][0] = -Utility::pow<3>(_c) / Utility::pow<2>(_las) * lamw * (1.0 - 2.0 * lamw) /
189  Utility::pow<5>(1 + lamw);
190 }
Real _las
BW&#39;s lambda_s parameter multiplied by (fluiddensity*gravity)
Real _c
BW&#39;s C parameter.
Real LambertW(const double z) const
LambertW function, returned value satisfies W(z)*exp(W(z))=z.

◆ dseff()

void RichardsSeff1BWsmall::dseff ( std::vector< const VariableValue *>  p,
unsigned int  qp,
std::vector< Real > &  result 
) const
virtual

derivative of effective saturation as a function of porepressure

Parameters
pporepressure in the element. Note that (*p[0])[qp] is the porepressure at quadpoint qp
qpthe quad point to evaluate effective saturation at
resultthe derivtives will be placed in this array

Implements RichardsSeff.

Definition at line 160 of file RichardsSeff1BWsmall.C.

163 {
164  result[0] = 0.0;
165 
166  Real pp = (*p[0])[qp];
167  if (pp >= 0)
168  return;
169 
170  Real x = (_c - 1) * std::exp(_c - 1.0 - _c * pp / _las);
171  Real lamw = LambertW(x);
172  result[0] = Utility::pow<2>(_c) / _las * lamw / Utility::pow<3>(1 + lamw);
173 }
Real _las
BW&#39;s lambda_s parameter multiplied by (fluiddensity*gravity)
Real _c
BW&#39;s C parameter.
Real LambertW(const double z) const
LambertW function, returned value satisfies W(z)*exp(W(z))=z.

◆ execute()

void RichardsSeff::execute ( )
inherited

Definition at line 32 of file RichardsSeff.C.

33 {
34 }

◆ finalize()

void RichardsSeff::finalize ( )
inherited

Definition at line 37 of file RichardsSeff.C.

38 {
39 }

◆ initialize()

void RichardsSeff::initialize ( )
inherited

Definition at line 27 of file RichardsSeff.C.

28 {
29 }

◆ LambertW()

Real RichardsSeff1BWsmall::LambertW ( const double  z) const

LambertW function, returned value satisfies W(z)*exp(W(z))=z.

Parameters
zthe z value in above expression

Definition at line 69 of file RichardsSeff1BWsmall.C.

Referenced by d2seff(), dseff(), and seff().

70 {
71  /* Lambert W function.
72  Was ~/C/LambertW.c written K M Briggs Keith dot Briggs at bt dot com 97 May 21.
73  Revised KMB 97 Nov 20; 98 Feb 11, Nov 24, Dec 28; 99 Jan 13; 00 Feb 23; 01 Apr 09
74 
75  Computes Lambert W function, principal branch.
76  See LambertW1.c for -1 branch.
77 
78  Returned value W(z) satisfies W(z)*exp(W(z))=z
79  test data...
80  W(1)= 0.5671432904097838730
81  W(2)= 0.8526055020137254914
82  W(20)=2.2050032780240599705
83  To solve (a+b*R)*exp(-c*R)-d=0 for R, use
84  R=-(b*W(-exp(-a*c/b)/b*d*c)+a*c)/b/c
85 
86  Test:
87  gcc -DTESTW LambertW.c -o LambertW -lm && LambertW
88  Library:
89  gcc -O3 -c LambertW.c
90 
91  Modified trially by Andy to use MOOSE things
92  */
93  mooseAssert(z > 0, "LambertW function in RichardsSeff1BWsmall called with negative argument");
94 
95  int i;
96  const Real eps = 4.0e-16; //, em1=0.3678794411714423215955237701614608;
97  Real p, e, t, w;
98 
99  /* Uncomment this stuff is you ever need to call with a negative argument
100  if (z < -em1)
101  mooseError("LambertW: bad argument ", z, "\n");
102 
103  if (0.0 == z)
104  return 0.0;
105  if (z < -em1+1e-4)
106  {
107  // series near -em1 in sqrt(q)
108  Real q=z+em1,r=std::sqrt(q),q2=q*q,q3=q2*q;
109  return
110  -1.0
111  +2.331643981597124203363536062168*r
112  -1.812187885639363490240191647568*q
113  +1.936631114492359755363277457668*r*q
114  -2.353551201881614516821543561516*q2
115  +3.066858901050631912893148922704*r*q2
116  -4.175335600258177138854984177460*q3
117  +5.858023729874774148815053846119*r*q3
118  -8.401032217523977370984161688514*q3*q; // error approx 1e-16
119  }
120  */
121  /* initial approx for iteration... */
122  if (z < 1.0)
123  {
124  /* series near 0 */
125  p = std::sqrt(2.0 * (2.7182818284590452353602874713526625 * z + 1.0));
126  w = -1.0 + p * (1.0 + p * (-0.333333333333333333333 + p * 0.152777777777777777777777));
127  }
128  else
129  w = std::log(z); /* asymptotic */
130  if (z > 3.0)
131  w -= std::log(w); /* useful? */
132  for (i = 0; i < 10; i++)
133  {
134  /* Halley iteration */
135  e = std::exp(w);
136  t = w * e - z;
137  p = w + 1.0;
138  t /= e * p - 0.5 * (p + 1.0) * t / p;
139  w -= t;
140  if (std::abs(t) < eps * (1.0 + std::abs(w)))
141  return w; /* rel-abs error */
142  }
143  /* should never get here */
144  mooseError("LambertW: No convergence at z= ", z, "\n");
145 }

◆ seff()

Real RichardsSeff1BWsmall::seff ( std::vector< const VariableValue *>  p,
unsigned int  qp 
) const
virtual

effective saturation as a function of porepressure

Parameters
pporepressure in the element. Note that (*p[0])[qp] is the porepressure at quadpoint qp
qpthe quad point to evaluate effective saturation at

Implements RichardsSeff.

Definition at line 148 of file RichardsSeff1BWsmall.C.

149 {
150  Real pp = (*p[0])[qp];
151  if (pp >= 0)
152  return 1.0;
153 
154  Real x = (_c - 1.0) * std::exp(_c - 1 - _c * pp / _las);
155  Real th = _c / (1.0 + LambertW(x)); // use branch 0 for positive x
156  return _sn + (_ss - _sn) * th;
157 }
Real _las
BW&#39;s lambda_s parameter multiplied by (fluiddensity*gravity)
Real _sn
BW&#39;s initial effective saturation.
Real _c
BW&#39;s C parameter.
Real LambertW(const double z) const
LambertW function, returned value satisfies W(z)*exp(W(z))=z.
Real _ss
Effective saturation where porepressure = 0.

Member Data Documentation

◆ _c

Real RichardsSeff1BWsmall::_c
protected

BW's C parameter.

Definition at line 75 of file RichardsSeff1BWsmall.h.

Referenced by d2seff(), dseff(), and seff().

◆ _las

Real RichardsSeff1BWsmall::_las
protected

BW's lambda_s parameter multiplied by (fluiddensity*gravity)

Definition at line 78 of file RichardsSeff1BWsmall.h.

Referenced by d2seff(), dseff(), and seff().

◆ _sn

Real RichardsSeff1BWsmall::_sn
protected

BW's initial effective saturation.

Definition at line 69 of file RichardsSeff1BWsmall.h.

Referenced by RichardsSeff1BWsmall(), and seff().

◆ _ss

Real RichardsSeff1BWsmall::_ss
protected

Effective saturation where porepressure = 0.

Definition at line 72 of file RichardsSeff1BWsmall.h.

Referenced by RichardsSeff1BWsmall(), and seff().


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