OGS
ProcessLib::LIE Namespace Reference

Namespaces

namespace  anonymous_namespace{MeshUtils.cpp}
namespace  anonymous_namespace{PostUtils.cpp}
namespace  HydroMechanics
namespace  SmallDeformation

Classes

struct  BranchProperty
struct  FractureProperty
struct  JunctionProperty
class  PostProcessTool

Functions

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)
bool levelsetFracture (FractureProperty const &frac, Eigen::Vector3d const &x)
bool levelsetBranch (BranchProperty const &branch, Eigen::Vector3d const &x)
std::vector< double > uGlobalEnrichments (std::vector< FractureProperty * > const &frac_props, std::vector< JunctionProperty * > const &junction_props, std::unordered_map< int, int > const &fracID_to_local, Eigen::Vector3d const &x)
std::vector< double > duGlobalEnrichments (std::size_t this_frac_id, std::vector< FractureProperty * > const &frac_props, std::vector< JunctionProperty * > const &junction_props, std::unordered_map< int, int > const &fracID_to_local, Eigen::Vector3d const &x)
void getFractureMatrixDataInMesh (MeshLib::Mesh const &mesh, std::vector< MeshLib::Element * > &vec_matrix_elements, std::vector< int > &vec_fracture_mat_IDs, std::vector< std::vector< MeshLib::Element * > > &vec_fracture_elements, std::vector< std::vector< MeshLib::Element * > > &vec_fracture_matrix_elements, std::vector< std::vector< MeshLib::Node * > > &vec_fracture_nodes, std::vector< std::pair< std::size_t, std::vector< int > > > &vec_branch_nodeID_matIDs, std::vector< std::pair< std::size_t, std::vector< int > > > &vec_junction_nodeID_matIDs)
template<typename Derived>
Eigen::Vector3d computePhysicalCoordinates (MeshLib::Element const &e, Eigen::MatrixBase< Derived > const &shape)

Function Documentation

◆ computePhysicalCoordinates()

template<typename Derived>
Eigen::Vector3d ProcessLib::LIE::computePhysicalCoordinates ( MeshLib::Element const & e,
Eigen::MatrixBase< Derived > const & shape )

compute physical coordinates from the given shape vector, i.e. from the natural coordinates

Definition at line 18 of file ProcessLib/LIE/Common/Utils.h.

20{
21 Eigen::Vector3d pt = Eigen::Vector3d::Zero();
22 for (unsigned i = 0; i < e.getNumberOfNodes(); i++)
23 {
24 MeshLib::Node const& node = *e.getNode(i);
25 for (unsigned j = 0; j < 3; j++)
26 {
27 pt[j] += shape[i] * node[j];
28 }
29 }
30 return pt;
31}

References MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().

Referenced by ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::assembleWithJacobian(), and ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::computeSecondaryVariableConcreteWithVector().

◆ createBranchProperty()

BranchProperty ProcessLib::LIE::createBranchProperty ( MeshLib::Node const & branchNode,
FractureProperty const & master_frac,
FractureProperty const & slave_frac )
inline

Definition at line 74 of file FractureProperty.h.

77{
78 BranchProperty branch{branchNode, master_frac.fracture_id,
79 slave_frac.fracture_id};
80
81 // set a normal vector from the master to the slave fracture
82 Eigen::Vector3d branch_vector =
83 slave_frac.point_on_fracture - branch.coords;
84 double sign = (branch_vector.dot(master_frac.normal_vector) < 0) ? -1 : 1;
85 branch.normal_vector_branch = sign * master_frac.normal_vector;
86 return branch;
87}
Eigen::Vector3d const coords

References ProcessLib::LIE::BranchProperty::coords, ProcessLib::LIE::FractureProperty::fracture_id, ProcessLib::LIE::FractureProperty::normal_vector, ProcessLib::LIE::BranchProperty::normal_vector_branch, and ProcessLib::LIE::FractureProperty::point_on_fracture.

