OGS
RelPermUdell.cpp
Go to the documentation of this file.
1
14#include "RelPermUdell.h"
15
16#include <algorithm>
17#include <cmath>
18
20
21namespace MaterialPropertyLib
22{
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
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
60 }
61
62 return std::max(min_relative_permeability_, S_e * S_e * S_e);
63}
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 {
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
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
RelPermUdell(std::string name, const double residual_liquid_saturation, const double residual_gas_saturation, const double min_relative_permeability)
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