OGS
MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase Class Referencefinal

Detailed Description

Relative permeability function of the non-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 34 of file RelPermBrooksCoreyNonwettingPhase.h.

#include <RelPermBrooksCoreyNonwettingPhase.h>

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

Public Member Functions

 RelPermBrooksCoreyNonwettingPhase (std::string name, const double residual_liquid_saturation, const double residual_gas_saturation, const double min_relative_permeability, const double exponent)
 
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

◆ RelPermBrooksCoreyNonwettingPhase()

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

Member Function Documentation

◆ checkScale()

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

Reimplemented from MaterialPropertyLib::Property.

Definition at line 49 of file RelPermBrooksCoreyNonwettingPhase.h.

50 {
51 if (!std::holds_alternative<Medium*>(scale_))
52 {
54 "The property 'RelPermBrooksCoreyNonwettingPhase' is "
55 "implemented on the 'media' scale only.");
56 }
57 }
#define OGS_FATAL(...)
Definition Error.h:26
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297

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

◆ dValue()

PropertyDataType MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase::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 77 of file RelPermBrooksCoreyNonwettingPhase.cpp.

81{
82 if (variable != Variable::liquid_saturation)
83 {
85 "RelPermBrooksCoreyNonwettingPhase::dValue is implemented for "
86 "derivatives with respect to liquid saturation only.");
87 }
92 auto const s_L = std::visit(
93 [&variable_array, &pos, t, dt](auto&& scale) -> double
94 {
95 return scale->property(PropertyType::saturation)
96 .template value<double>(variable_array, pos, t, dt);
97 },
98 scale_);
99
100 auto const s_L_res = residual_liquid_saturation_;
101 auto const s_L_max = 1. - residual_gas_saturation_;
102 auto const lambda = exponent_;
103
104 auto const s_eff = (s_L - s_L_res) / (s_L_max - s_L_res);
105 if ((s_eff < 0.) || (s_eff > 1.))
106 {
107 return 0.0;
108 }
109
110 auto const twoL_L = (2. + lambda) / lambda;
111 auto const d_se_d_sL = 1. / (s_L_max - s_L_res);
112 auto const dk_rel_GRdse =
113 -2. * (1 - s_eff) * (1. - std::pow(s_eff, twoL_L)) -
114 twoL_L * std::pow(s_eff, twoL_L - 1.) * (1. - s_eff) * (1. - s_eff);
115
116 return dk_rel_GRdse * d_se_d_sL;
117}
virtual PropertyDataType value() const
Definition Property.cpp:76
void scale(PETScVector &x, PetscScalar const a)
Definition LinAlg.cpp:44

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

◆ value()

PropertyDataType MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase::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 37 of file RelPermBrooksCoreyNonwettingPhase.cpp.

41{
46 auto const s_L = std::visit(
47 [&variable_array, &pos, t, dt](auto&& scale) -> double
48 {
49 return scale->property(PropertyType::saturation)
50 .template value<double>(variable_array, pos, t, dt);
51 },
52 scale_);
53
54 auto const s_L_res = residual_liquid_saturation_;
55 auto const s_L_max = 1. - residual_gas_saturation_;
56
57 auto const lambda = exponent_;
58
59 auto const s_eff = (s_L - s_L_res) / (s_L_max - s_L_res);
60
61 if (s_eff >= 1.0)
62 {
63 // fully saturated medium
65 }
66 if (s_eff <= 0.0)
67 {
68 // dry medium
69 return 1.0;
70 }
71
72 auto const k_rel_GR = (1. - s_eff) * (1. - s_eff) *
73 (1. - std::pow(s_eff, (2. + lambda) / lambda));
74
75 return std::max(k_rel_GR, min_relative_permeability_);
76}

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::RelPermBrooksCoreyNonwettingPhase::exponent_
private

Definition at line 40 of file RelPermBrooksCoreyNonwettingPhase.h.

Referenced by dValue(), and value().

◆ min_relative_permeability_

const double MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase::min_relative_permeability_
private

Definition at line 39 of file RelPermBrooksCoreyNonwettingPhase.h.

Referenced by value().

◆ residual_gas_saturation_

const double MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase::residual_gas_saturation_
private

Definition at line 38 of file RelPermBrooksCoreyNonwettingPhase.h.

Referenced by dValue(), and value().

◆ residual_liquid_saturation_

const double MaterialPropertyLib::RelPermBrooksCoreyNonwettingPhase::residual_liquid_saturation_
private

Definition at line 37 of file RelPermBrooksCoreyNonwettingPhase.h.

Referenced by dValue(), and value().


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