OGS
FractureProperty.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <Eigen/Core>
14#include <memory>
15
16#include "BranchProperty.h"
17#include "JunctionProperty.h"
21
22namespace ParameterLib
23{
24template <typename T>
25struct Parameter;
26}
27
28namespace ProcessLib
29{
30namespace LIE
31{
33{
34 int fracture_id = 0;
35 int mat_id = 0;
36 Eigen::Vector3d point_on_fracture;
37 Eigen::Vector3d normal_vector;
39 Eigen::MatrixXd R;
42 std::vector<BranchProperty> branches_master;
43 std::vector<BranchProperty> branches_slave;
44
45 FractureProperty(int const fracture_id_, int const material_id,
46 ParameterLib::Parameter<double> const& initial_aperture)
47 : fracture_id(fracture_id_),
48 mat_id(material_id),
49 aperture0(initial_aperture)
50 {
51 }
52
53 virtual ~FractureProperty() = default;
54};
55
58inline void setFractureProperty(int const dim, MeshLib::Element const& e,
59 FractureProperty& frac_prop)
60{
61 auto& n = frac_prop.normal_vector;
62 // 1st node is used but using other node is also possible, because
63 // a fracture is not curving
64 for (int j = 0; j < 3; j++)
65 {
66 frac_prop.point_on_fracture[j] = getCenterOfGravity(e).data()[j];
67 }
68
69 const MeshLib::ElementCoordinatesMappingLocal ele_local_coord(e, dim);
70
71 // Global to local rotation matrix:
72 Eigen::MatrixXd const global2local_rotation =
73 ele_local_coord.getRotationMatrixToGlobal().transpose();
74 n = global2local_rotation.row(dim - 1);
75
76 frac_prop.R = global2local_rotation.topLeftCorner(dim, dim);
77
78 DBUG("Normal vector of the fracture element {:d}: [{:g}, {:g}, {:g}]",
79 e.getID(), n[0], n[1], n[2]);
80}
81
83 FractureProperty const& master_frac,
84 FractureProperty const& slave_frac)
85{
86 BranchProperty branch{branchNode, master_frac.fracture_id,
87 slave_frac.fracture_id};
88
89 // set a normal vector from the master to the slave fracture
90 Eigen::Vector3d branch_vector =
91 slave_frac.point_on_fracture - branch.coords;
92 double sign = (branch_vector.dot(master_frac.normal_vector) < 0) ? -1 : 1;
93 branch.normal_vector_branch = sign * master_frac.normal_vector;
94 return branch;
95}
96} // namespace LIE
97} // namespace ProcessLib
Definition of the Element class.
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
const double * data() const
Definition Point3d.h:60
const RotationMatrix & getRotationMatrixToGlobal() const
return a rotation matrix converting to global coordinates
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
void setFractureProperty(int const dim, MeshLib::Element const &e, FractureProperty &frac_prop)
BranchProperty createBranchProperty(MeshLib::Node const &branchNode, FractureProperty const &master_frac, FractureProperty const &slave_frac)
virtual ~FractureProperty()=default
ParameterLib::Parameter< double > const & aperture0
Initial aperture.
std::vector< BranchProperty > branches_slave
FractureProperty(int const fracture_id_, int const material_id, ParameterLib::Parameter< double > const &initial_aperture)
Eigen::MatrixXd R
Rotation matrix from global to local coordinates.
std::vector< BranchProperty > branches_master