OGS
PermeabilityOrthotropicPowerLaw.cpp
Go to the documentation of this file.
1
11
12#include <algorithm>
13#include <cmath>
14
18
19namespace MaterialPropertyLib
20{
21template <int DisplacementDim>
24 std::string name,
25 std::array<double, DisplacementDim>
26 intrinsic_permeabilities,
27 std::array<double, DisplacementDim>
28 exponents,
29 ParameterLib::CoordinateSystem const* const local_coordinate_system)
30 : k_(std::move(intrinsic_permeabilities)),
31 lambda_(std::move(exponents)),
32 local_coordinate_system_(local_coordinate_system)
33{
34 name_ = std::move(name);
35}
36
37template <int DisplacementDim>
39{
40 if (!std::holds_alternative<Medium*>(scale_))
41 {
43 "The property 'PermeabilityOrthotropicPowerLaw' is implemented on "
44 "the 'medium' scales only.");
45 }
46}
47template <int DisplacementDim>
49 VariableArray const& variable_array,
50 ParameterLib::SpatialPosition const& pos, double const /*t*/,
51 double const /*dt*/) const
52{
53 auto const phi = variable_array.transport_porosity;
54 // TODO (naumov) The phi0 must be evaluated once upon
55 // creation/initialization and be stored in a local state.
56 // For now assume porosity's initial value does not change with time.
57 auto const medium = std::get<Medium*>(scale_);
58 auto const phi_0 =
59 medium->hasProperty(PropertyType::transport_porosity)
60 ? medium->property(PropertyType::transport_porosity)
61 .template initialValue<double>(
62 pos, std::numeric_limits<double>::quiet_NaN())
63 : medium->property(PropertyType::porosity)
64 .template initialValue<double>(
65 pos, std::numeric_limits<double>::quiet_NaN());
66
67 Eigen::Matrix<double, DisplacementDim, DisplacementDim> k =
68 Eigen::Matrix<double, DisplacementDim, DisplacementDim>::Zero();
69
70 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const e =
71 local_coordinate_system_ == nullptr
72 ? Eigen::Matrix<double, DisplacementDim,
73 DisplacementDim>::Identity()
74 : local_coordinate_system_->transformation<DisplacementDim>(pos);
75
76 // k = \sum_i k_i (\phi / \phi_0)^{\lambda_i} e_i \otimes e_i
77 // e_i \otimes e_i = square matrix e_i,0^2 e_i,0*e_i,1 etc.
78 for (int i = 0; i < DisplacementDim; ++i)
79 {
80 Eigen::Matrix<double, DisplacementDim, DisplacementDim> const
81 ei_otimes_ei = e.col(i) * e.col(i).transpose();
82
83 k += k_[i] * std::pow(phi / phi_0, lambda_[i]) * ei_otimes_ei;
84 }
85 return k;
86}
87template <int DisplacementDim>
89 VariableArray const& /*variable_array*/, Variable const /*variable*/,
90 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
91 double const /*dt*/) const
92{
93 OGS_FATAL("PermeabilityOrthotropicPowerLaw::dValue is not implemented.");
94}
95
98} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
PermeabilityOrthotropicPowerLaw(std::string name, std::array< double, DisplacementDim > intrinsic_permeabilities, std::array< double, DisplacementDim > exponents, 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
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.