OGS
SaturationLiakopoulos.cpp
Go to the documentation of this file.
1
15
16#include <algorithm>
17#include <cmath>
18
20#include "MathLib/MathTools.h"
21
22namespace MaterialPropertyLib
23{
25 VariableArray const& variable_array,
26 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
27 double const /*dt*/) const
28{
29 const double p_cap = variable_array.capillary_pressure;
30
31 if (p_cap < 0.)
32 return 1.;
33
34 return std::max(residual_liquid_saturation_,
35 1. - parameter_a_ * std::pow(p_cap, parameter_b_));
36}
37
39 VariableArray const& variable_array, Variable const variable,
40 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
41 double const /*dt*/) const
42{
43 if (variable != Variable::capillary_pressure)
44 {
46 "SaturationLiakopoulos::dValue is implemented for derivatives with "
47 "respect to capillary pressure only.");
48 }
49
50 const double p_cap = variable_array.capillary_pressure;
51 if (p_cap <= 0.)
52 {
53 return 0.;
54 }
55 const double p_cap_restricted = std::min(p_cap, p_cap_max_);
56
57 return -parameter_a_ * parameter_b_ *
58 std::pow(p_cap_restricted, parameter_b_ - 1.);
59}
60
62 VariableArray const& variable_array, Variable const variable1,
63 Variable const variable2, ParameterLib::SpatialPosition const& /*pos*/,
64 double const /*t*/, double const /*dt*/) const
65{
66 if ((variable1 != Variable::capillary_pressure) &&
67 (variable2 != Variable::capillary_pressure))
68 {
70 "SaturationLiakopoulos::d2Value is implemented for derivatives "
71 "with respect to capillary pressure only.");
72 }
73
74 const double p_cap = variable_array.capillary_pressure;
75
76 if (p_cap < 0.)
77 {
78 return 0.;
79 }
80 const double p_cap_restricted = std::min(p_cap, p_cap_max_);
81 return -parameter_a_ * (parameter_b_ - 1.) * parameter_b_ *
82 std::pow(p_cap_restricted, parameter_b_ - 2.);
83}
84
85} // 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 &, double const, double const) const override
PropertyDataType d2Value(VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &, double const, double const) const override
Default implementation: 2nd derivative of any constant property is zero.
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