https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
15#include <set>
17
18class AuxiliarySystem;
19
20// libMesh forward declarations
21namespace libMesh
22{
23class QBase;
24}
25
30{
31public:
33
35
36 virtual void initialSetup() override;
37 virtual void initialize() override;
38 virtual void finalize() override;
39 virtual void execute() override;
40
43
48 void updateNumberOfCrackFrontPoints(const std::size_t num_points);
49
55 const Node * getCrackFrontNodePtr(const std::size_t node_index) const;
56
62 const Point * getCrackFrontPoint(const std::size_t point_index) const;
63
69 const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const;
70
76 const RealVectorValue & getCrackFrontNormal(const std::size_t point_index) const;
77
83 Real getCrackFrontForwardSegmentLength(const std::size_t point_index) const;
84
90 Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const;
91
97 const RealVectorValue & getCrackDirection(const std::size_t point_index) const;
98
105 Real getDistanceAlongFront(const std::size_t point_index) const;
106
111 bool hasAngleAlongFront() const;
112
119 Real getAngleAlongFront(const std::size_t point_index) const;
120
125 std::size_t getNumCrackFrontPoints() const;
126
131 bool treatAs2D() const { return _treat_as_2d; }
132
137 bool usingMeshCutter() const { return _use_mesh_cutter; }
138
146 RealVectorValue rotateToCrackFrontCoords(const RealVectorValue vector,
147 const std::size_t point_index) const;
156 const std::size_t point_index) const;
157
164 RealVectorValue rotateFromCrackFrontCoordsToGlobal(const RealVectorValue vector,
165 const std::size_t point_index) const;
166
175 void calculateRThetaToCrackFront(const Point qp,
176 const std::size_t point_index,
177 Real & r,
178 Real & theta) const;
179
189 std::size_t calculateRThetaToCrackFront(const Point qp, Real & r, Real & theta) const;
190
197 bool isNodeOnIntersectingBoundary(const Node * const node) const;
198
205 bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const;
206
212 Real getCrackFrontTangentialStrain(const std::size_t node_index) const;
213
222
231 bool isNodeInRing(const std::size_t ring_index,
232 const dof_id_type connected_node_id,
233 const std::size_t node_index) const;
234
242 Real DomainIntegralQFunction(std::size_t crack_front_point_index,
243 std::size_t ring_index,
244 const Node * const current_node) const;
245
253 Real DomainIntegralTopologicalQFunction(std::size_t crack_front_point_index,
254 std::size_t ring_index,
255 const Node * const current_node) const;
256
260 void isCutterModified(const bool is_cutter_modified);
261
262protected:
269
277
285
292
297
299 std::vector<dof_id_type> _ordered_crack_front_nodes;
301 std::vector<Point> _crack_front_points;
303 std::vector<RealVectorValue> _tangent_directions;
305 std::vector<RealVectorValue> _crack_directions;
307 std::vector<std::pair<Real, Real>> _segment_lengths;
309 std::vector<Real> _distances_along_front;
311 std::vector<Real> _angles_along_front;
313 std::vector<Real> _strain_along_front;
315 std::vector<RankTwoTensor> _rot_matrix;
319 RealVectorValue _crack_direction_vector;
329 std::vector<BoundaryName> _crack_mouth_boundary_names;
331 std::vector<BoundaryID> _crack_mouth_boundary_ids;
333 std::vector<BoundaryName> _intersecting_boundary_names;
335 std::vector<BoundaryID> _intersecting_boundary_ids;
339 std::vector<RealVectorValue> _crack_plane_normals;
349 unsigned int _axis_2d;
353 unsigned int _symmetry_plane;
356 std::string _disp_x_var_name;
357 std::string _disp_y_var_name;
358 std::string _disp_z_var_name;
365 std::size_t _last_ring;
367 std::size_t _first_ring;
371 std::map<std::pair<dof_id_type, std::size_t>, std::set<dof_id_type>>
379 std::vector<Real> _j_integral_radius_inner;
381 std::vector<Real> _j_integral_radius_outer;
388 const Real _tol;
389
394 void getCrackFrontNodes(std::set<dof_id_type> & nodes);
395
401 void orderCrackFrontNodes(std::set<dof_id_type> & nodes);
402
410 void orderEndNodes(std::vector<dof_id_type> & end_nodes);
411
422 void
423 pickLoopCrackEndNodes(std::vector<dof_id_type> & end_nodes,
424 std::set<dof_id_type> & nodes,
425 std::map<dof_id_type, std::vector<dof_id_type>> & node_to_line_elem_map,
426 std::vector<std::vector<dof_id_type>> & line_elems);
436 dof_id_type maxNodeCoor(std::vector<Node *> & nodes, unsigned int dir0 = 0);
437
443
448
454
462 RealVectorValue calculateCrackFrontDirection(const Point & crack_front_point,
463 const RealVectorValue & tangent_direction,
464 const CRACK_NODE_TYPE ntype,
465 const std::size_t crack_front_point_index = 0) const;
466
472
478
491 void addNodesToQFunctionRing(std::set<dof_id_type> & nodes_new_ring,
492 const std::set<dof_id_type> & nodes_old_ring,
493 const std::set<dof_id_type> & nodes_all_rings,
494 const std::set<dof_id_type> & nodes_neighbor1,
495 const std::set<dof_id_type> & nodes_neighbor2,
496 std::vector<std::vector<const Elem *>> & nodes_to_elem_map);
497
506 void projectToFrontAtPoint(Real & dist_to_front,
507 Real & dist_along_tangent,
508 std::size_t crack_front_point_index,
509 const Node * const current_node) const;
510};
Class used in fracture integrals to define geometric characteristics of the crack front.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.
static void includeCrackFrontDefinitionParams(InputParameters &params)
used by Actions to add CrackFrontDefinitionParams
std::vector< BoundaryName > _intersecting_boundary_names
Names of boundaries that intersect crack at its ends.
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points.
void updateNumberOfCrackFrontPoints(const std::size_t num_points)
Change the number of crack front nodes.
MooseMesh & _mesh
Reference to the mesh.
CRACK_NODE_TYPE
Enum used to define the type of the nodes on the crack front (end or middle)
void createQFunctionRings()
Create the data defining the rings used to define the q function when the topological option is used ...
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
DIRECTION_METHOD
Enum used to define the method for computing the crack extension direction.
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
dof_id_type maxNodeCoor(std::vector< Node * > &nodes, unsigned int dir0=0)
Find the node with the maximum value of its coordinate.
Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front behind the specified position.
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...
std::vector< BoundaryID > _intersecting_boundary_ids
IDs of boundaries that intersect crack at its ends.
virtual void initialize() override
bool hasAngleAlongFront() const
Whether the distance along the crack front is available as an angle.
std::size_t _first_ring
Numer of elements from crack tip to first topological ring.
RealVectorValue _crack_tangent_vector_end_2
Fixed vector optionally used to define crack tangent direction at end 2 of crack front.
Real _overall_length
Overall length of the crack.
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...
std::vector< Point > _crack_front_points
Vector of points along the crack front.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
std::vector< Real > _j_integral_radius_outer
Vector of outer radii of the rings used for geometric q functions.
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.
bool hasCrackFrontNodes() const
Determine whether the crack front was defined using nodes.
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...
MooseEnum _q_function_type
Method used to define the q function.
const Real _tol
tolerance for matching nodes at crack front
void computeCrackMouthNodes()
compute node and coordinate data for crack fronts defined by crack_mouth_boundary_ids sidesets
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.
RealVectorValue _crack_mouth_coordinates
Coordinates of crack mouth.
std::vector< bool > _is_point_on_intersecting_boundary
Vector of bools indicating whether individual crack front points are on an intersecting boundary.
virtual void initialSetup() override
bool treatAs2D() const
Whether the fracture computations are treated as 2D for the model.
virtual void execute() override
std::vector< std::pair< Real, Real > > _segment_lengths
Vector of segment lengths along the crack front.
std::vector< Real > _distances_along_front
Vector of distances along the crack front.
static InputParameters validParams()
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.
Real getCrackFrontTangentialStrain(const std::size_t node_index) const
Get the strain in the direction tangent to the crack front at a given point.
void computeCurvedCrackFrontCrackPlaneNormals()
Compute crack plane face normals for cracks that have a curved crack front but do not use a mesh cutt...
std::size_t _last_ring
Numer of elements from crack tip to last topological ring.
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 _is_cutter_modified
Indicator that shows if the cutter mesh is modified or not in the calculation step.
std::vector< Real > _angles_along_front
Vector of angles along the crack front.
unsigned int _symmetry_plane
Which plane is the symmetry plane.
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...
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.
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
void orderEndNodes(std::vector< dof_id_type > &end_nodes)
Determine which of the end nodes should be the starting point of the crack front.
virtual void finalize() override
std::vector< Real > _j_integral_radius_inner
Vector of inner radii of the rings used for geometric q functions.
void isCutterModified(const bool is_cutter_modified)
Set the value of _is_cutter_modified.
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack.
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...
END_DIRECTION_METHOD
Enum used to define the method for computing the crack extension direction at the ends of the crack.
bool usingMeshCutter() const
Is the crack defined by a mesh cutter object.
std::vector< BoundaryName > _crack_mouth_boundary_names
Names of boundaries used to define location of crack mouth.
void getCrackFrontNodes(std::set< dof_id_type > &nodes)
Get the set of all crack front nodes.
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
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.
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.
RealVectorValue _crack_direction_vector
Fixed vector optionally used to define crack extension direction.
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.
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_end_2
Fixed vector optionally used to define crack extension direction at end 2 of crack front.
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 _crack_direction_vector_end_1
Fixed vector optionally used to define crack extension direction at end 1 of 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.
void calculateTangentialStrainAlongFront()
Compute the strain in the direction tangent to the crack at all points on the crack front.
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...
std::vector< BoundaryID > _crack_mouth_boundary_ids
IDs of boundaries used to define location of crack mouth.
bool _t_stress
Whether the T-stress is being computed.
AuxiliarySystem & _aux
Reference to the auxiliary system.
bool _has_symmetry_plane
Whether the crack plane is also a symmetry plane in the model.
RealVectorValue rotateFromCrackFrontCoordsToGlobal(const RealVectorValue vector, const std::size_t point_index) const
Rotate a vector from crack front cartesian coordinate to global cartesian coordinate.
bool _q_function_rings
Whether topological rings are used to define the q functions.
const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const
Get the vector tangent to the crack front at a specified position.
std::vector< RealVectorValue > _crack_directions
Vector of crack extension directions along the crack front.
std::string _disp_x_var_name
Names of the x, y, and z displacement variables.
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...
RealVectorValue _crack_tangent_vector_end_1
Fixed vector optionally used to define crack tangent direction at end 1 of crack front.
unsigned int _axis_2d
Out of plane axis when crack is treated as 2D.
void updateCrackFrontGeometry()
Update the data structures defining the crack front geometry such as the ordered crack front nodes/po...
Base class for crack front points provider.
Coupled auxiliary value.
const InputParameters & parameters() const
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...