OGS
RelPermLiakopoulos.cpp
Go to the documentation of this file.
1
13#include "RelPermLiakopoulos.h"
14
15#include <algorithm>
16#include <cmath>
17
19
20namespace MaterialPropertyLib
21{
23{
24 name_ = std::move(name);
25}
26
28 VariableArray const& variable_array,
29 ParameterLib::SpatialPosition const& pos, double const t,
30 double const dt) const
31{
36 auto const s_L = std::visit(
37 [&variable_array, &pos, t, dt](auto&& scale) -> double
38 {
39 return scale->property(PropertyType::saturation)
40 .template value<double>(variable_array, pos, t, dt);
41 },
42 scale_);
43 auto const s_L_res = residual_liquid_saturation_;
44
45 if (s_L <= s_L_res)
46 {
47 return 0.0;
48 }
49
50 if (s_L >= 1.)
51 {
52 return 1.0;
53 }
54
55 auto const a = parameter_a_;
56 auto const b = parameter_b_;
57
58 auto const k_rel_LR = 1. - a * std::pow(1. - s_L, b);
59
60 return std::max(k_rel_LR, 0.);
61}
62
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 {
71 "RelPermLiakopoulos::dValue is implemented for derivatives with "
72 "respect to liquid saturation only.");
73 }
78 auto const s_L = std::visit(
79 [&variable_array, &pos, t, dt](auto&& scale) -> double
80 {
81 return scale->property(PropertyType::saturation)
82 .template value<double>(variable_array, pos, t, dt);
83 },
84 scale_);
85 auto const s_L_res = residual_liquid_saturation_;
86 auto const s_L_max = maximal_liquid_saturation_;
87
88 const double s_L_within_range = std::min(std::max(s_L_res, s_L), s_L_max);
89
90 auto const a = parameter_a_;
91 auto const b = parameter_b_;
92
93 return a * b * std::pow(1. - s_L_within_range, b - 1.);
94}
95
96} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297
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