OGS
CapillaryPressureRegularizedVanGenuchten.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#include "
CapillaryPressureRegularizedVanGenuchten.h
"
5
6
#include <algorithm>
7
#include <cmath>
8
9
#include "
BaseLib/Error.h
"
10
#include "
MaterialLib/MPL/Medium.h
"
11
#include "
MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.h
"
12
#include "
MaterialLib/MPL/VariableType.h
"
13
14
namespace
MaterialPropertyLib
15
{
16
void
checkSaturationRange
(
const
double
Sl)
17
{
18
if
(Sl < 0 || Sl > 1)
19
{
20
OGS_FATAL
(
"The saturation of {:e} is out of its range of [0, 1]"
, Sl);
21
}
22
}
23
24
CapillaryPressureRegularizedVanGenuchten::
25
CapillaryPressureRegularizedVanGenuchten
(
26
double
const
residual_liquid_saturation
,
27
double
const
maximum_liquid_saturation,
28
double
const
exponent,
29
double
const
p_b)
30
:
Sg_r_
(1.0 - maximum_liquid_saturation),
31
Sg_max_
(1.0 -
residual_liquid_saturation
),
32
m_
(exponent),
33
p_b_
(p_b),
34
PcBarvGSg_Sg_max_
(
getPcBarvGSg
(
Sg_max_
)),
35
dPcdSvGBarSg_max_
(
getdPcdSvGBar
(
Sg_max_
))
36
{
37
checkVanGenuchtenExponentRange
(
m_
);
38
}
39
40
PropertyDataType
CapillaryPressureRegularizedVanGenuchten::value
(
41
VariableArray
const
& variable_array,
42
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
43
double
const
/*dt*/
)
const
44
{
45
const
double
Sl = variable_array.
liquid_saturation
;
46
47
checkSaturationRange
(Sl);
48
49
double
const
Sg = 1 - Sl;
50
if
(!(Sg < Sg_r_ || Sg >
Sg_max_
))
51
{
52
return
getPcBarvGSg
(Sg);
53
}
54
if
(Sg <
Sg_r_
)
55
{
56
return
0.0;
57
}
58
59
return
PcBarvGSg_Sg_max_
+
dPcdSvGBarSg_max_
* (Sg -
Sg_max_
);
60
}
61
62
PropertyDataType
CapillaryPressureRegularizedVanGenuchten::dValue
(
63
VariableArray
const
& variable_array,
Variable
const
variable,
64
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
65
double
const
/*dt*/
)
const
66
{
67
if
(variable !=
Variable::liquid_saturation
)
68
{
69
OGS_FATAL
(
70
"CapillaryPressureRegularizedVanGenuchten::dValue is implemented "
71
"for derivatives with respect to liquid saturation only."
);
72
}
73
74
const
double
Sl = variable_array.
liquid_saturation
;
75
76
checkSaturationRange
(Sl);
77
78
double
const
Sg = 1 - Sl;
79
if
(!(Sg < Sg_r_ || Sg >
Sg_max_
))
80
{
81
return
-
getdPcdSvGBar
(Sg);
82
}
83
if
(Sg <
Sg_r_
)
84
{
85
return
0.0;
86
}
87
88
return
-
dPcdSvGBarSg_max_
;
89
}
90
91
double
CapillaryPressureRegularizedVanGenuchten::getPcBarvGSg
(
92
double
const
Sg)
const
93
{
94
double
const
S_bar =
getSBar
(Sg);
95
return
getPcvGSg
(S_bar) -
getPcvGSg
(
Sg_r_
+ (
Sg_max_
-
Sg_r_
) *
xi_
/ 2);
96
}
97
98
double
CapillaryPressureRegularizedVanGenuchten::getSBar
(
double
const
Sg)
const
99
{
100
return
Sg_r_
+ (1 -
xi_
) * (Sg -
Sg_r_
) + 0.5 *
xi_
* (
Sg_max_
-
Sg_r_
);
101
}
102
103
double
CapillaryPressureRegularizedVanGenuchten::getPcvGSg
(
104
double
const
Sg)
const
105
{
106
double
const
Se = (
Sg_max_
- Sg) / (
Sg_max_
-
Sg_r_
);
107
return
p_b_
* std::pow(std::pow(Se, (-1.0 /
m_
)) - 1.0, 1.0 -
m_
);
108
}
109
110
double
CapillaryPressureRegularizedVanGenuchten::getdPcdSvGBar
(
111
double
const
Sg)
const
112
{
113
double
S_bar =
getSBar
(Sg);
114
return
getdPcdSvG
(S_bar) * (1 -
xi_
);
115
}
116
117
double
CapillaryPressureRegularizedVanGenuchten::getdPcdSvG
(
118
const
double
Sg)
const
119
{
120
double
const
n = 1 / (1 -
m_
);
121
double
const
Se = (
Sg_max_
- Sg) / (
Sg_max_
-
Sg_r_
);
122
auto
const
temp = std::pow(Se, (-1 /
m_
));
123
return
p_b_
* (1 / (
m_
* n)) * (1 / (
Sg_max_
-
Sg_r_
)) *
124
std::pow(temp - 1, (1 / n) - 1) * temp / Se;
125
}
126
127
}
// namespace MaterialPropertyLib
CapillaryPressureRegularizedVanGenuchten.h
CheckVanGenuchtenExponentRange.h
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:19
Medium.h
VariableType.h
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::xi_
static constexpr double xi_
parameter in regularized van Genuchten model
Definition
CapillaryPressureRegularizedVanGenuchten.h:63
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::m_
double const m_
Definition
CapillaryPressureRegularizedVanGenuchten.h:58
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::getdPcdSvG
double getdPcdSvG(double const Sg) const
Gets .
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:117
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::PcBarvGSg_Sg_max_
double const PcBarvGSg_Sg_max_
Definition
CapillaryPressureRegularizedVanGenuchten.h:65
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::dValue
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:62
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::Sg_r_
double const Sg_r_
Residual saturation of gas phase.
Definition
CapillaryPressureRegularizedVanGenuchten.h:56
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::Sg_max_
double const Sg_max_
Maximum saturation of gas phase.
Definition
CapillaryPressureRegularizedVanGenuchten.h:57
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::p_b_
double const p_b_
Definition
CapillaryPressureRegularizedVanGenuchten.h:61
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::getPcBarvGSg
double getPcBarvGSg(double const Sg) const
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:91
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::getPcvGSg
double getPcvGSg(double const Sg) const
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:103
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::getdPcdSvGBar
double getdPcdSvGBar(double const Sg) const
Gets .
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:110
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::getSBar
double getSBar(double const Sg) const
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:98
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::CapillaryPressureRegularizedVanGenuchten
CapillaryPressureRegularizedVanGenuchten(double const residual_liquid_saturation, double const maximum_liquid_saturation, double const exponent, double const p_b)
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:25
MaterialPropertyLib::CapillaryPressureRegularizedVanGenuchten::dPcdSvGBarSg_max_
double const dPcdSvGBarSg_max_
Definition
CapillaryPressureRegularizedVanGenuchten.h:66
MaterialPropertyLib::Property::value
virtual PropertyDataType value() const
Definition
MaterialLib/MPL/Property.cpp:67
MaterialPropertyLib::VariableArray
Definition
VariableType.h:94
MaterialPropertyLib::VariableArray::liquid_saturation
double liquid_saturation
Definition
VariableType.h:178
ParameterLib::SpatialPosition
Definition
SpatialPosition.h:21
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:98
MaterialPropertyLib::Variable
Variable
Definition
VariableType.h:21
MaterialPropertyLib::Variable::liquid_saturation
@ liquid_saturation
Definition
VariableType.h:34
MaterialPropertyLib::checkSaturationRange
void checkSaturationRange(const double Sl)
Definition
CapillaryPressureRegularizedVanGenuchten.cpp:16
MaterialPropertyLib::residual_liquid_saturation
@ residual_liquid_saturation
Definition
PropertyType.h:72
MaterialPropertyLib::checkVanGenuchtenExponentRange
void checkVanGenuchtenExponentRange(const double m)
Definition
CheckVanGenuchtenExponentRange.cpp:10
MaterialPropertyLib::PropertyDataType
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 >, Eigen::MatrixXd > PropertyDataType
Definition
MaterialLib/MPL/Property.h:24
MaterialLib
MPL
Properties
CapillaryPressureSaturation
CapillaryPressureRegularizedVanGenuchten.cpp
Generated by
1.14.0