OGS
MaterialPropertyLib::SaturationVanGenuchten Class Referencefinal

Detailed Description

The van Genuchten capillary pressure model.

The van Genuchten capillary pressure model ([37]) is:

\[p_c(S)=p_b (S_\text{eff}^{-1/m}-1)^{1-m}\]

with effective saturation defined as

\[S_\text{eff}=\frac{S-S_r}{S_{\text{max}}-S_r}.\]

Above, \(S_r\) and \(S_{\text{max}}\) are the residual and the maximum saturations. The exponent \(m \in (0,1)\) and the pressure scaling parameter \(p_b\) (it is equal to \(\rho g/\alpha\) in original publication) are given by the user. The scaling parameter \(p_b\) is given in same units as pressure.

In the original work another exponent \(n\) is used, but usually set to \(n = 1 / (1 - m)\), and also in this implementation.

The saturation is computed from the capillary pressure as follows:

\[S(p_c)= \begin{cases} S_{\text{max}} & \text{for $p_c \leq 0$, and}\\ \left( \left(\frac{p_c}{p_b}\right)^{\frac{1}{1-m}} +1\right)^{-m} (S_{\text{max}}-S_r) +S_r& \text{for $p_c > 0$.} \end{cases} \]

The result is then clamped between the residual and maximum liquid saturations.

Definition at line 46 of file SaturationVanGenuchten.h.

#include <SaturationVanGenuchten.h>

Inheritance diagram for MaterialPropertyLib::SaturationVanGenuchten:
[legend]
Collaboration diagram for MaterialPropertyLib::SaturationVanGenuchten:
[legend]

Public Member Functions

 SaturationVanGenuchten (std::string name, double const residual_liquid_saturation, double const residual_gas_saturation, double const exponent, double const p_b)
 
void checkScale () const override
 
PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &, double const, double const) const override
 
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. More...
 
- Public Member Functions inherited from MaterialPropertyLib::Property
virtual ~Property ()
 
virtual PropertyDataType initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
 
virtual PropertyDataType value () const
 
virtual PropertyDataType value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
virtual PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
virtual PropertyDataType dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
virtual PropertyDataType dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
virtual PropertyDataType d2Value (VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 Default implementation: 2nd derivative of any constant property is zero. More...
 
virtual void setProperties (std::vector< std::unique_ptr< Phase > > const &phases)
 Default implementation: More...
 
void setScale (std::variant< Medium *, Phase *, Component * > scale)
 
template<typename T >
initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
 
template<typename T >
value () const
 
template<typename T >
value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
template<typename T >
value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
template<typename T >
dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
template<typename T >
dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
template<typename T >
d2Value (VariableArray const &variable_array, Variable const &variable1, Variable const &variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 

Private Attributes

double const S_L_res_
 
double const S_L_max_
 
double const m_
 
double const p_b_
 

Additional Inherited Members

- Protected Attributes inherited from MaterialPropertyLib::Property
std::string name_
 
PropertyDataType value_
 The single value of a property. More...
 
PropertyDataType dvalue_
 
std::variant< Medium *, Phase *, Component * > scale_
 

Constructor & Destructor Documentation

◆ SaturationVanGenuchten()

MaterialPropertyLib::SaturationVanGenuchten::SaturationVanGenuchten ( std::string  name,
double const  residual_liquid_saturation,
double const  residual_gas_saturation,
double const  exponent,
double const  p_b 
)

Definition at line 20 of file SaturationVanGenuchten.cpp.

28 m_(exponent),
29 p_b_(p_b)
30{
31 name_ = std::move(name);
32
33 if (!(m_ > 0 && m_ < 1))
34 {
36 "The exponent value m = {:g} of van Genuchten saturation model, is "
37 "out of its range of (0, 1)",
38 m_);
39 }
40}
#define OGS_FATAL(...)
Definition: Error.h:26

References m_, MaterialPropertyLib::name, MaterialPropertyLib::Property::name_, and OGS_FATAL.

Member Function Documentation

◆ checkScale()

void MaterialPropertyLib::SaturationVanGenuchten::checkScale ( ) const
inlineoverridevirtual

Reimplemented from MaterialPropertyLib::Property.

Definition at line 55 of file SaturationVanGenuchten.h.

56 {
57 if (!std::holds_alternative<Medium*>(scale_))
58 {
60 "The property 'SaturationVanGenuchten' is implemented on the "
61 "'media' scale only.");
62 }
63 }
std::variant< Medium *, Phase *, Component * > scale_
Definition: Property.h:297

References OGS_FATAL, and MaterialPropertyLib::Property::scale_.

◆ d2Value()

PropertyDataType MaterialPropertyLib::SaturationVanGenuchten::d2Value ( VariableArray const &  variable_array,
Variable const  variable1,
Variable const  variable2,
ParameterLib::SpatialPosition const &  pos,
double const  t,
double const  dt 
) const
overridevirtual

Default implementation: 2nd derivative of any constant property is zero.

This virtual method will compute the second derivative of a property with respect to the given variables pv1 and pv2.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 102 of file SaturationVanGenuchten.cpp.