Referenced by ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::HydroMechanicsProcess(), and ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess().

◆ duGlobalEnrichments()

std::vector< double > ProcessLib::LIE::duGlobalEnrichments ( std::size_t this_frac_id,
std::vector< FractureProperty * > const & frac_props,
std::vector< JunctionProperty * > const & junction_props,
std::unordered_map< int, int > const & fracID_to_local,
Eigen::Vector3d const & x )

calculate the enrichment function for fracture relative displacements Remarks:

  • branch/junction intersections of two fractures are supported in 2D
Parameters
this_frac_idthe fracture ID
frac_propsfracture properties
junction_propsjunction properties
fracID_to_locala mapping table from a fracture ID to a local index in frac_props
xevaluating point coordinates
Returns
a vector of enrichment values for fracture relative displacements

Definition at line 76 of file LevelSetFunction.cpp.

82{
83 auto this_frac_local_index = fracID_to_local.at(this_frac_id);
84 auto const& this_frac = *frac_props[this_frac_local_index];
85 // pre-calculate levelsets for all fractures
86 std::vector<bool> levelsets(frac_props.size());
87 for (std::size_t i = 0; i < frac_props.size(); i++)
88 {
89 levelsets[i] = levelsetFracture(*frac_props[i], x);
90 }
91
92 std::vector<double> enrichments(frac_props.size() + junction_props.size());
93 enrichments[this_frac_local_index] = 1.0;
94
95 // fractures possibly with branches
96 if (frac_props.size() > 1)
97 {
98 for (auto const& branch : this_frac.branches_master)
99 {
100 if (branch.master_fracture_id != this_frac.fracture_id)
101 {
102 continue;
103 }
104
105 if (fracID_to_local.find(branch.slave_fracture_id) ==
106 fracID_to_local.end())
107 {
108 continue;
109 }
110
111 double sign = boost::math::sign(
112 this_frac.normal_vector.dot(branch.normal_vector_branch));
113 auto slave_fid = fracID_to_local.at(branch.slave_fracture_id);
114 double const enrich = levelsets[slave_fid] ? 1. : 0.;
115 enrichments[slave_fid] = sign * enrich;
116 }
117 }
118
119 // junctions
120 for (unsigned i = 0; i < junction_props.size(); i++)
121 {
122 auto const* junction = junction_props[i];
123 if (!ranges::contains(junction->fracture_ids, this_frac.fracture_id))
124 {
125 continue;
126 }
127
128 auto another_frac_id =
129 (junction->fracture_ids[0] == this_frac.fracture_id)
130 ? junction->fracture_ids[1]
131 : junction->fracture_ids[0];
132 auto fid = fracID_to_local.at(another_frac_id);
133 double const enrich = levelsets[fid] ? 1. : 0.;
134 enrichments[i + frac_props.size()] = enrich;
135 }
136
137 return enrichments;
138}
bool levelsetFracture(FractureProperty const &frac, Eigen::Vector3d const &x)

References levelsetFracture().

Referenced by ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::assembleWithJacobian(), and ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::computeSecondaryVariableConcreteWithVector().

◆ getFractureMatrixDataInMesh()

void ProcessLib::LIE::getFractureMatrixDataInMesh ( MeshLib::Mesh const & mesh,
std::vector< MeshLib::Element * > & vec_matrix_elements,
std::vector< int > & vec_fracture_mat_IDs,
std::vector< std::vector< MeshLib::Element * > > & vec_fracture_elements,
std::vector< std::vector< MeshLib::Element * > > & vec_fracture_matrix_elements,
std::vector< std::vector< MeshLib::Node * > > & vec_fracture_nodes,
std::vector< std::pair< std::size_t, std::vector< int > > > & vec_branch_nodeID_matIDs,
std::vector< std::pair< std::size_t, std::vector< int > > > & vec_junction_nodeID_matIDs )

get data about fracture and matrix elements/nodes from a mesh

