https://mooseframework.inl.gov
CrackFrontDefinition.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 "GeneralUserObject.h"
14 #include "BoundaryRestrictable.h"
15 #include <set>
16 #include "ADRankTwoTensorForward.h"
17 
18 class AuxiliarySystem;
19 
20 // libMesh forward declarations
21 namespace libMesh
22 {
23 class QBase;
24 }
25 
26 // fixme lynn this needs to be removed from the globalname space in a seperate commit after Grizzly
27 // is fixed to use includeCrackFrontDefinitionParams
33 {
34 public:
36 
38 
39  virtual void initialSetup() override;
40  virtual void initialize() override;
41  virtual void finalize() override;
42  virtual void execute() override;
43 
46 
51  void updateNumberOfCrackFrontPoints(const std::size_t num_points);
52 
58  const Node * getCrackFrontNodePtr(const std::size_t node_index) const;
59 
65  const Point * getCrackFrontPoint(const std::size_t point_index) const;
66 
72  const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const;
73 
79  const RealVectorValue & getCrackFrontNormal(const std::size_t point_index) const;
80 
86  Real getCrackFrontForwardSegmentLength(const std::size_t point_index) const;
87 
93  Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const;
94 
100  const RealVectorValue & getCrackDirection(const std::size_t point_index) const;
101 
108  Real getDistanceAlongFront(const std::size_t point_index) const;
109 
114  bool hasAngleAlongFront() const;
115 
122  Real getAngleAlongFront(const std::size_t point_index) const;
123 
128  std::size_t getNumCrackFrontPoints() const;
129 
134  bool treatAs2D() const { return _treat_as_2d; }
135 
140  bool usingMeshCutter() const { return _use_mesh_cutter; }
141 
150  const std::size_t point_index) const;
159  const std::size_t point_index) const;
160 
168  const std::size_t point_index) const;
169 
178  void calculateRThetaToCrackFront(const Point qp,
179  const std::size_t point_index,
180  Real & r,
181  Real & theta) const;
182 
192  std::size_t calculateRThetaToCrackFront(const Point qp, Real & r, Real & theta) const;
193 
200  bool isNodeOnIntersectingBoundary(const Node * const node) const;
201 
208  bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const;
209 
215  Real getCrackFrontTangentialStrain(const std::size_t node_index) const;
216 
221  bool hasCrackFrontNodes() const
222  {
224  }
225 
234  bool isNodeInRing(const std::size_t ring_index,
235  const dof_id_type connected_node_id,
236  const std::size_t node_index) const;
237 
245  Real DomainIntegralQFunction(std::size_t crack_front_point_index,
246  std::size_t ring_index,
247  const Node * const current_node) const;
248 
256  Real DomainIntegralTopologicalQFunction(std::size_t crack_front_point_index,
257  std::size_t ring_index,
258  const Node * const current_node) const;
259 
263  void isCutterModified(const bool is_cutter_modified);
264 
265 protected:
267  const enum class DIRECTION_METHOD {
269  CRACK_MOUTH,
272 
275  const enum class END_DIRECTION_METHOD {
280 
283  {
287  };
288 
291  {
295 
300 
302  std::vector<dof_id_type> _ordered_crack_front_nodes;
304  std::vector<Point> _crack_front_points;
306  std::vector<RealVectorValue> _tangent_directions;
308  std::vector<RealVectorValue> _crack_directions;
310  std::vector<std::pair<Real, Real>> _segment_lengths;
312  std::vector<Real> _distances_along_front;
314  std::vector<Real> _angles_along_front;
316  std::vector<Real> _strain_along_front;
318  std::vector<RankTwoTensor> _rot_matrix;
332  std::vector<BoundaryName> _crack_mouth_boundary_names;
334  std::vector<BoundaryID> _crack_mouth_boundary_ids;
336  std::vector<BoundaryName> _intersecting_boundary_names;
338  std::vector<BoundaryID> _intersecting_boundary_ids;
342  std::vector<RealVectorValue> _crack_plane_normals;
352  unsigned int _axis_2d;
356  unsigned int _symmetry_plane;
359  std::string _disp_x_var_name;
360  std::string _disp_y_var_name;
361  std::string _disp_z_var_name;
364  bool _t_stress;
368  std::size_t _last_ring;
370  std::size_t _first_ring;
374  std::map<std::pair<dof_id_type, std::size_t>, std::set<dof_id_type>>
382  std::vector<Real> _j_integral_radius_inner;
384  std::vector<Real> _j_integral_radius_outer;
391  const Real _tol;
392 
397  void getCrackFrontNodes(std::set<dof_id_type> & nodes);
398 
404  void orderCrackFrontNodes(std::set<dof_id_type> & nodes);
405 
413  void orderEndNodes(std::vector<dof_id_type> & end_nodes);
414 
425  void
426  pickLoopCrackEndNodes(std::vector<dof_id_type> & end_nodes,
427  std::set<dof_id_type> & nodes,
428  std::map<dof_id_type, std::vector<dof_id_type>> & node_to_line_elem_map,
429  std::vector<std::vector<dof_id_type>> & line_elems);
439  dof_id_type maxNodeCoor(std::vector<Node *> & nodes, unsigned int dir0 = 0);
440 
446 
450  void computeCrackMouthNodes();
451 
457 
465  RealVectorValue calculateCrackFrontDirection(const Point & crack_front_point,
466  const RealVectorValue & tangent_direction,
467  const CRACK_NODE_TYPE ntype,
468  const std::size_t crack_front_point_index = 0) const;
469 
475 
480  void createQFunctionRings();
481 
494  void addNodesToQFunctionRing(std::set<dof_id_type> & nodes_new_ring,
495  const std::set<dof_id_type> & nodes_old_ring,
496  const std::set<dof_id_type> & nodes_all_rings,
497  const std::set<dof_id_type> & nodes_neighbor1,
498  const std::set<dof_id_type> & nodes_neighbor2,
499  std::vector<std::vector<const Elem *>> & nodes_to_elem_map);
500 
509  void projectToFrontAtPoint(Real & dist_to_front,
510  Real & dist_along_tangent,
511  std::size_t crack_front_point_index,
512  const Node * const current_node) const;
513 };
void calculateTangentialStrainAlongFront()
Compute the strain in the direction tangent to the crack at all points on the crack front...
void isCutterModified(const bool is_cutter_modified)
Set the value of _is_cutter_modified.
unsigned int _axis_2d
Out of plane axis when crack is treated as 2D.
void getCrackFrontNodes(std::set< dof_id_type > &nodes)
Get the set of all crack front nodes.
std::vector< BoundaryID > _intersecting_boundary_ids
IDs of boundaries that intersect crack at its ends.
bool isNodeOnIntersectingBoundary(const Node *const node) const
Determine whether a given node is on one of the boundaries that intersects an end of the crack front...
RealVectorValue calculateCrackFrontDirection(const Point &crack_front_point, const RealVectorValue &tangent_direction, const CRACK_NODE_TYPE ntype, const std::size_t crack_front_point_index=0) const
Compute the direction of crack extension for a given point on the crack front.
Real _overall_length
Overall length of the crack.
const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const
Get the vector tangent to the crack front at a specified position.
CrackFrontDefinition(const InputParameters &parameters)
std::vector< Point > _crack_front_points
Vector of points along the crack front.
bool _has_symmetry_plane
Whether the crack plane is also a symmetry plane in the model.
virtual void execute() override
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
void addCrackFrontDefinitionParams(InputParameters &params)
std::size_t _first_ring
Numer of elements from crack tip to first topological ring.
void updateCrackFrontGeometry()
Update the data structures defining the crack front geometry such as the ordered crack front nodes/po...
Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front behind the specified position.
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
CRACK_GEOM_DEFINITION
Enum used to define whether the crack front is defined using nodes or points.
std::vector< Real > _distances_along_front
Vector of distances along the crack front.
RealVectorValue _crack_direction_vector_end_2
Fixed vector optionally used to define crack extension direction at end 2 of crack front...
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
const InputParameters & parameters() const
std::map< std::pair< dof_id_type, std::size_t >, std::set< dof_id_type > > _crack_front_node_to_node_map
Data structure used to store information about topological rings Key is a pair of the crack front nod...
RealVectorValue rotateToCrackFrontCoords(const RealVectorValue vector, const std::size_t point_index) const
Rotate a vector in the global coordinate coordinate system to the crack front local coordinate system...
bool isNodeInRing(const std::size_t ring_index, const dof_id_type connected_node_id, const std::size_t node_index) const
Determine whether a node is contained within a specified volume integral element ring for a given nod...
void addNodesToQFunctionRing(std::set< dof_id_type > &nodes_new_ring, const std::set< dof_id_type > &nodes_old_ring, const std::set< dof_id_type > &nodes_all_rings, const std::set< dof_id_type > &nodes_neighbor1, const std::set< dof_id_type > &nodes_neighbor2, std::vector< std::vector< const Elem *>> &nodes_to_elem_map)
Find nodes that are connected through elements to the nodes in the previous node ring.
bool _q_function_rings
Whether topological rings are used to define the q functions.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points...
bool hasAngleAlongFront() const
Whether the distance along the crack front is available as an angle.
Real DomainIntegralQFunction(std::size_t crack_front_point_index, std::size_t ring_index, const Node *const current_node) const
Compute the q function for the case where it is defined geometrically.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
static void includeCrackFrontDefinitionParams(InputParameters &params)
used by Actions to add CrackFrontDefinitionParams
AuxiliarySystem & _aux
Reference to the auxiliary system.
std::vector< BoundaryID > _crack_mouth_boundary_ids
IDs of boundaries used to define location of crack mouth.
Real DomainIntegralTopologicalQFunction(std::size_t crack_front_point_index, std::size_t ring_index, const Node *const current_node) const
Compute the q function for the case where it is defined through element connectivity.
bool hasCrackFrontNodes() const
Determine whether the crack front was defined using nodes.
bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const
Determine whether a given crack front point is on one of the boundaries that intersects an end of the...
void computeCurvedCrackFrontCrackPlaneNormals()
Compute crack plane face normals for cracks that have a curved crack front but do not use a mesh cutt...
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack.
void updateNumberOfCrackFrontPoints(const std::size_t num_points)
Change the number of crack front nodes.
void pickLoopCrackEndNodes(std::vector< dof_id_type > &end_nodes, std::set< dof_id_type > &nodes, std::map< dof_id_type, std::vector< dof_id_type >> &node_to_line_elem_map, std::vector< std::vector< dof_id_type >> &line_elems)
For the case of a crack that is a complete loop, determine which of the nodes should be the start and...
const Real _tol
tolerance for matching nodes at crack front
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.
RealVectorValue rotateFromCrackFrontCoordsToGlobal(const RealVectorValue vector, const std::size_t point_index) const
Rotate a vector from crack front cartesian coordinate to global cartesian coordinate.
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
Class used in fracture integrals to define geometric characteristics of the crack front...
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
void orderCrackFrontNodes(std::set< dof_id_type > &nodes)
Arrange the crack front nodes by their position along the crack front, and put them in the _ordered_c...
dof_id_type maxNodeCoor(std::vector< Node *> &nodes, unsigned int dir0=0)
Find the node with the maximum value of its coordinate.
CRACK_NODE_TYPE
Enum used to define the type of the nodes on the crack front (end or middle)
const RealVectorValue & getCrackFrontNormal(const std::size_t point_index) const
Get the vector normal to the crack front at a specified position.
bool _closed_loop
Whether the crack forms a closed loop.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
void calculateRThetaToCrackFront(const Point qp, const std::size_t point_index, Real &r, Real &theta) const
Calculate r and theta of a point in the crack front polar coordinates for a given crack point index...
bool _is_cutter_modified
Indicator that shows if the cutter mesh is modified or not in the calculation step.
Real getDistanceAlongFront(const std::size_t point_index) const
Get the distance along the crack front from the beginning of the crack to the specified position...
Base class for crack front points provider.
virtual void initialSetup() override
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
std::vector< RealVectorValue > _crack_directions
Vector of crack extension directions along the crack front.
std::vector< bool > _is_point_on_intersecting_boundary
Vector of bools indicating whether individual crack front points are on an intersecting boundary...
const RealVectorValue & getCrackDirection(const std::size_t point_index) const
Get the unit vector of the crack extension direction at the specified position.
RealVectorValue _crack_direction_vector
Fixed vector optionally used to define crack extension direction.
DIRECTION_METHOD
Enum used to define the method for computing the crack extension direction.
std::vector< BoundaryName > _crack_mouth_boundary_names
Names of boundaries used to define location of crack mouth.
MooseMesh & _mesh
Reference to the mesh.
void orderEndNodes(std::vector< dof_id_type > &end_nodes)
Determine which of the end nodes should be the starting point of the crack front. ...
void projectToFrontAtPoint(Real &dist_to_front, Real &dist_along_tangent, std::size_t crack_front_point_index, const Node *const current_node) const
Project a point to a specified point along the crack front and compute the projected normal and tange...
void createQFunctionRings()
Create the data defining the rings used to define the q function when the topological option is used ...
std::vector< Real > _j_integral_radius_outer
Vector of outer radii of the rings used for geometric q functions.
unsigned int _symmetry_plane
Which plane is the symmetry plane.
END_DIRECTION_METHOD
Enum used to define the method for computing the crack extension direction at the ends of the crack...
std::string _disp_x_var_name
Names of the x, y, and z displacement variables.
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void computeCrackMouthNodes()
compute node and coordinate data for crack fronts defined by crack_mouth_boundary_ids sidesets ...
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.
static InputParameters validParams()
Real getAngleAlongFront(const std::size_t point_index) const
Get the angle along the crack front from the beginning of the crack to the specified position...
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
std::vector< BoundaryName > _intersecting_boundary_names
Names of boundaries that intersect crack at its ends.
Real getCrackFrontTangentialStrain(const std::size_t node_index) const
Get the strain in the direction tangent to the crack front at a given point.
Real getCrackFrontForwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front ahead of the specified position.
MooseEnum _q_function_type
Method used to define the q function.
bool _t_stress
Whether the T-stress is being computed.
virtual void initialize() override
RealVectorValue _crack_tangent_vector_end_2
Fixed vector optionally used to define crack tangent direction at end 2 of crack front.
bool usingMeshCutter() const
Is the crack defined by a mesh cutter object.
std::size_t _last_ring
Numer of elements from crack tip to last topological ring.
std::vector< Real > _angles_along_front
Vector of angles along the crack front.
std::vector< std::pair< Real, Real > > _segment_lengths
Vector of segment lengths along the crack front.
virtual void finalize() override
RealVectorValue _crack_tangent_vector_end_1
Fixed vector optionally used to define crack tangent direction at end 1 of crack front.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
RealVectorValue _crack_direction_vector_end_1
Fixed vector optionally used to define crack extension direction at end 1 of crack front...
bool treatAs2D() const
Whether the fracture computations are treated as 2D for the model.
std::vector< Real > _j_integral_radius_inner
Vector of inner radii of the rings used for geometric q functions.
uint8_t dof_id_type
RealVectorValue _crack_mouth_coordinates
Coordinates of crack mouth.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method