OGS
CapillaryPressureRegularizedVanGenuchten.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
9#include "BaseLib/Error.h"
13
14namespace MaterialPropertyLib
15{
16void checkSaturationRange(const double Sl)
17{
18 if (Sl < 0 || Sl > 1)
19 {
20 OGS_FATAL("The saturation of {:e} is out of its range of [0, 1]", Sl);
21 }
22}
23
26 double const residual_liquid_saturation,
27 double const maximum_liquid_saturation,
28 double const exponent,
29 double const p_b)
30 : Sg_r_(1.0 - maximum_liquid_saturation),
32 m_(exponent),
33 p_b_(p_b),
36{
38}
39
41 VariableArray const& variable_array,
42 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
43 double const /*dt*/) const
44{
45 const double Sl = variable_array.liquid_saturation;
46
48
49 double const Sg = 1 - Sl;
50 if (!(Sg < Sg_r_ || Sg > Sg_max_))
51 {
52 return getPcBarvGSg(Sg);
53 }
54 if (Sg < Sg_r_)
55 {
56 return 0.0;
57 }
58
60}
61
63 VariableArray const& variable_array, Variable const variable,
64 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
65 double const /*dt*/) const
66{
67 if (variable != Variable::liquid_saturation)
68 {
70 "CapillaryPressureRegularizedVanGenuchten::dValue is implemented "
71 "for derivatives with respect to liquid saturation only.");
72 }
73
74 const double Sl = variable_array.liquid_saturation;
75
77
78 double const Sg = 1 - Sl;
79 if (!(Sg < Sg_r_ || Sg > Sg_max_))
80 {
81 return -getdPcdSvGBar(Sg);
82 }
83 if (Sg < Sg_r_)
84 {
85 return 0.0;
86 }
87
88 return -dPcdSvGBarSg_max_;
89}
90
92 double const Sg) const
93{
94 double const S_bar = getSBar(Sg);
95 return getPcvGSg(S_bar) - getPcvGSg(Sg_r_ + (Sg_max_ - Sg_r_) * xi_ / 2);
96}
97
99{
100 return Sg_r_ + (1 - xi_) * (Sg - Sg_r_) + 0.5 * xi_ * (Sg_max_ - Sg_r_);
101}
102
104 double const Sg) const
105{
106 double const Se = (Sg_max_ - Sg) / (Sg_max_ - Sg_r_);
107 return p_b_ * std::pow(std::pow(Se, (-1.0 / m_)) - 1.0, 1.0 - m_);
108}
109
111 double const Sg) const
112{
113 double S_bar = getSBar(Sg);
114 return getdPcdSvG(S_bar) * (1 - xi_);
115}
116
118 const double Sg) const
119{
120 double const n = 1 / (1 - m_);
121 double const Se = (Sg_max_ - Sg) / (Sg_max_ - Sg_r_);
122 auto const temp = std::pow(Se, (-1 / m_));
123 return p_b_ * (1 / (m_ * n)) * (1 / (Sg_max_ - Sg_r_)) *
124 std::pow(temp - 1, (1 / n) - 1) * temp / Se;
125}
126
127} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
static constexpr double xi_
parameter in regularized van Genuchten model
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
CapillaryPressureRegularizedVanGenuchten(double const residual_liquid_saturation, double const maximum_liquid_saturation, double const exponent, double const p_b)
virtual PropertyDataType value() const
void checkVanGenuchtenExponentRange(const double m)
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