OGS
RelPermGeneralizedPower.cpp
Go to the documentation of this file.
1
12
13#include <cmath>
14
16
17namespace MaterialPropertyLib
18{
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
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 {
45 "In RelPermGeneralizedPower::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 a_;
58 }
59 if (S_e <= 0.0)
60 {
61 // dry medium
63 }
64
65 return a_ * std::pow(S_e, lambda_);
66}
68 VariableArray const& variable_array, Variable const variable,
69 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
70 double const /*dt*/) const
71{
72 if (variable != Variable::liquid_saturation)
73 {
75 "RelPermGeneralizedPower::dValue is implemented for "
76 "derivatives with respect to liquid saturation only.");
77 }
78
79 const double S_L = variable_array.liquid_saturation;
80
81 auto const S_L_res = residual_liquid_saturation_;
82 auto const S_L_max = 1. - residual_gas_saturation_;
83 auto const S_e = (S_L - S_L_res) / (S_L_max - S_L_res);
84
85 if ((S_e < 0.) || (S_e > 1.))
86 {
87 return 0.;
88 }
89
90 auto const dS_e_dS_L = 1. / (S_L_max - S_L_res);
91
92 auto const dk_rel_dS_e = lambda_ * a_ * std::pow(S_e, lambda_ - 1);
93 return dk_rel_dS_e * dS_e_dS_L;
94}
95
96} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
RelPermGeneralizedPower(std::string name, const double residual_liquid_saturation, const double residual_gas_saturation, const double min_relative_permeability, const double a, const double lambda)
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
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