OGS 6.2.0-97-g4a610c866
VanGenuchtenCapillaryPressureSaturation.cpp
Go to the documentation of this file.
1 
14 
15 #include <cmath>
16 
17 #include "MathLib/MathTools.h"
18 #include "BaseLib/Error.h"
19 
20 namespace MaterialLib
21 {
22 namespace PorousMedium
23 {
25  const double saturation) const
26 {
27  if (_has_regularized)
28  {
29  double Sg = 1 - saturation;
30  if (Sg <= 1 - _saturation_r && Sg >= _saturation_nonwet_r)
31  {
32  return getPcBarvGSg(Sg);
33  }
34  if (Sg < _saturation_nonwet_r)
35  {
38  (Sg - _saturation_nonwet_r);
39  }
40 
41  return getPcBarvGSg(1 - _saturation_r) +
42  getdPcdSvGBar(1 - _saturation_r) * (Sg - 1 + _saturation_r);
43  }
44  const double S =
47  const double Se = (S - _saturation_r) / (_saturation_max - _saturation_r);
48  const double pc = _pb * std::pow(std::pow(Se, (-1.0 / _m)) - 1.0, 1.0 - _m);
50 }
51 
53  const double capillary_pressure) const
54 {
55  const double pc = std::max(_minor_offset, capillary_pressure);
56  const double Se = std::pow(std::pow(pc / _pb, 1.0 / (1.0 - _m)) + 1.0, -_m);
57  const double S = Se * (_saturation_max - _saturation_r) + _saturation_r;
60 }
61 
63  const double saturation) const
64 {
65  if (_has_regularized)
66  {
67  double const Sg = 1 - saturation;
68  if (Sg >= _saturation_nonwet_r && Sg <= 1 - _saturation_r)
69  {
70  return -getdPcdSvGBar(Sg);
71  }
72  if (Sg < _saturation_nonwet_r)
73  {
75  }
76 
77  return -getdPcdSvGBar(1 - _saturation_r);
78  }
79  if (saturation < _saturation_r)
80  {
81  return 0;
82  }
83  if (saturation > _saturation_max)
84  {
85  return 0;
86  }
87 
88  const double S =
91  const double val1 = std::pow(
92  ((S - _saturation_r) / (_saturation_max - _saturation_r)), -1.0 / _m);
93  const double val2 = std::pow(val1 - 1.0, -_m);
94  return _pb * (_m - 1.0) * val1 * val2 / (_m * (S - _saturation_r));
95 }
96 
98  const double saturation) const
99 {
100  if (_has_regularized)
101  {
102  OGS_FATAL(
103  "Second derivative of regularized van-Genuchten saturation "
104  "pressure relation is not implemented.");
105  }
106  if (saturation < _saturation_r)
107  {
108  return 0;
109  }
110  if (saturation > _saturation_max)
111  {
112  return 0;
113  }
114 
115  const double S =
118  const double val1 = std::pow(
119  ((S - _saturation_r) / (_saturation_max - _saturation_r)), 1.0 / _m);
120  return -_pb / (_m * _m * (S - _saturation_r) * (S - _saturation_r)) *
121  std::pow(1 - val1, -_m - 1) * std::pow(val1, _m - 1) *
122  ((1 - _m * _m) * val1 + _m - 1);
123 }
126 {
128  double const S_lr = CapillaryPressureSaturation::_saturation_r;
129  double const S_bar = getSBar(Sg);
130  return getPcvGSg(S_bar) - getPcvGSg(Sg_r + (1 - Sg_r - S_lr) * _xi / 2);
131 }
134 {
136  double const S_lr = CapillaryPressureSaturation::_saturation_r;
137  return Sg_r + (1 - _xi) * (Sg - Sg_r) + 0.5 * _xi * (1 - Sg_r - S_lr);
138 }
141 {
143  double const S_lr = CapillaryPressureSaturation::_saturation_r;
144  double const S_le = (1 - Sg - S_lr) /
146  return _pb * std::pow(std::pow(S_le, (-1.0 / _m)) - 1.0, 1.0 - _m);
147 }
151 {
152  double S_bar = getSBar(Sg);
153  return getdPcdSvG(S_bar) * (1 - _xi);
154 }
158  const double Sg) const
159 {
161  double const S_lr = CapillaryPressureSaturation::_saturation_r;
162  double const nn = 1 / (1 - _m);
163  double const S_le = (1 - Sg - S_lr) / (1 - Sg_r - S_lr);
164  return _pb * (1 / (_m * nn)) * (1 / (1 - S_lr - Sg_r)) *
165  std::pow(std::pow(S_le, (-1 / _m)) - 1, (1 / nn) - 1) *
166  std::pow(S_le, (-1 / _m)) / S_le;
167 }
168 
169 } // namespace PorousMedium
170 } // namespace MaterialLib
double getPcBarvGSg(double Sg) const
parameter in regularized van Genuchten model
Type limitValueInInterval(const Type variable, const Type lower_bound, const Type upper_bound)
Definition: MathTools.h:104
double getCapillaryPressure(const double saturation) const override
Get capillary pressure.
double getSaturation(const double capillary_pressure) const override
Get saturation.
double getdPcdS(const double saturation) const override
Get the derivative of the capillary pressure with respect to saturation.
double getPcvGSg(double Sg) const
van Genuchten capillary pressure-saturation Model
double getSBar(double Sg) const
Regularized van Genuchten capillary pressure-saturation Model.
#define OGS_FATAL(fmt,...)
Definition: Error.h:63