OGS
StrainDependentPermeability.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>
27 std::string name, ParameterLib::Parameter<double> const& k0,
28 double const b1, double const b2, double const b3,
29 double const minimum_permeability, double const maximum_permeability,
30 ParameterLib::CoordinateSystem const* const local_coordinate_system)
31 : k0_(k0),
32 b1_(b1),
33 b2_(b2),
34 b3_(b3),
35 minimum_permeability_(minimum_permeability),
36 maximum_permeability_(maximum_permeability),
37 local_coordinate_system_(local_coordinate_system)
38{
39 name_ = std::move(name);
40}
41
42template <int DisplacementDim>
44{
45 if (!std::holds_alternative<Medium*>(scale_))
46 {
48 "The property 'StrainDependentPermeability' is "
49 "implemented on the 'medium' scale only.");
50 }
51}
52
53template <int DisplacementDim>
55 VariableArray const& variable_array,
56 ParameterLib::SpatialPosition const& pos, double const t,
57 double const /*dt*/) const
58{
59 double const e_vol = variable_array.volumetric_strain;
60 double const e_vol_pls = variable_array.equivalent_plastic_strain;
61
62 auto k_data = k0_(t, pos);
63
64 double const ten_base_exponent = e_vol > 0.0 ? b3_ * e_vol : b2_ * e_vol;
65 double const factor =
66 std::pow(10.0, ten_base_exponent) * std::exp(b1_ * e_vol_pls);
67
68 for (auto& k_i : k_data)
69 {
70 k_i = std::clamp(k_i * factor, minimum_permeability_,
71 maximum_permeability_);
72 }
73
74 // Local coordinate transformation is only applied for the case that the
75 // initial intrinsic permeability is given with orthotropic assumption.
76 if (local_coordinate_system_ && (k_data.size() == DisplacementDim))
77 {
78 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const e =
79 local_coordinate_system_->transformation<DisplacementDim>(pos);
80 Eigen::Matrix<double, DisplacementDim, DisplacementDim> k =
81 Eigen::Matrix<double, DisplacementDim, DisplacementDim>::Zero();
82
83 for (int i = 0; i < DisplacementDim; ++i)
84 {
85 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const
86 ei_otimes_ei = e.col(i) * e.col(i).transpose();
87
88 k += k_data[i] * ei_otimes_ei;
89 }
90 return k;
91 }
92
93 return fromVector(k_data);
94}
95
96template <int DisplacementDim>
98 VariableArray const& /*variable_array*/, Variable const variable,
99 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
100 double const /*dt*/) const
101{
102 if (variable == Variable::mechanical_strain)
103 {
104 return 0.;
105 }
106
107 OGS_FATAL(
108 "The derivative of the intrinsic permeability of "
109 "StrainDependentPermeabilityis not implemented.");
110}
111template class StrainDependentPermeability<2>;
112template class StrainDependentPermeability<3>;
113} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
A strain dependent intrinsic permeability model.
StrainDependentPermeability(std::string name, ParameterLib::Parameter< double > const &k0, double const b1, double const b2, double const b3, 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
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.