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