OGS
RelPermLiakopoulos.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
5
6#include <algorithm>
7#include <cmath>
8
10
11namespace MaterialPropertyLib
12{
14{
15 name_ = std::move(name);
16}
17
19 VariableArray const& variable_array,
20 ParameterLib::SpatialPosition const& pos, double const t,
21 double const dt) const
22{
27 auto const s_L = std::visit(
28 [&variable_array, &pos, t, dt](auto&& scale) -> double
29 {
30 return scale->property(PropertyType::saturation)
31 .template value<double>(variable_array, pos, t, dt);
32 },
33 scale_);
34 auto const s_L_res = residual_liquid_saturation_;
35
36 if (s_L <= s_L_res)
37 {
38 return 0.0;
39 }
40
41 if (s_L >= 1.)
42 {
43 return 1.0;
44 }
45
46 auto const a = parameter_a_;
47 auto const b = parameter_b_;
48
49 auto const k_rel_LR = 1. - a * std::pow(1. - s_L, b);
50
51 return std::max(k_rel_LR, 0.);
52}
53
55 VariableArray const& variable_array, Variable const variable,
56 ParameterLib::SpatialPosition const& pos, double const t,
57 double const dt) const
58{
59 if (variable != Variable::liquid_saturation)
60 {
62 "RelPermLiakopoulos::dValue is implemented for derivatives with "
63 "respect to liquid saturation only.");
64 }
69 auto const s_L = std::visit(
70 [&variable_array, &pos, t, dt](auto&& scale) -> double
71 {
72 return scale->property(PropertyType::saturation)
73 .template value<double>(variable_array, pos, t, dt);
74 },
75 scale_);
76 auto const s_L_res = residual_liquid_saturation_;
77 auto const s_L_max = maximal_liquid_saturation_;
78
79 const double s_L_within_range = std::min(std::max(s_L_res, s_L), s_L_max);
80
81 auto const a = parameter_a_;
82 auto const b = parameter_b_;
83
84 return a * b * std::pow(1. - s_L_within_range, b - 1.);
85}
86
87} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
virtual PropertyDataType value() const
std::variant< Medium *, Phase *, Component * > scale_
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