OGS
OrthotropicEmbeddedFracturePermeability.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <Eigen/Geometry>
7
9
10namespace MaterialPropertyLib
11{
12template <int DisplacementDim>
15 std::string name,
16 std::vector<double> const& mean_fracture_distances,
17 std::vector<double> const& threshold_strains,
18 Eigen::Matrix<double, 3, 3> const fracture_normals,
19 ParameterLib::Parameter<double> const& intrinsic_permeability,
20 ParameterLib::Parameter<double> const& fracture_rotation_xy,
21 ParameterLib::Parameter<double> const& fracture_rotation_yz,
22 double const jacobian_factor)
23 : _a(mean_fracture_distances),
24 _e0(threshold_strains),
25 _n(fracture_normals),
26 _k(intrinsic_permeability),
27 _phi_xy(fracture_rotation_xy),
28 _phi_yz(fracture_rotation_yz),
29 _jf(jacobian_factor)
30{
31 name_ = std::move(name);
32}
33
34template <int DisplacementDim>
36 const
37{
38 if (!std::holds_alternative<Medium*>(scale_))
39 {
41 "The property 'OrthotropicEmbeddedFracturePermeability' is "
42 "implemented on the 'media' scale only.");
43 }
44}
45
46template <int DisplacementDim>
49 VariableArray const& variable_array,
50 ParameterLib::SpatialPosition const& pos, double const t,
51 double const /*dt*/) const
52{
55 variable_array.mechanical_strain));
56 double const k = std::get<double>(fromVector(_k(t, pos)));
57 double const _b0 = std::sqrt(12.0 * k);
58
59 double const phi_xy = std::get<double>(fromVector(_phi_xy(t, pos)));
60 double const phi_yz = std::get<double>(fromVector(_phi_yz(t, pos)));
61 auto const rotMat_xy = Eigen::AngleAxisd(phi_xy, Eigen::Vector3d::UnitZ());
62 auto const rotMat_yz = Eigen::AngleAxisd(phi_yz, Eigen::Vector3d::UnitX());
63
64 Eigen::Matrix3d result = Eigen::Vector3d::Constant(k).asDiagonal();
65
66 for (int i = 0; i < 3; i++)
67 {
68 Eigen::Vector3d const n_i = rotMat_yz * (rotMat_xy * _n.col(i));
69 double const e_n = (eps * n_i).dot(n_i.transpose());
70 double const H_de = (e_n > _e0[i]) ? 1.0 : 0.0;
71 double const b_f = _b0 + H_de * _a[i] * (e_n - _e0[i]);
72
73 // The H_de factor is only valid as long as _b0 equals
74 // std::sqrt(12.0 * k), else it has to be dropped.
75 result += H_de * (b_f / _a[i]) * ((b_f * b_f / 12.0) - k) *
76 (Eigen::Matrix3d::Identity() - n_i * n_i.transpose());
77 }
78
79 return result.template topLeftCorner<DisplacementDim, DisplacementDim>()
80 .eval();
81}
82template <int DisplacementDim>
85 VariableArray const& variable_array, Variable const variable,
86 ParameterLib::SpatialPosition const& pos, double const t,
87 double const /*dt*/) const
88{
89 if (variable != Variable::mechanical_strain)
90 {
92 "OrthotropicEmbeddedFracturePermeability::dValue is implemented "
93 "for derivatives with respect to strain only.");
94 }
95
98 variable_array.mechanical_strain));
99 double const k = std::get<double>(fromVector(_k(t, pos)));
100 double const _b0 = std::sqrt(12.0 * k);
101
102 double const phi_xy = std::get<double>(fromVector(_phi_xy(t, pos)));
103 double const phi_yz = std::get<double>(fromVector(_phi_yz(t, pos)));
104 auto const rotMat_xy = Eigen::AngleAxisd(phi_xy, Eigen::Vector3d::UnitZ());
105 auto const rotMat_yz = Eigen::AngleAxisd(phi_yz, Eigen::Vector3d::UnitX());
106
109
110 for (int i = 0; i < 3; i++)
111 {
112 Eigen::Vector3d const n_i = rotMat_yz * (rotMat_xy * _n.col(i));
113 Eigen::Matrix3d const M = n_i * n_i.transpose();
114 double const e_n = (eps * n_i).dot(n_i.transpose());
115 double const H_de = (e_n > _e0[i]) ? 1.0 : 0.0;
116 double const b_f = _b0 + H_de * _a[i] * (e_n - _e0[i]);
117
118 result += H_de * (b_f * b_f / 4.0 - k) *
120 Eigen::Matrix3d::Identity() - M) *
122 .transpose();
123 }
124 return Eigen::MatrixXd(_jf * result);
125}
126
129} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
OrthotropicEmbeddedFracturePermeability(std::string name, std::vector< double > const &mean_fracture_distances, std::vector< double > const &threshold_strains, Eigen::Matrix< double, 3, 3 > const fracture_normals, ParameterLib::Parameter< double > const &intrinsic_permeability, ParameterLib::Parameter< double > const &fracture_rotation_xy, ParameterLib::Parameter< double > const &fracture_rotation_yz, double const jacobian_factor)
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
std::variant< Medium *, Phase *, Component * > scale_
PropertyDataType fromVector(std::vector< double > const &values)
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
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Eigen::Matrix< double, 3, 3 > kelvinVectorToTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
KelvinVectorType< DisplacementDim > tensorToKelvin(Eigen::Matrix< double, 3, 3 > const &m)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType