https://mooseframework.inl.gov
CrackMeshCut3DUserObject.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "GeometricCutUserObject.h"
13 #include "CrackFrontDefinition.h"
14 
15 #include <array>
16 
17 class Function;
18 
26 {
27 public:
29 
31 
32  virtual void initialSetup() override;
33  virtual void initialize() override;
34 
35  virtual const std::vector<Point>
36  getCrackFrontPoints(unsigned int num_crack_front_points) const override;
37  virtual const std::vector<RealVectorValue>
38  getCrackPlaneNormals(unsigned int num_crack_front_points) const override;
39 
40  virtual bool cutElementByGeometry(const Elem * elem,
41  std::vector<Xfem::CutEdge> & cut_edges,
42  std::vector<Xfem::CutNode> & cut_nodes) const override;
43  virtual bool cutElementByGeometry(const Elem * elem,
44  std::vector<Xfem::CutFace> & cut_faces) const override;
45  virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_edges,
46  std::vector<Xfem::CutEdge> & cut_edges) const override;
47  virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_faces,
48  std::vector<Xfem::CutFace> & cut_faces) const override;
49 
55 
60  std::vector<int> getFrontPointsIndex();
61 
65  void setSubCriticalGrowthSize(std::vector<Real> & growth_size);
66 
75  unsigned int getNumberOfCrackFrontPoints() const;
76 
77 protected:
79  std::unique_ptr<MeshBase> _cut_mesh;
80 
82  const unsigned int _cut_elem_nnode = 3;
83  const unsigned int _cut_elem_dim = 2;
84 
87 
90 
96  std::vector<dof_id_type> _crack_front_points;
97 
100  {
102  FUNCTION
103  };
106 
108  enum class GrowthRateEnum
109  {
110  FATIGUE,
111  FUNCTION
112  };
115 
117  const unsigned int _elem_dim = 3;
118 
120  const Real _const_intersection = 0.01;
121 
124 
126  unsigned int _n_step_growth;
127 
129  bool _stop;
130  bool _grow;
131 
133  std::vector<dof_id_type> _boundary;
134 
136  std::vector<std::vector<dof_id_type>> _active_boundary;
137 
139  std::vector<unsigned int> _inactive_boundary_pos;
140 
143  std::vector<dof_id_type> _tracked_crack_front_points;
144 
145  bool _cfd;
146 
148  std::set<Xfem::CutEdge> _boundary_edges;
149 
151  std::map<dof_id_type, std::vector<dof_id_type>> _boundary_map;
152 
154  std::vector<std::vector<Point>> _active_direction;
155 
157  std::vector<Real> _growth_size;
158 
160  std::vector<unsigned long int> _dn;
161  std::vector<unsigned long int> _n;
162 
164  std::vector<std::vector<dof_id_type>> _front;
165 
168 
171 
175  virtual bool intersectWithEdge(const Point & p1,
176  const Point & p2,
177  const std::vector<Point> & _vertices,
178  Point & point) const;
179 
183  bool findIntersection(const Point & p1,
184  const Point & p2,
185  const std::vector<Point> & vertices,
186  Point & point) const;
187 
191  bool isInsideEdge(const Point & p1, const Point & p2, const Point & p) const;
192 
196  Real getRelativePosition(const Point & p1, const Point & p2, const Point & p) const;
197 
201  bool isInsideCutPlane(const std::vector<Point> & _vertices, const Point & p) const;
202 
209  void findBoundaryNodes();
210 
214  void findBoundaryEdges();
215 
219  void sortBoundaryNodes();
220 
225 
229  void refineBoundary();
230 
235 
239  void growFront();
240 
244  void sortFrontNodes();
245 
249  void findFrontIntersection();
250 
254  void refineFront();
255 
259  void triangulation();
260 
264  void joinBoundary();
265 
269  const Function * _func_x;
270  const Function * _func_y;
271  const Function * _func_z;
272  const Function * _func_v;
273 };
GrowthDirectionEnum
Enum to for crack growth direction.
CrackMeshCut3DUserObject: (1) reads in a mesh describing the crack surface, (2) uses the mesh to do i...
std::vector< unsigned long int > _dn
Fatigue life.
Real _size_control
Used for cutter mesh refinement and front advancement.
void findBoundaryNodes()
Find boundary nodes of the cutter mesh This is a simple algorithm simply based on the added angle = 3...
std::vector< int > getFrontPointsIndex()
Get crack front points in the active segment -1 means inactive; positive is the point&#39;s index in the ...
const unsigned int _cut_elem_nnode
The cutter mesh has triangluar elements only.
void findActiveBoundaryNodes()
Find all active boundary nodes in the cutter mesh Find boundary nodes that will grow; nodes outside o...
unsigned int _n_step_growth
Number of steps to grow the mesh.
std::vector< unsigned long int > _n
bool findIntersection(const Point &p1, const Point &p2, const std::vector< Point > &vertices, Point &point) const
Find directional intersection along the positive extension of the vector from p1 to p2...
const GrowthDirectionEnum _growth_dir_method
The direction method for growing mesh at the front.
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point >> &frag_edges, std::vector< Xfem::CutEdge > &cut_edges) const override
void setSubCriticalGrowthSize(std::vector< Real > &growth_size)
Return growth size at the active boundary to the mesh cutter.
Real getRelativePosition(const Point &p1, const Point &p2, const Point &p) const
Get the relative position of p from p1.
Real findDistance(dof_id_type node1, dof_id_type node2)
Find distance between two nodes.
std::map< dof_id_type, std::vector< dof_id_type > > _boundary_map
A map of boundary nodes and their neighbors.
void growFront()
Grow the cutter mesh.
const Real _const_intersection
Used to define intersection points.
void findBoundaryEdges()
Find boundary edges of the cutter mesh.
const unsigned int _elem_dim
The structural mesh must be 3D only.
void triangulation()
Create tri3 elements between the new front and the old front.
void refineFront()
Refine the mesh at the front.
std::vector< dof_id_type > _tracked_crack_front_points
Front nodes that are grown from the crack front definition defined in the input therefore, they are (1) in the same order as defined in the input and (2) the number of nodes does not change.
void sortFrontNodes()
Sort the front nodes.
Class used in fracture integrals to define geometric characteristics of the crack front...
std::vector< dof_id_type > _crack_front_points
updated crack front definition they are in the same order as defined in the input but the number of n...
void findFrontIntersection()
Find front-structure intersections.
const Function * _func_x
Parsed functions of front growth.
std::vector< std::vector< dof_id_type > > _front
New boundary after growth.
virtual void initialSetup() override
virtual const std::vector< Point > getCrackFrontPoints(unsigned int num_crack_front_points) const override
get a set of points along a crack front from a XFEM GeometricCutUserObject
unsigned int _num_crack_front_points
Total number of crack front points in the mesh cutter.
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes) const override
bool _is_mesh_modified
Indicator that shows if the cutting mesh is modified or not in this calculation step.
CrackMeshCut3DUserObject(const InputParameters &parameters)
bool _stop
Variables to help control the work flow.
std::vector< unsigned int > _inactive_boundary_pos
Inactive boundary.
void joinBoundary()
Join active boundaries and inactive boundaries to be the new boundary.
virtual const std::vector< RealVectorValue > getCrackPlaneNormals(unsigned int num_crack_front_points) const override
get a set of normal vectors along a crack front from a XFEM GeometricCutUserObject ...
virtual bool intersectWithEdge(const Point &p1, const Point &p2, const std::vector< Point > &_vertices, Point &point) const
Check if a line intersects with an element.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void sortBoundaryNodes()
Sort boundary nodes to be in the right order along the boundary.
std::vector< std::vector< dof_id_type > > _active_boundary
Active boundary nodes where growth is allowed.
unsigned int getNumberOfCrackFrontPoints() const
Return the total number of crack front points.
MooseMesh & _mesh
The structural mesh.
CrackFrontDefinition * _crack_front_definition
The crack front definition.
const InputParameters & parameters() const
static InputParameters validParams()
virtual void initialize() override
GrowthRateEnum
Enum to for crack growth rate.
const GrowthRateEnum _growth_rate_method
The rate method for growing mesh at the front.
bool isInsideEdge(const Point &p1, const Point &p2, const Point &p) const
Check if point p is inside the edge p1-p2.
std::set< Xfem::CutEdge > _boundary_edges
Edges at the boundary.
std::vector< Real > _growth_size
Growth size for the active boundary in a subcritical simulation.
void refineBoundary()
If boundary nodes are too sparse, add nodes in between.
std::vector< std::vector< Point > > _active_direction
Growth direction for active boundaries.
void findActiveBoundaryDirection()
Find growth direction at each active node.
std::unique_ptr< MeshBase > _cut_mesh
The cutter mesh.
bool isInsideCutPlane(const std::vector< Point > &_vertices, const Point &p) const
Check if point p is inside a plane.
std::vector< dof_id_type > _boundary
Boundary nodes of the cutter mesh.
uint8_t dof_id_type