Parameters
meshA mesh which includes fracture elements, i.e. lower-dimensional elements. It is assumed that elements forming a fracture have a distinct material ID.
vec_matrix_elementsa vector of matrix elements
vec_fracture_mat_IDsfracture material IDs found in the mesh
vec_fracture_elementsa vector of fracture elements (grouped by fracture IDs)
vec_fracture_matrix_elementsa vector of fracture elements and matrix elements connecting to the fracture (grouped by fracture IDs)
vec_fracture_nodesa vector of fracture element nodes (grouped by fracture IDs)
vec_branch_nodeID_matIDsa vector of branch node IDs found in the mesh (and corresponding fracture material IDs)
vec_junction_nodeID_matIDsa vector of junction node IDs found in the mesh (and corresponding fracture material IDs)

Definition at line 207 of file LIE/Common/MeshUtils.cpp.

218{
219 IsCrackTip isCrackTip(mesh);
220
221 // get vectors of matrix elements and fracture elements
222 vec_matrix_elements.reserve(mesh.getNumberOfElements());
223 std::vector<MeshLib::Element*> all_fracture_elements;
224 for (MeshLib::Element* e : mesh.getElements())
225 {
226 if (e->getDimension() == mesh.getDimension())
227 {
228 vec_matrix_elements.push_back(e);
229 }
230 else
231 {
232 all_fracture_elements.push_back(e);
233 }
234 }
235 DBUG("-> found total {:d} matrix elements and {:d} fracture elements",
236 vec_matrix_elements.size(), all_fracture_elements.size());
237
238 // get fracture material IDs
239 auto const material_ids = materialIDs(mesh);
240 if (!material_ids)
241 {
242 OGS_FATAL("Could not access MaterialIDs property from mesh.");
243 }
244 transform(cbegin(all_fracture_elements), cend(all_fracture_elements),
245 back_inserter(vec_fracture_mat_IDs),
246 [&material_ids](auto const* e)
247 { return (*material_ids)[e->getID()]; });
248
249 BaseLib::makeVectorUnique(vec_fracture_mat_IDs);
250 DBUG("-> found {:d} fracture material groups", vec_fracture_mat_IDs.size());
251
252 // create a vector of fracture elements for each material
253 vec_fracture_elements.resize(vec_fracture_mat_IDs.size());
254 for (unsigned frac_id = 0; frac_id < vec_fracture_mat_IDs.size(); frac_id++)
255 {
256 const auto frac_mat_id = vec_fracture_mat_IDs[frac_id];
257 std::vector<MeshLib::Element*>& vec_elements =
258 vec_fracture_elements[frac_id];
259 std::copy_if(all_fracture_elements.begin(), all_fracture_elements.end(),
260 std::back_inserter(vec_elements),
261 [&](MeshLib::Element const* const e)
262 { return (*material_ids)[e->getID()] == frac_mat_id; });
263 DBUG("-> found {:d} elements on the fracture {:d}", vec_elements.size(),
264 frac_id);
265 }
266
267 // get a vector of fracture nodes for each material
268 vec_fracture_nodes.resize(vec_fracture_mat_IDs.size());
269 for (unsigned frac_id = 0; frac_id < vec_fracture_mat_IDs.size(); frac_id++)
270 {
271 std::vector<MeshLib::Node*>& vec_nodes = vec_fracture_nodes[frac_id];
272 for (MeshLib::Element const* const e : vec_fracture_elements[frac_id])
273 {
274 for (unsigned i = 0; i < e->getNumberOfNodes(); i++)
275 {
276 if (isCrackTip(*e->getNode(i)))
277 {
278 continue;
279 }
280 vec_nodes.push_back(const_cast<MeshLib::Node*>(e->getNode(i)));
281 }
282 }
285 DBUG("-> found {:d} nodes on the fracture {:d}", vec_nodes.size(),
286 frac_id);
287 }
288
289 // find branch/junction nodes which connect to multiple fractures
290 std::vector<std::vector<MeshLib::Element*>> intersected_fracture_elements;
291 findFracutreIntersections(mesh, vec_fracture_mat_IDs, vec_fracture_nodes,
292 intersected_fracture_elements,
293 vec_branch_nodeID_matIDs,
294 vec_junction_nodeID_matIDs);
295
296 // create a vector fracture elements and connected matrix elements,
297 // which are passed to a DoF table
298 for (unsigned fid = 0; fid < vec_fracture_elements.size(); fid++)
299 {
300 auto const& fracture_elements = vec_fracture_elements[fid];
301 std::vector<MeshLib::Element*> vec_ele;
302 // first, collect matrix elements
303 for (MeshLib::Element const* const e : fracture_elements)
304 {
305 // it is sufficient to iterate over base nodes, because they are
306 // already connected to all neighbours
307 for (unsigned i = 0; i < e->getNumberOfBaseNodes(); i++)
308 {
309 MeshLib::Node const* node = e->getNode(i);
310 if (isCrackTip(*node))
311 {
312 continue;
313 }
314 auto const& elements_connected_to_node =
315 mesh.getElementsConnectedToNode(*node);
316 for (unsigned j = 0; j < elements_connected_to_node.size(); j++)
317 {
318 // only matrix elements
319 if (elements_connected_to_node[j]->getDimension() <
320 mesh.getDimension())
321 {
322 continue;
323 }
324 vec_ele.push_back(const_cast<MeshLib::Element*>(
325 elements_connected_to_node[j]));
326 }
327 }
328 }
331
332 // second, append fracture elements
333 std::copy(fracture_elements.begin(), fracture_elements.end(),
334 std::back_inserter(vec_ele));
335 // thirdly, append intersected fracture elements
336 std::copy(intersected_fracture_elements[fid].begin(),
337 intersected_fracture_elements[fid].end(),
338 std::back_inserter(vec_ele));
339
340 vec_fracture_matrix_elements.push_back(vec_ele);
341 }
342}
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void makeVectorUnique(std::vector< T > &v)
Definition Algorithm.h:173
bool idsComparator(T const a, T const b)
Definition Mesh.h:197
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:258
void findFracutreIntersections(MeshLib::Mesh const &mesh, std::vector< int > const &vec_fracture_mat_IDs, std::vector< std::vector< MeshLib::Node * > > const &vec_fracture_nodes, std::vector< std::vector< MeshLib::Element * > > &intersected_fracture_elements, std::vector< std::pair< std::size_t, std::vector< int > > > &vec_branch_nodeID_matIDs, std::vector< std::pair< std::size_t, std::vector< int > > > &vec_junction_nodeID_matIDs)
unsigned getDimension(MeshLib::MeshElemType eleType)

