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