OGS
EmbeddedFracturePermeability.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/Eigenvalues>
7#include <Eigen/Geometry>
8
11
12namespace MaterialPropertyLib
13{
14template <int DisplacementDim>
16 std::string name,
17 Eigen::Matrix<double, 3, 1> const fracture_normal,
18 bool const fracture_normal_is_constant,
19 double const intrinsic_permeability,
20 double const initial_aperture,
21 double const mean_fracture_distance,
22 double const threshold_strain,
23 ParameterLib::Parameter<double> const& fracture_rotation_xy,
24 ParameterLib::Parameter<double> const& fracture_rotation_yz,
25 double const jacobian_factor)
26 : _n(fracture_normal),
27 _n_const(fracture_normal_is_constant),
28 _k(intrinsic_permeability),
29 _b0(initial_aperture),
30 _a(mean_fracture_distance),
31 _e0(threshold_strain),
32 _phi_xy(fracture_rotation_xy),
33 _phi_yz(fracture_rotation_yz),
34 _jf(jacobian_factor)
35{
36 name_ = std::move(name);
37}
38
39template <int DisplacementDim>
41{
42 if (!std::holds_alternative<Medium*>(scale_))
43 {
45 "The property 'EmbeddedFracturePermeability' is "
46 "implemented on the 'medium' scale only.");
47 }
48}
49
50template <int DisplacementDim>
52 VariableArray const& variable_array,
53 ParameterLib::SpatialPosition const& pos, double const t,
54 double const /*dt*/) const
55{
56 Eigen::Matrix<double, 3, 1> const n = [&]
57 {
58 if (_n_const)
59 {
60 return _n;
61 }
62 auto const sigma = formEigenTensor<3>(
63 std::get<SymmetricTensor>(variable_array.total_stress));
64 Eigen::SelfAdjointEigenSolver<Eigen::Matrix<double, 3, 3>> e_s(sigma);
65 return (Eigen::Matrix<double, 3, 1>)e_s.eigenvectors().col(2);
66 }();
67
68 auto const rotMat_xy =
69 Eigen::AngleAxisd(_phi_xy(t, pos)[0], Eigen::Vector3d::UnitZ());
70 auto const rotMat_yz =
71 Eigen::AngleAxisd(_phi_yz(t, pos)[0], Eigen::Vector3d::UnitX());
72
73 Eigen::Matrix<double, 3, 1> const n_r = rotMat_yz * (rotMat_xy * n);
74
77 variable_array.mechanical_strain));
78 double const e_n = (eps * n_r).dot(n_r.transpose());
79 double const H_de = (e_n > _e0) ? 1.0 : 0.0;
80 double const b_f = _b0 + H_de * _a * (e_n - _e0);
81 double const coeff = H_de * (b_f / _a) * ((b_f * b_f / 12.0) - _k);
82
83 Eigen::Matrix3d I = Eigen::Matrix3d::Identity();
84 return (coeff * (I - n_r * n_r.transpose()) + _k * I)
85 .template topLeftCorner<DisplacementDim, DisplacementDim>()
86 .eval();
87}
88
89template <int DisplacementDim>
91 VariableArray const& variable_array, Variable const variable,
92 ParameterLib::SpatialPosition const& pos, double const t,
93 double const /*dt*/) const
94{
95 if (variable != Variable::mechanical_strain)
96 {
98 "EmbeddedFracturePermeability::dValue is implemented for "
99 "derivatives with respect to strain only.");
100 }
101
102 Eigen::Matrix<double, 3, 1> const n = [&]
103 {
104 if (_n_const)
105 {
106 return _n;
107 }
108 auto const sigma = formEigenTensor<3>(
109 std::get<SymmetricTensor>(variable_array.total_stress));
110 Eigen::SelfAdjointEigenSolver<Eigen::Matrix<double, 3, 3>> e_s(sigma);
111 return (Eigen::Matrix<double, 3, 1>)e_s.eigenvectors().col(2);
112 }();
113
114 auto const rotMat_xy =
115 Eigen::AngleAxisd(_phi_xy(t, pos)[0], Eigen::Vector3d::UnitZ());
116 auto const rotMat_yz =
117 Eigen::AngleAxisd(_phi_yz(t, pos)[0], Eigen::Vector3d::UnitX());
118
119 Eigen::Matrix<double, 3, 1> const n_r = rotMat_yz * (rotMat_xy * n);
120
123 variable_array.mechanical_strain));
124 double const e_n = (eps * n_r).dot(n_r.transpose());
125 double const H_de = (e_n > _e0) ? 1.0 : 0.0;
126 double const b_f = _b0 + H_de * _a * (e_n - _e0);
127
128 Eigen::Matrix3d const M = n_r * n_r.transpose();
129 return Eigen::MatrixXd(
130 _jf * H_de * (b_f * b_f / 4 - _k) *
132 Eigen::Matrix3d::Identity() - M) *
134}
135
138} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
Permeability model as proposed by Olivella&Alonso.
EmbeddedFracturePermeability(std::string name, Eigen::Matrix< double, 3, 1 > const fracture_normal, bool const fracture_normal_is_constant, double const intrinsic_permeability, double const initial_aperture, double const mean_fracture_distance, double const threshold_strain, 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_
template Eigen::Matrix< double, 3, 3 > formEigenTensor< 3 >(MaterialPropertyLib::PropertyDataType 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)