OGS 6.1.0-1699-ge946d4c5f
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  return 0;
81  if (saturation > _saturation_max)
82  return 0;
83 
84  const double S =
87  const double val1 = std::pow(
88  ((S - _saturation_r) / (_saturation_max - _saturation_r)), -1.0 / _m);
89  const double val2 = std::pow(val1 - 1.0, -_m);
90  return _pb * (_m - 1.0) * val1 * val2 / (_m * (S - _saturation_r));
91 }
92 
94  const double saturation) const
95 {
96  if (_has_regularized)
97  {
98  OGS_FATAL(
99  "Second derivative of regularized van-Genuchten saturation "
100  "pressure relation is not implemented.");
101  }
102  if (saturation < _saturation_r)
103  return 0;
104  if (saturation > _saturation_max)
105  return 0;
106 
107  const double S =
110  const double val1 = std::pow(
111  ((S - _saturation_r) / (_saturation_max - _saturation_r)), 1.0 / _m);
112  return -_pb / (_m * _m * (S - _saturation_r) * (S - _saturation_r)) *
113  std::pow(1 - val1, -_m - 1) * std::pow(val1, _m - 1) *
114  ((1 - _m * _m) * val1 + _m - 1);
115 }
118 {
120  double const S_lr = CapillaryPressureSaturation::_saturation_r;
121  double const S_bar = getSBar(Sg);
122  return getPcvGSg(S_bar) - getPcvGSg(Sg_r + (1 - Sg_r - S_lr) * _xi / 2);
123 }
126 {
128  double const S_lr = CapillaryPressureSaturation::_saturation_r;
129  return Sg_r + (1 - _xi) * (Sg - Sg_r) + 0.5 * _xi * (1 - Sg_r - S_lr);
130 }
133 {
135  double const S_lr = CapillaryPressureSaturation::_saturation_r;
136  double const S_le = (1 - Sg - S_lr) /
138  return _pb * std::pow(std::pow(S_le, (-1.0 / _m)) - 1.0, 1.0 - _m);
139 }
143 {
144  double S_bar = getSBar(Sg);
145  return getdPcdSvG(S_bar) * (1 - _xi);
146 }
150  const double Sg) const
151 {
153  double const S_lr = CapillaryPressureSaturation::_saturation_r;
154  double const nn = 1 / (1 - _m);
155  double const S_le = (1 - Sg - S_lr) / (1 - Sg_r - S_lr);
156  return _pb * (1 / (_m * nn)) * (1 / (1 - S_lr - Sg_r)) *
157  std::pow(std::pow(S_le, (-1 / _m)) - 1, (1 / nn) - 1) *
158  std::pow(S_le, (-1 / _m)) / S_le;
159 }
160 
161 } // end namespace
162 } // end namespace
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:98
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:71