39 mooseAssert(z > 0,
"LambertW function in RichardsSeff1BWsmall called with negative argument");
41 const Real
eps = 4.0e-16;
70 p = std::sqrt(2.0 * (2.7182818284590452353602874713526625 * z + 1.0));
71 w = -1.0 +
p * (1.0 +
p * (-0.333333333333333333333 +
p * 0.152777777777777777777777));
77 for (
unsigned int i = 0; i < 10; ++i)
83 t /= e *
p - 0.5 * (
p + 1.0) * t /
p;
85 if (std::abs(t) <
eps * (1.0 + std::abs(w)))
89 mooseError(
"LambertW: No convergence at z= ", z,
"\n");
97 const Real
x = (
c - 1.0) * std::exp(
c - 1.0 -
c * pressure / las);
99 return sn + (ss - sn) * th;
107 const Real
x = (
c - 1.0) * std::exp(
c - 1.0 -
c * pressure / las);
109 return (ss - sn) * Utility::pow<2>(
c) / las * lamw / Utility::pow<3>(1.0 + lamw);
117 const Real
x = (
c - 1.0) * std::exp(
c - 1.0 -
c * pressure / las);
119 return -(ss - sn) * Utility::pow<3>(
c) / Utility::pow<2>(las) * lamw * (1.0 - 2.0 * lamw) /
120 Utility::pow<5>(1.0 + lamw);
132 const Real coef = (ks - kn) * (
c - 1.0);
133 const Real th = (s - sn) / (ss - sn);
134 const Real krelp = coef * (2.0 * th / (
c - th) + Utility::pow<2>(th) / Utility::pow<2>(
c - th));
135 return krelp / (ss - sn);
147 const Real coef = (ks - kn) * (
c - 1.0);
148 const Real th = (s - sn) / (ss - sn);
149 const Real krelpp = coef * (2.0 / (
c - th) + 4.0 * th / Utility::pow<2>(
c - th) +
150 2.0 * Utility::pow<2>(th) / Utility::pow<3>(
c - th));
151 return krelpp / Utility::pow<2>(ss - sn);
const std::vector< double > x
void mooseError(Args &&... args)
Broadbridge-White version of relative permeability, and effective saturation as a function of capilla...
Real dRelativePermeability(Real s, Real c, Real sn, Real ss, Real kn, Real ks)
Derivative of relative permeability with respect to saturation.
Real d2RelativePermeability(Real s, Real c, Real sn, Real ss, Real kn, Real ks)
Second derivative of relative permeability with respect to saturation.
Real d2EffectiveSaturation(Real pc, Real c, Real sn, Real ss, Real las)
Second derivative of effective saturation wrt capillary pressure.
Real dEffectiveSaturation(Real pc, Real c, Real sn, Real ss, Real las)
Derivative of effective saturation wrt capillary pressure.
Real LambertW(Real z)
Provides the Lambert W function, which satisfies W(z) * exp(W(z)) = z.
Real effectiveSaturation(Real pc, Real c, Real sn, Real ss, Real las)
Effective saturation as a function of capillary pressure If pc>=0 this will yield 1,...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real