www.mooseframework.org
CrackFrontDefinition.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef CRACKFRONTDEFINITION_H
8 #define CRACKFRONTDEFINITION_H
9 
10 #include "GeneralUserObject.h"
12 #include "BoundaryRestrictable.h"
13 #include <set>
14 
16 class AuxiliarySystem;
17 class RankTwoTensor;
18 
19 // libMesh forward declarations
20 namespace libMesh
21 {
22 class QBase;
23 }
24 
25 template <>
26 InputParameters validParams<CrackFrontDefinition>();
27 void addCrackFrontDefinitionParams(InputParameters & params);
28 
32 class CrackFrontDefinition : public GeneralUserObject, public BoundaryRestrictable
33 {
34 public:
35  CrackFrontDefinition(const InputParameters & parameters);
36  virtual ~CrackFrontDefinition();
37 
38  virtual void initialSetup();
39  virtual void initialize();
40  virtual void finalize();
41  virtual void execute();
42 
43  const Node * getCrackFrontNodePtr(const unsigned int node_index) const;
44  const Point * getCrackFrontPoint(const unsigned int point_index) const;
45  const RealVectorValue & getCrackFrontTangent(const unsigned int point_index) const;
46  Real getCrackFrontForwardSegmentLength(const unsigned int point_index) const;
47  Real getCrackFrontBackwardSegmentLength(const unsigned int point_index) const;
48  const RealVectorValue & getCrackDirection(const unsigned int point_index) const;
49  Real getDistanceAlongFront(const unsigned int point_index) const;
50  bool hasAngleAlongFront() const;
51  Real getAngleAlongFront(const unsigned int point_index) const;
52  unsigned int getNumCrackFrontPoints() const;
53  bool treatAs2D() const { return _treat_as_2d; }
54  RealVectorValue rotateToCrackFrontCoords(const RealVectorValue vector,
55  const unsigned int point_index) const;
56  RankTwoTensor rotateToCrackFrontCoords(const RankTwoTensor tensor,
57  const unsigned int point_index) const;
58 
62  RealVectorValue rotateFromCrackFrontCoordsToGlobal(const RealVectorValue vector,
63  const unsigned int point_index) const;
64 
69  void calculateRThetaToCrackFront(const Point qp,
70  const unsigned int point_index,
71  Real & r,
72  Real & theta) const;
78  unsigned int calculateRThetaToCrackFront(const Point qp, Real & r, Real & theta) const;
79 
80  bool isNodeOnIntersectingBoundary(const Node * const node) const;
81  bool isPointWithIndexOnIntersectingBoundary(const unsigned int point_index) const;
82  Real getCrackFrontTangentialStrain(const unsigned int node_index) const;
83  bool hasCrackFrontNodes() const { return _geom_definition_method == CRACK_FRONT_NODES; }
84  bool isNodeInRing(const unsigned int ring_index,
85  const dof_id_type connected_node_id,
86  const unsigned int node_index) const;
87 
88  Real DomainIntegralQFunction(unsigned int crack_front_point_index,
89  unsigned int ring_index,
90  const Node * const current_node) const;
91  Real DomainIntegralTopologicalQFunction(unsigned int crack_front_point_index,
92  unsigned int ring_index,
93  const Node * const current_node) const;
94 
95 protected:
97  {
100  CURVED_CRACK_FRONT
101  };
102 
104  {
106  END_CRACK_DIRECTION_VECTOR
107  };
108 
110  {
113  END_2_NODE
114  };
115 
117  {
119  CRACK_FRONT_POINTS
120  };
121 
122  AuxiliarySystem & _aux;
123  MooseMesh & _mesh;
124  static const Real _tol;
125 
126  std::vector<unsigned int> _ordered_crack_front_nodes;
128  std::vector<Point> _crack_front_points;
129  std::vector<RealVectorValue> _tangent_directions;
130  std::vector<RealVectorValue> _crack_directions;
131  std::vector<std::pair<Real, Real>> _segment_lengths;
132  std::vector<Real> _distances_along_front;
133  std::vector<Real> _angles_along_front;
134  std::vector<Real> _strain_along_front;
135  std::vector<RankTwoTensor> _rot_matrix;
139  RealVectorValue _crack_direction_vector;
142  std::vector<BoundaryName> _crack_mouth_boundary_names;
143  std::vector<BoundaryID> _crack_mouth_boundary_ids;
144  std::vector<BoundaryName> _intersecting_boundary_names;
145  std::vector<BoundaryID> _intersecting_boundary_ids;
146  RealVectorValue _crack_mouth_coordinates;
147  RealVectorValue _crack_plane_normal;
150  unsigned int _axis_2d;
152  unsigned int _symmetry_plane;
153  std::string _disp_x_var_name;
154  std::string _disp_y_var_name;
155  std::string _disp_z_var_name;
156  bool _t_stress;
158  unsigned int _last_ring;
159  unsigned int _first_ring;
160  std::map<std::pair<dof_id_type, unsigned int>, std::set<dof_id_type>>
162  MooseEnum _q_function_type;
164  std::vector<Real> _j_integral_radius_inner;
165  std::vector<Real> _j_integral_radius_outer;
168 
169  void getCrackFrontNodes(std::set<dof_id_type> & nodes);
170  void orderCrackFrontNodes(std::set<dof_id_type> & nodes);
171  void orderEndNodes(std::vector<dof_id_type> & end_nodes);
172  void
173  pickLoopCrackEndNodes(std::vector<dof_id_type> & end_nodes,
174  std::set<dof_id_type> & nodes,
175  std::map<dof_id_type, std::vector<dof_id_type>> & node_to_line_elem_map,
176  std::vector<std::vector<dof_id_type>> & line_elems);
177  unsigned int maxNodeCoor(std::vector<Node *> & nodes, unsigned int dir0 = 0);
178  void updateCrackFrontGeometry();
179  void updateDataForCrackDirection();
180  RealVectorValue calculateCrackFrontDirection(const Point & crack_front_point,
181  const RealVectorValue & tangent_direction,
182  const CRACK_NODE_TYPE ntype) const;
183  void calculateTangentialStrainAlongFront();
184  void createQFunctionRings();
185  void addNodesToQFunctionRing(std::set<dof_id_type> & nodes_new_ring,
186  const std::set<dof_id_type> & nodes_old_ring,
187  const std::set<dof_id_type> & nodes_all_rings,
188  const std::set<dof_id_type> & nodes_neighbor1,
189  const std::set<dof_id_type> & nodes_neighbor2,
190  std::vector<std::vector<const Elem *>> & nodes_to_elem_map);
191  void projectToFrontAtPoint(Real & dist_to_front,
192  Real & dist_along_tangent,
193  unsigned int crack_front_point_index,
194  const Node * const current_node) const;
195 };
196 
197 #endif /* CRACKFRONTDEFINITION_H */
std::vector< BoundaryID > _intersecting_boundary_ids
std::vector< Point > _crack_front_points
void addCrackFrontDefinitionParams(InputParameters &params)
std::vector< Real > _distances_along_front
END_DIRECTION_METHOD _end_direction_method
std::map< std::pair< dof_id_type, unsigned int >, std::set< dof_id_type > > _crack_front_node_to_node_map
RealVectorValue _crack_direction_vector_end_2
const CrackFrontPointsProvider * _crack_front_points_provider
DIRECTION_METHOD _direction_method
std::vector< BoundaryID > _crack_mouth_boundary_ids
Coupled auxiliary value.
std::vector< RankTwoTensor > _rot_matrix
Works on top of NodalNormalsPreprocessor.
CRACK_GEOM_DEFINITION _geom_definition_method
Base class for crack front points provider.
std::vector< Real > _strain_along_front
std::vector< RealVectorValue > _crack_directions
std::vector< bool > _is_point_on_intersecting_boundary
RealVectorValue _crack_direction_vector
unsigned int _num_points_from_provider
RealVectorValue _crack_plane_normal
std::vector< BoundaryName > _crack_mouth_boundary_names
std::vector< Real > _j_integral_radius_outer
bool hasCrackFrontNodes() const
InputParameters validParams< CrackFrontDefinition >()
std::vector< RealVectorValue > _tangent_directions
std::vector< BoundaryName > _intersecting_boundary_names
std::vector< Real > _angles_along_front
std::vector< std::pair< Real, Real > > _segment_lengths
RealVectorValue _crack_direction_vector_end_1
std::vector< unsigned int > _ordered_crack_front_nodes
std::vector< Real > _j_integral_radius_inner
RealVectorValue _crack_mouth_coordinates