107{
108 (void)primary_variable1;
109 (void)primary_variable2;
110 assert((primary_variable1 == Variable::capillary_pressure) &&
111 (primary_variable2 == Variable::capillary_pressure) &&
112 "SaturationVanGenuchten::d2Value is implemented for derivatives "
113 "with respect to capillary pressure only.");
114
115 const double p_cap = std::get<double>(
116 variable_array[static_cast<int>(Variable::capillary_pressure)]);
117
118 if (p_cap <= 0)
119 {
120 return 0.;
121 }
122
123 double const p = p_cap / p_b_;
124 double const n = 1. / (1. - m_);
125 double const p_to_n = std::pow(p, n);
126
127 double const S_eff = std::pow(p_to_n + 1., -m_);
128 double const S = S_eff * S_L_max_ - S_eff * S_L_res_ + S_L_res_;
129
130 if (S < S_L_res_ || S > S_L_max_)
131 {
132 return 0.;
133 }
134
135 double const d2S_eff_dp_cap2 =
136 m_ * p_to_n * std::pow(p_to_n + 1., -m_ - 2.) * (p_to_n - m_) /
137 (p_cap * p_cap * (m_ - 1.) * (m_ - 1.));
138 return d2S_eff_dp_cap2 * (S_L_max_ - S_L_res_);
139}

References MaterialPropertyLib::capillary_pressure, m_, p_b_, S_L_max_, and S_L_res_.

◆ dValue()

PropertyDataType MaterialPropertyLib::SaturationVanGenuchten::dValue ( VariableArray const &  variable_array,
Variable const  variable,
ParameterLib::SpatialPosition const &  pos,
double const  t,
double const  dt 
) const
overridevirtual

This virtual method will compute the property derivative value based on the variables that are passed as arguments with the default implementation using empty variables array for the previous time step.

The default implementation of this method only returns the property value derivative without altering it.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 64 of file SaturationVanGenuchten.cpp.

68{
69 if (primary_variable != Variable::capillary_pressure)
70 {
72 "SaturationVanGenuchten::dValue is implemented for derivatives "
73 "with respect to capillary pressure only.");
74 }
75
76 const double p_cap = std::get<double>(
77 variable_array[static_cast<int>(Variable::capillary_pressure)]);
78
79 if (p_cap <= 0)
80 {
81 return 0.;
82 }
83
84 double const p = p_cap / p_b_;
85 double const n = 1. / (1. - m_);
86 double const p_to_n = std::pow(p, n);
87
88 double const S_eff = std::pow(p_to_n + 1., -m_);
89 double const S = S_eff * S_L_max_ - S_eff * S_L_res_ + S_L_res_;
90
91 if (S < S_L_res_ || S > S_L_max_)
92 {
93 return 0.;
94 }
95
96 double const dS_eff_dp_cap = -m_ * std::pow(p, n - 1) *
97 std::pow(1 + p_to_n, -1. - m_) /
98 (p_b_ * (1. - m_));
99 return dS_eff_dp_cap * (S_L_max_ - S_L_res_);
100}

References MaterialPropertyLib::capillary_pressure, m_, OGS_FATAL, p_b_, S_L_max_, and S_L_res_.

◆ value()

PropertyDataType MaterialPropertyLib::SaturationVanGenuchten::value ( VariableArray const &  variable_array,
ParameterLib::SpatialPosition const &  ,
double const  ,
double const   
) const
overridevirtual

Those methods override the base class implementations and actually compute and set the property values_ and dValues_.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 42 of file SaturationVanGenuchten.cpp.

46{
47 const double p_cap = std::get<double>(
48 variable_array[static_cast<int>(Variable::capillary_pressure)]);
49
50 if (p_cap <= 0)
51 {
52 return S_L_max_;
53 }
54
55 double const p = p_cap / p_b_;
56 double const n = 1. / (1. - m_);
57 double const p_to_n = std::pow(p, n);
58
59 double const S_eff = std::pow(p_to_n + 1., -m_);
60 double const S = S_eff * S_L_max_ - S_eff * S_L_res_ + S_L_res_;
61 return std::clamp(S, S_L_res_, S_L_max_);
62}

References MaterialPropertyLib::capillary_pressure, m_, p_b_, S_L_max_, and S_L_res_.

Member Data Documentation

◆ m_

double const MaterialPropertyLib::SaturationVanGenuchten::m_
private

Definition at line 85 of file SaturationVanGenuchten.h.

Referenced by SaturationVanGenuchten(), d2Value(), dValue(), and value().

◆ p_b_

double const MaterialPropertyLib::SaturationVanGenuchten::p_b_
private

Definition at line 86 of file SaturationVanGenuchten.h.

Referenced by d2Value(), dValue(), and value().

◆ S_L_max_

double const MaterialPropertyLib::SaturationVanGenuchten::S_L_max_
private

Definition at line 84 of file SaturationVanGenuchten.h.

Referenced by d2Value(), dValue(), and value().

◆ S_L_res_

double const MaterialPropertyLib::SaturationVanGenuchten::S_L_res_
private

Definition at line 83 of file SaturationVanGenuchten.h.

Referenced by d2Value(), dValue(), and value().


The documentation for this class was generated from the following files: