OGS
GasPressureDependentPermeability.cpp
Go to the documentation of this file.
1
13
14#include <cmath>
15#include <limits>
16
17#include "BaseLib/Error.h"
19#include "MathLib/MathTools.h"
22
23namespace MaterialPropertyLib
24{
25template <int DisplacementDim>
28 std::string name, ParameterLib::Parameter<double> const& k0,
29 double const a1, double const a2, double const pressure_threshold,
30 double const minimum_permeability, double const maximum_permeability,
31 ParameterLib::CoordinateSystem const* const local_coordinate_system)
32 : k0_(k0),
33 a1_(a1),
34 a2_(a2),
35 pressure_threshold_(pressure_threshold),
36 minimum_permeability_(minimum_permeability),
37 maximum_permeability_(maximum_permeability),
38 local_coordinate_system_(local_coordinate_system)
39{
40 name_ = std::move(name);
41}
42
43template <int DisplacementDim>
45{
46 if (!std::holds_alternative<Medium*>(scale_))
47 {
49 "The property 'GasPressureDependentPermeability' is implemented on "
50 "the 'medium' scale only.");
51 }
52}
53
54template <int DisplacementDim>
56 VariableArray const& variable_array,
57 ParameterLib::SpatialPosition const& pos, double const t,
58 double const /*dt*/) const
59{
60 double const gas_pressure = variable_array.gas_phase_pressure;
61
62 auto k_data = k0_(t, pos);
63
64 double const factor =
65 (gas_pressure <= pressure_threshold_)
66 ? (1.0 + a1_ * gas_pressure / 1.0e6)
67 : (a2_ * (gas_pressure - pressure_threshold_) / 1.0e6 + 1.0 +
68 a1_ * pressure_threshold_ / 1.0e6);
69
70 for (auto& k_i : k_data)
71 {
72 k_i = std::clamp(k_i * factor, minimum_permeability_,
73 maximum_permeability_);
74 }
75
76 // Local coordinate transformation is only applied for the case that the
77 // initial intrinsic permeability is given with orthotropic assumption.
78 if (local_coordinate_system_ && (k_data.size() == DisplacementDim))
79 {
80 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const e =
81 local_coordinate_system_->transformation<DisplacementDim>(pos);
82 Eigen::Matrix<double, DisplacementDim, DisplacementDim> k =
83 Eigen::Matrix<double, DisplacementDim, DisplacementDim>::Zero();
84
85 for (int i = 0; i < DisplacementDim; ++i)
86 {
87 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const
88 ei_otimes_ei = e.col(i) * e.col(i).transpose();
89
90 k += k_data[i] * ei_otimes_ei;
91 }
92 return k;
93 }
94
95 return fromVector(k_data);
96}
97
98template <int DisplacementDim>
100 VariableArray const& /*variable_array*/, Variable const /*variable*/,
101 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
102 double const /*dt*/) const
103{
104 OGS_FATAL(
105 "The derivative of the intrinsic permeability of "
106 "GasPressureDependentPermeability"
107 "is not implemented.");
108}
109
112} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
A gas pressure dependent intrinsic permeability model.
GasPressureDependentPermeability(std::string name, ParameterLib::Parameter< double > const &k0, double const a1, double const a2, double const pressure_threshold, double const minimum_permeability, double const maximum_permeability, ParameterLib::CoordinateSystem const *const local_coordinate_system)
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
virtual PropertyDataType value() const
Definition Property.cpp:76
PropertyDataType fromVector(std::vector< double > const &values)
Definition Property.cpp:23
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
A local coordinate system used for tensor transformations.