References DBUG(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::Mesh::getNumberOfElements(), MeshLib::idsComparator(), BaseLib::makeVectorUnique(), and OGS_FATAL.

Referenced by ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::HydroMechanicsProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess(), and anonymous_namespace{postLIE.cpp}::postVTU().

◆ levelsetBranch()

bool ProcessLib::LIE::levelsetBranch ( BranchProperty const & branch,
Eigen::Vector3d const & x )

Definition at line 33 of file LevelSetFunction.cpp.

34{
35 return branch.normal_vector_branch.dot(x - branch.coords) > 0;
36}

References ProcessLib::LIE::BranchProperty::coords, and ProcessLib::LIE::BranchProperty::normal_vector_branch.

◆ levelsetFracture()

bool ProcessLib::LIE::levelsetFracture ( FractureProperty const & frac,
Eigen::Vector3d const & x )

Definition at line 28 of file LevelSetFunction.cpp.

29{
30 return frac.normal_vector.dot(x - frac.point_on_fracture) > 0;
31}

References ProcessLib::LIE::FractureProperty::normal_vector, and ProcessLib::LIE::FractureProperty::point_on_fracture.

Referenced by duGlobalEnrichments(), and uGlobalEnrichments().

◆ setFractureProperty()

void ProcessLib::LIE::setFractureProperty ( int const dim,
MeshLib::Element const & e,
FractureProperty & frac_prop )
inline

configure fracture property based on a fracture element assuming a fracture is a straight line/flat plane

Definition at line 50 of file FractureProperty.h.

52{
53 auto& n = frac_prop.normal_vector;
54 // 1st node is used but using other node is also possible, because
55 // a fracture is not curving
56 for (int j = 0; j < 3; j++)
57 {
58 frac_prop.point_on_fracture[j] = getCenterOfGravity(e).data()[j];
59 }
60
61 const MeshLib::ElementCoordinatesMappingLocal ele_local_coord(e, dim);
62
63 // Global to local rotation matrix:
64 Eigen::MatrixXd const global2local_rotation =
65 ele_local_coord.getRotationMatrixToGlobal().transpose();
66 n = global2local_rotation.row(dim - 1);
67
68 frac_prop.R = global2local_rotation.topLeftCorner(dim, dim);
69
70 DBUG("Normal vector of the fracture element {:d}: [{:g}, {:g}, {:g}]",
71 e.getID(), n[0], n[1], n[2]);
72}
const double * data() const
Definition Point3d.h:51
Eigen::MatrixXd R
Rotation matrix from global to local coordinates.

References MathLib::Point3d::data(), DBUG(), MeshLib::Element::getID(), MeshLib::ElementCoordinatesMappingLocal::getRotationMatrixToGlobal(), ProcessLib::LIE::FractureProperty::normal_vector, ProcessLib::LIE::FractureProperty::point_on_fracture, and ProcessLib::LIE::FractureProperty::R.

Referenced by ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::HydroMechanicsProcess(), and ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::SmallDeformationProcess().

◆ uGlobalEnrichments()

std::vector< double > ProcessLib::LIE::uGlobalEnrichments ( std::vector< FractureProperty * > const & frac_props,
std::vector< JunctionProperty * > const & junction_props,
std::unordered_map< int, int > const & fracID_to_local,
Eigen::Vector3d const & x )

calculate the enrichment function for displacements at the given point Remarks:

  • branch/junction intersections of two fractures are supported in 2D
Parameters
frac_propsfracture properties
junction_propsjunction properties
fracID_to_locala mapping table from a fracture ID to a local index in frac_props
xevaluating point coordinates
Returns
a vector of enrichment values for displacements

Definition at line 38 of file LevelSetFunction.cpp.

43{
44 // pre-calculate levelsets for all fractures
45 std::vector<bool> levelsets(frac_props.size());
46 for (std::size_t i = 0; i < frac_props.size(); i++)
47 {
48 levelsets[i] = levelsetFracture(*frac_props[i], x);
49 }
50
51 std::vector<double> enrichments(frac_props.size() + junction_props.size());
52 // fractures possibly with branches
53 for (std::size_t i = 0; i < frac_props.size(); i++)
54 {
55 auto const* frac = frac_props[i];
56 enrichments[i] = Heaviside(
57 std::accumulate(cbegin(frac->branches_slave),
58 cend(frac->branches_slave), levelsets[i],
59 [&](bool const enrich, auto const& branch)
60 { return enrich && levelsetBranch(branch, x); }));
61 }
62
63 // junctions
64 for (std::size_t i = 0; i < junction_props.size(); i++)
65 {
66 auto const* junction = junction_props[i];
67 auto fid1 = fracID_to_local.at(junction->fracture_ids[0]);
68 auto fid2 = fracID_to_local.at(junction->fracture_ids[1]);
69 bool const enrich = levelsets[fid1] && levelsets[fid2];
70 enrichments[i + frac_props.size()] = Heaviside(enrich);
71 }
72
73 return enrichments;
74}

References levelsetFracture().

Referenced by ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrixNearFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianConcrete(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrixNearFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::postTimestepConcreteWithVector(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::updateElementLevelSets(), and ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::updateElementLevelSets().