OGS
CapillaryPressureVanGenuchten.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 "
CapillaryPressureVanGenuchten.h
"
5
6
#include <algorithm>
7
#include <cmath>
8
9
#include "
MaterialLib/MPL/Medium.h
"
10
11
namespace
MaterialPropertyLib
12
{
13
CapillaryPressureVanGenuchten::CapillaryPressureVanGenuchten
(
14
std::string
name
,
15
double
const
residual_liquid_saturation
,
16
double
const
residual_gas_saturation
,
17
double
const
exponent,
18
double
const
p_b,
19
double
const
maximum_capillary_pressure)
20
:
S_L_res_
(
residual_liquid_saturation
),
21
S_L_max_
(1. -
residual_gas_saturation
),
22
m_
(exponent),
23
p_b_
(p_b),
24
p_cap_max_
(maximum_capillary_pressure)
25
{
26
name_
= std::move(
name
);
27
28
if
(
S_L_res_ < 0 || S_L_res_ >
1)
29
{
30
OGS_FATAL
(
31
"Van Genuchten capillary pressure model: The residual liquid "
32
"saturation value S_L_res = {:g} is out of admissible range [0, "
33
"1]."
,
34
S_L_res_
);
35
}
36
if
(
S_L_max_ < 0 || S_L_max_ >
1)
37
{
38
OGS_FATAL
(
39
"Van Genuchten capillary pressure model: The maximum liquid "
40
"saturation value S_L_max = {:g} is out of admissible range [0, "
41
"1]."
,
42
S_L_max_
);
43
}
44
if
(
S_L_res_
>=
S_L_max_
)
45
{
46
OGS_FATAL
(
47
"Van Genuchten capillary pressure model: The maximum liquid "
48
"saturation S_L_max = {:g} must not be less or equal to the "
49
"residual liquid saturion S_L_res = {:g}."
,
50
S_L_max_
,
S_L_res_
);
51
}
52
if
(!(
m_
> 0 &&
m_
< 1))
53
{
54
OGS_FATAL
(
55
"Van Genuchten capillary pressure model: The exponent value m = "
56
"{:g} is out of of admissible range (0, 1)."
,
57
m_
);
58
}
59
if
(
p_b_
<= 0)
60
{
61
OGS_FATAL
(
62
"Van Genuchten capillary pressure model: The pressure scaling "
63
"value p_b = {:g} must be positive."
,
64
p_b_
);
65
}
66
if
(
p_cap_max_
< 0)
67
{
68
OGS_FATAL
(
69
"Van Genuchten capillary pressure model: The maximum capillary "
70
"pressure value p_cap_max = {:g} must be non-negative."
,
71
p_cap_max_
);
72
}
73
}
74
75
PropertyDataType
CapillaryPressureVanGenuchten::value
(
76
VariableArray
const
& variable_array,
77
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
78
double
const
/*dt*/
)
const
79
{
80
double
const
S_L = variable_array.
liquid_saturation
;
81
82
if
(S_L <=
S_L_res_
)
83
{
84
return
p_cap_max_
;
85
}
86
87
if
(S_L >=
S_L_max_
)
88
{
89
return
0.;
90
}
91
92
double
const
S_eff = (S_L -
S_L_res_
) / (
S_L_max_
-
S_L_res_
);
93
assert(0 <= S_eff && S_eff <= 1);
94
95
double
const
p_cap =
96
p_b_
* std::pow(std::pow(S_eff, -1.0 /
m_
) - 1.0, 1.0 -
m_
);
97
assert(p_cap > 0);
98
return
std::min(p_cap,
p_cap_max_
);
99
}
100
101
PropertyDataType
CapillaryPressureVanGenuchten::dValue
(
102
VariableArray
const
& variable_array,
Variable
const
variable,
103
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
104
double
const
/*dt*/
)
const
105
{
106
if
(variable !=
Variable::liquid_saturation
)
107
{
108
OGS_FATAL
(
109
"CapillaryPressureVanGenuchten::dValue is implemented for "
110
"derivatives with respect to liquid saturation only."
);
111
}
112
113
double
const
S_L = variable_array.
liquid_saturation
;
114
115
if
(S_L <=
S_L_res_
)
116
{
117
return
0.;
118
}
119
120
if
(S_L >=
S_L_max_
)
121
{
122
return
0.;
123
}
124
125
double
const
S_eff = (S_L -
S_L_res_
) / (
S_L_max_
-
S_L_res_
);
126
127
assert(0 < S_eff && S_eff < 1.0);
128
129
double
const
val1 = std::pow(S_eff, -1.0 /
m_
);
130
double
const
p_cap =
p_b_
* std::pow(val1 - 1.0, 1.0 -
m_
);
131
if
(p_cap >=
p_cap_max_
)
132
{
133
return
0.;
134
}
135
136
double
const
val2 = std::pow(val1 - 1.0, -
m_
);
137
return
p_b_
* (
m_
- 1.0) * val1 * val2 / (
m_
* (S_L -
S_L_res_
));
138
}
139
}
// namespace MaterialPropertyLib
CapillaryPressureVanGenuchten.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:19
Medium.h
MaterialPropertyLib::CapillaryPressureVanGenuchten::m_
double const m_
Exponent.
Definition
CapillaryPressureVanGenuchten.h:70
MaterialPropertyLib::CapillaryPressureVanGenuchten::S_L_res_
double const S_L_res_
Residual saturation of liquid phase.
Definition
CapillaryPressureVanGenuchten.h:68
MaterialPropertyLib::CapillaryPressureVanGenuchten::p_b_
double const p_b_
Pressure scaling factor.
Definition
CapillaryPressureVanGenuchten.h:71
MaterialPropertyLib::CapillaryPressureVanGenuchten::dValue
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Definition
CapillaryPressureVanGenuchten.cpp:101
MaterialPropertyLib::CapillaryPressureVanGenuchten::S_L_max_
double const S_L_max_
Maximum saturation of liquid phase.
Definition
CapillaryPressureVanGenuchten.h:69
MaterialPropertyLib::CapillaryPressureVanGenuchten::p_cap_max_
double const p_cap_max_
Maximum capillary pressure.
Definition
CapillaryPressureVanGenuchten.h:72
MaterialPropertyLib::CapillaryPressureVanGenuchten::CapillaryPressureVanGenuchten
CapillaryPressureVanGenuchten(std::string name, double const residual_liquid_saturation, double const residual_gas_saturation, double const exponent, double const p_b, double const maximum_capillary_pressure)
Definition
CapillaryPressureVanGenuchten.cpp:13
MaterialPropertyLib::Property::value
virtual PropertyDataType value() const
Definition
MaterialLib/MPL/Property.cpp:67
MaterialPropertyLib::Property::name_
std::string name_
Definition
MaterialLib/MPL/Property.h:283
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::name
@ name
Definition
PropertyType.h:57
MaterialPropertyLib::residual_liquid_saturation
@ residual_liquid_saturation
Definition
PropertyType.h:72
MaterialPropertyLib::residual_gas_saturation
@ residual_gas_saturation
Definition
PropertyType.h:71
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
CapillaryPressureVanGenuchten.cpp
Generated by
1.14.0