OGS
VanGenuchtenCapillaryPressureSaturation.cpp
Go to the documentation of this file.
1
14
15#include <algorithm>
16#include <cmath>
17
18#include "BaseLib/Error.h"
19
20namespace MaterialLib
21{
22namespace PorousMedium
23{
25 const double saturation) const
26{
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 {
39 }
40
41 return getPcBarvGSg(1 - _saturation_r) +
43 }
44 const double S = std::clamp(saturation, _saturation_r + _minor_offset,
46 const double Se = (S - _saturation_r) / (_saturation_max - _saturation_r);
47 const double pc = _pb * std::pow(std::pow(Se, (-1.0 / _m)) - 1.0, 1.0 - _m);
48 return std::clamp(pc, _minor_offset, _pc_max);
49}
50
52 const double capillary_pressure) const
53{
54 const double pc = std::max(_minor_offset, capillary_pressure);
55 const double Se = std::pow(std::pow(pc / _pb, 1.0 / (1.0 - _m)) + 1.0, -_m);
56 const double S = Se * (_saturation_max - _saturation_r) + _saturation_r;
57 return std::clamp(S, _saturation_r + _minor_offset,
59}
60
62 const double saturation) const
63{
65 {
66 double const Sg = 1 - saturation;
67 if (Sg >= _saturation_nonwet_r && Sg <= 1 - _saturation_r)
68 {
69 return -getdPcdSvGBar(Sg);
70 }
71 if (Sg < _saturation_nonwet_r)
72 {
74 }
75
76 return -getdPcdSvGBar(1 - _saturation_r);
77 }
78 if (saturation < _saturation_r)
79 {
80 return 0;
81 }
82 if (saturation > _saturation_max)
83 {
84 return 0;
85 }
86
87 const double S = std::clamp(saturation, _saturation_r + _minor_offset,
89 const double val1 = std::pow(
90 ((S - _saturation_r) / (_saturation_max - _saturation_r)), -1.0 / _m);
91 const double val2 = std::pow(val1 - 1.0, -_m);
92 return _pb * (_m - 1.0) * val1 * val2 / (_m * (S - _saturation_r));
93}
94
96 const double saturation) const
97{
99 {
100 OGS_FATAL(
101 "Second derivative of regularized van-Genuchten saturation "
102 "pressure relation is not implemented.");
103 }
104 if (saturation < _saturation_r)
105 {
106 return 0;
107 }
108 if (saturation > _saturation_max)
109 {
110 return 0;
111 }
112
113 const double S = std::clamp(saturation, _saturation_r + _minor_offset,
115 const double val1 = std::pow(
116 ((S - _saturation_r) / (_saturation_max - _saturation_r)), 1.0 / _m);
117 return -_pb / (_m * _m * (S - _saturation_r) * (S - _saturation_r)) *
118 std::pow(1 - val1, -_m - 1) * std::pow(val1, _m - 1) *
119 ((1 - _m * _m) * val1 + _m - 1);
120}
123{
126 double const S_bar = getSBar(Sg);
127 return getPcvGSg(S_bar) - getPcvGSg(Sg_r + (1 - Sg_r - S_lr) * _xi / 2);
128}
131{
134 return Sg_r + (1 - _xi) * (Sg - Sg_r) + 0.5 * _xi * (1 - Sg_r - S_lr);
135}
138{
141 double const S_le = (1 - Sg - S_lr) /
143 return _pb * std::pow(std::pow(S_le, (-1.0 / _m)) - 1.0, 1.0 - _m);
144}
148{
149 double S_bar = getSBar(Sg);
150 return getdPcdSvG(S_bar) * (1 - _xi);
151}
155 const double Sg) const
156{
159 double const nn = 1 / (1 - _m);
160 double const S_le = (1 - Sg - S_lr) / (1 - Sg_r - S_lr);
161 return _pb * (1 / (_m * nn)) * (1 / (1 - S_lr - Sg_r)) *
162 std::pow(std::pow(S_le, (-1 / _m)) - 1, (1 / nn) - 1) *
163 std::pow(S_le, (-1 / _m)) / S_le;
164}
165
166} // namespace PorousMedium
167} // namespace MaterialLib
#define OGS_FATAL(...)
Definition Error.h:26
double getSBar(double Sg) const
Regularized van Genuchten capillary pressure-saturation Model.
double getCapillaryPressure(const double saturation) const override
Get capillary pressure.
double getPcvGSg(double Sg) const
van Genuchten capillary pressure-saturation Model
double getSaturation(const double capillary_pressure) const override
Get saturation.
double getPcBarvGSg(double Sg) const
parameter in regularized van Genuchten model
double getdPcdS(const double saturation) const override
Get the derivative of the capillary pressure with respect to saturation.