OGS
RelPermUdellNonwettingPhase.cpp
Go to the documentation of this file.
1
14
#include "
RelPermUdellNonwettingPhase.h
"
15
16
#include <algorithm>
17
#include <cmath>
18
19
#include "
MaterialLib/MPL/Medium.h
"
20
21
namespace
MaterialPropertyLib
22
{
23
RelPermUdellNonwettingPhase::RelPermUdellNonwettingPhase
(
24
std::string
name
,
25
const
double
residual_liquid_saturation
,
26
const
double
residual_gas_saturation
,
27
const
double
min_relative_permeability)
28
: residual_liquid_saturation_(
residual_liquid_saturation
),
29
residual_gas_saturation_(
residual_gas_saturation
),
30
min_relative_permeability_(min_relative_permeability)
31
{
32
name_
= std::move(
name
);
33
}
34
35
PropertyDataType
RelPermUdellNonwettingPhase::value
(
36
VariableArray
const
& variable_array,
37
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
38
double
const
/*dt*/
)
const
39
{
40
const
double
S_L = variable_array.
liquid_saturation
;
41
42
if
(std::isnan(S_L))
43
{
44
OGS_FATAL
(
45
"In RelPermUdellNonwettingPhase::value, the liquid saturation is "
46
"NaN."
);
47
}
48
49
auto
const
S_L_res =
residual_liquid_saturation_
;
50
auto
const
S_L_max = 1. -
residual_gas_saturation_
;
51
52
auto
const
S_e = (S_L - S_L_res) / (S_L_max - S_L_res);
53
54
if
(S_e >= 1.0)
55
{
56
// fully saturated medium
57
return
min_relative_permeability_
;
58
}
59
if
(S_e <= 0.0)
60
{
61
// dry medium
62
return
1.0;
63
}
64
65
auto
const
S_e_g = (1. - S_e);
66
67
return
std::max(
min_relative_permeability_
, S_e_g * S_e_g * S_e_g);
68
}
69
PropertyDataType
RelPermUdellNonwettingPhase::dValue
(
70
VariableArray
const
& variable_array,
Variable
const
variable,
71
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
72
double
const
/*dt*/
)
const
73
{
74
if
(variable !=
Variable::liquid_saturation
)
75
{
76
OGS_FATAL
(
77
"RelPermUdellNonwettingPhase::dValue is implemented for "
78
"derivatives with respect to liquid saturation only."
);
79
}
80
81
const
double
S_L = variable_array.
liquid_saturation
;
82
83
auto
const
S_L_res =
residual_liquid_saturation_
;
84
auto
const
S_L_max = 1. -
residual_gas_saturation_
;
85
auto
const
S_e = (S_L - S_L_res) / (S_L_max - S_L_res);
86
87
if
((S_e < 0.) || (S_e > 1.))
88
{
89
return
0.;
90
}
91
92
auto
const
dS_e_dS_L = 1. / (S_L_max - S_L_res);
93
94
auto
const
dk_rel_GR_dS_e = -3. * (1. - S_e) * (1. - S_e);
95
return
dk_rel_GR_dS_e * dS_e_dS_L;
96
}
97
98
}
// namespace MaterialPropertyLib
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
Medium.h
RelPermUdellNonwettingPhase.h
MaterialPropertyLib::Property::value
virtual PropertyDataType value() const
Definition
Property.cpp:76
MaterialPropertyLib::Property::name_
std::string name_
Definition
Property.h:290
MaterialPropertyLib::RelPermUdellNonwettingPhase::dValue
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Definition
RelPermUdellNonwettingPhase.cpp:69
MaterialPropertyLib::RelPermUdellNonwettingPhase::RelPermUdellNonwettingPhase
RelPermUdellNonwettingPhase(std::string name, const double residual_liquid_saturation, const double residual_gas_saturation, const double min_relative_permeability)
Definition
RelPermUdellNonwettingPhase.cpp:23
MaterialPropertyLib::RelPermUdellNonwettingPhase::residual_gas_saturation_
const double residual_gas_saturation_
Definition
RelPermUdellNonwettingPhase.h:46
MaterialPropertyLib::RelPermUdellNonwettingPhase::residual_liquid_saturation_
const double residual_liquid_saturation_
Definition
RelPermUdellNonwettingPhase.h:45
MaterialPropertyLib::RelPermUdellNonwettingPhase::min_relative_permeability_
const double min_relative_permeability_
Definition
RelPermUdellNonwettingPhase.h:47
MaterialPropertyLib::VariableArray
Definition
VariableType.h:99
MaterialPropertyLib::VariableArray::liquid_saturation
double liquid_saturation
Definition
VariableType.h:182
ParameterLib::SpatialPosition
Definition
SpatialPosition.h:27
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:21
MaterialPropertyLib::Variable
Variable
Definition
VariableType.h:30
MaterialPropertyLib::Variable::liquid_saturation
@ liquid_saturation
MaterialPropertyLib::name
@ name
Definition
PropertyType.h:66
MaterialPropertyLib::residual_liquid_saturation
@ residual_liquid_saturation
Definition
PropertyType.h:81
MaterialPropertyLib::residual_gas_saturation
@ residual_gas_saturation
Definition
PropertyType.h:80
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
Property.h:31
MaterialLib
MPL
Properties
RelativePermeability
RelPermUdellNonwettingPhase.cpp
Generated by
1.11.0