OGS
MaterialPropertyLib::RelPermBrooksCorey Class Referencefinal

Detailed Description

Relative permeability function of the wetting phase proposed by Brooks&Corey.

This property must be a medium property, it computes the permeability reduction due to saturation as function of capillary pressure.

Definition at line 23 of file RelPermBrooksCorey.h.

#include <RelPermBrooksCorey.h>

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

Public Member Functions

 RelPermBrooksCorey (std::string name, const double, const double, const double, const double)
void checkScale () const override
PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
PropertyDataType dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
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 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 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.
virtual void setProperties (std::vector< std::unique_ptr< Phase > > const &phases)
 Default implementation:
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

const double residual_liquid_saturation_
const double residual_gas_saturation_
const double min_relative_permeability_
const double exponent_

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ RelPermBrooksCorey()

MaterialPropertyLib::RelPermBrooksCorey::RelPermBrooksCorey ( std::string name,
const double residual_liquid_saturation,
const double residual_gas_saturation,
const double min_relative_permeability,
const double exponent )

Definition at line 13 of file RelPermBrooksCorey.cpp.

20 min_relative_permeability_(min_relative_permeability),
21 exponent_(exponent)
22{
23 name_ = std::move(name);
24
25 if (exponent_ <= 0.)
26 {
28 "RelPermBrooksCorey: exponent 'lambda' must be positive, but {} "
29 "was given.",
30 exponent_);
31 }
33 {
35 "RelPermBrooksCorey: residual_liquid_saturation must be "
36 "non-negative, but {} was given.",
38 }
40 {
42 "RelPermBrooksCorey: residual_gas_saturation must be non-negative, "
43 "but {} was given.",
45 }
47 {
49 "RelPermBrooksCorey: residual_liquid_saturation ({}) + "
50 "residual_gas_saturation ({}) must be less than 1 so that the "
51 "effective saturation range is positive.",
53 }
55 {
57 "RelPermBrooksCorey: min_relative_permeability must be in [0, 1], "
58 "but {} was given.",
60 }
61};
#define OGS_FATAL(...)
Definition Error.h:10

References exponent_, min_relative_permeability_, MaterialPropertyLib::name, MaterialPropertyLib::Property::name_, OGS_FATAL, MaterialPropertyLib::residual_gas_saturation, residual_gas_saturation_, MaterialPropertyLib::residual_liquid_saturation, and residual_liquid_saturation_.

Member Function Documentation

◆ checkScale()

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

Reimplemented from MaterialPropertyLib::Property.

Definition at line 39 of file RelPermBrooksCorey.h.

40 {
41 if (!std::holds_alternative<Medium*>(scale_))
42 {
44 "The property 'RelPermBrooksCorey' is implemented on the "
45 "'media' scale only.");
46 }
47 }
std::variant< Medium *, Phase *, Component * > scale_

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

◆ dValue()

PropertyDataType MaterialPropertyLib::RelPermBrooksCorey::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.

here, an extra computation of saturation is forced, guaranteeing a correct value. In order to speed up the computing time, saturation could be inserted into the primary variable array after it is computed in the FEM assembly.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 102 of file RelPermBrooksCorey.cpp.

106{
107 if (variable != Variable::liquid_saturation)
108 {
109 OGS_FATAL(
110 "RelPermBrooksCorey::dValue is implemented for derivatives with "
111 "respect to liquid saturation only.");
112 }
113
118 auto const s_L = std::visit(
119 [&variable_array, &pos, t, dt](auto&& scale) -> double
120 {
121 return scale->property(PropertyType::saturation)
122 .template value<double>(variable_array, pos, t, dt);
123 },
124 scale_);
125
126 auto const s_L_res = residual_liquid_saturation_;
127 auto const s_L_max = 1. - residual_gas_saturation_;
128 auto const lambda = exponent_;
129
130 auto const s_eff = (s_L - s_L_res) / (s_L_max - s_L_res);
131 // Consistency with value(): at s_eff == 1 the value is clamped to the
132 // constant 1.0 (and saturation models clamping S_L at s_L_max put whole
133 // regions exactly on this point), so the derivative there is zero.
134 if ((s_eff < 0.) || (s_eff >= 1.))
135 {
136 return 0.;
137 }
138
139 // Consistency with value(): where the min_relative_permeability clamp is
140 // active (dry range), the relative permeability is constant and its
141 // derivative is zero.
142 auto const k_rel_LR = std::pow(s_eff, (2. + 3. * lambda) / lambda);
143 if (k_rel_LR <= min_relative_permeability_)
144 {
145 return 0.;
146 }
147
148 auto const d_se_d_sL = 1. / (s_L_max - s_L_res);
149 auto const dk_rel_LRdse =
150 (3 * lambda + 2.) / lambda * std::pow(s_eff, 2. / lambda + 2.);
151
152 return dk_rel_LRdse * d_se_d_sL;
153}
virtual PropertyDataType value() const
void scale(PETScVector &x, PetscScalar const a)
Definition LinAlg.cpp:37

References exponent_, MaterialPropertyLib::liquid_saturation, min_relative_permeability_, OGS_FATAL, residual_gas_saturation_, residual_liquid_saturation_, MaterialPropertyLib::saturation, MaterialPropertyLib::Property::scale_, and MaterialPropertyLib::Property::value().

◆ value()

PropertyDataType MaterialPropertyLib::RelPermBrooksCorey::value ( VariableArray const & variable_array,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

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

here, an extra computation of saturation is forced, guaranteeing a correct value. In order to speed up the computing time, saturation could be inserted into the primary variable array after it is computed in the FEM assembly.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 63 of file RelPermBrooksCorey.cpp.

67{
72 auto const s_L = std::visit(
73 [&variable_array, &pos, t, dt](auto&& scale) -> double
74 {
75 return scale->property(PropertyType::saturation)
76 .template value<double>(variable_array, pos, t, dt);
77 },
78 scale_);
79
80 auto const s_L_res = residual_liquid_saturation_;
81 auto const s_L_max = 1. - residual_gas_saturation_;
82
83 auto const lambda = exponent_;
84
85 auto const s_eff = (s_L - s_L_res) / (s_L_max - s_L_res);
86
87 if (s_eff >= 1.0)
88 {
89 // fully saturated medium
90 return 1.0;
91 }
92 if (s_eff <= 0.0)
93 {
94 // dry medium
96 }
97
98 auto const k_rel_LR = std::pow(s_eff, (2. + 3. * lambda) / lambda);
99
100 return std::max(k_rel_LR, min_relative_permeability_);
101}

References exponent_, min_relative_permeability_, residual_gas_saturation_, residual_liquid_saturation_, MaterialPropertyLib::saturation, MaterialPropertyLib::Property::scale_, and MaterialPropertyLib::Property::value().

Member Data Documentation

◆ exponent_

const double MaterialPropertyLib::RelPermBrooksCorey::exponent_
private

Definition at line 29 of file RelPermBrooksCorey.h.

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

◆ min_relative_permeability_

const double MaterialPropertyLib::RelPermBrooksCorey::min_relative_permeability_
private

Definition at line 28 of file RelPermBrooksCorey.h.

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

◆ residual_gas_saturation_

const double MaterialPropertyLib::RelPermBrooksCorey::residual_gas_saturation_
private

Definition at line 27 of file RelPermBrooksCorey.h.

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

◆ residual_liquid_saturation_

const double MaterialPropertyLib::RelPermBrooksCorey::residual_liquid_saturation_
private

Definition at line 26 of file RelPermBrooksCorey.h.

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


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