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