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 25 of file RichardsSeff1BWsmall.h.

Constructor & Destructor Documentation

RichardsSeff1BWsmall::RichardsSeff1BWsmall ( const InputParameters &  parameters)

Definition at line 49 of file RichardsSeff1BWsmall.C.

50  : RichardsSeff(parameters),
51  _sn(getParam<Real>("Sn")),
52  _ss(getParam<Real>("Ss")),
53  _c(getParam<Real>("C")),
54  _las(getParam<Real>("las"))
55 {
56  if (_ss <= _sn)
57  mooseError("In BW effective saturation Sn set to ",
58  _sn,
59  " and Ss set to ",
60  _ss,
61  " but these must obey Ss > Sn");
62 }
RichardsSeff(const InputParameters &parameters)
Definition: RichardsSeff.C:22
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

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 172 of file RichardsSeff1BWsmall.C.

175 {
176  result[0][0] = 0.0;
177 
178  Real pp = (*p[0])[qp];
179  if (pp >= 0)
180  return;
181 
182  Real x = (_c - 1) * std::exp(_c - 1 - _c * pp / _las);
183  Real lamw = LambertW(x);
184  result[0][0] = -Utility::pow<3>(_c) / Utility::pow<2>(_las) * lamw * (1.0 - 2.0 * lamw) /
185  Utility::pow<5>(1 + lamw);
186 }
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.
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 156 of file RichardsSeff1BWsmall.C.

159 {
160  result[0] = 0.0;
161 
162  Real pp = (*p[0])[qp];
163  if (pp >= 0)
164  return;
165 
166  Real x = (_c - 1) * std::exp(_c - 1.0 - _c * pp / _las);
167  Real lamw = LambertW(x);
168  result[0] = Utility::pow<2>(_c) / _las * lamw / Utility::pow<3>(1 + lamw);
169 }
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.
void RichardsSeff::execute ( )
inherited

Definition at line 30 of file RichardsSeff.C.

31 {
32 }
void RichardsSeff::finalize ( )
inherited

Definition at line 35 of file RichardsSeff.C.

36 {
37 }
void RichardsSeff::initialize ( )
inherited

Definition at line 25 of file RichardsSeff.C.

26 {
27 }
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 65 of file RichardsSeff1BWsmall.C.

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

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

145 {
146  Real pp = (*p[0])[qp];
147  if (pp >= 0)
148  return 1.0;
149 
150  Real x = (_c - 1.0) * std::exp(_c - 1 - _c * pp / _las);
151  Real th = _c / (1.0 + LambertW(x)); // use branch 0 for positive x
152  return _sn + (_ss - _sn) * th;
153 }
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

Real RichardsSeff1BWsmall::_c
protected

BW's C parameter.

Definition at line 73 of file RichardsSeff1BWsmall.h.

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

Real RichardsSeff1BWsmall::_las
protected

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

Definition at line 76 of file RichardsSeff1BWsmall.h.

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

Real RichardsSeff1BWsmall::_sn
protected

BW's initial effective saturation.

Definition at line 67 of file RichardsSeff1BWsmall.h.

Referenced by RichardsSeff1BWsmall(), and seff().

Real RichardsSeff1BWsmall::_ss
protected

Effective saturation where porepressure = 0.

Definition at line 70 of file RichardsSeff1BWsmall.h.

Referenced by RichardsSeff1BWsmall(), and seff().


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