www.mooseframework.org
PeridynamicsMesh.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "MooseMesh.h"
13 #include "MooseApp.h"
14 
15 #include "libmesh/point.h"
16 
17 class PeridynamicsMesh;
18 
19 template <>
20 InputParameters validParams<PeridynamicsMesh>();
21 
25 class PeridynamicsMesh : public MooseMesh
26 {
27 public:
28  PeridynamicsMesh(const InputParameters & parameters);
29  PeridynamicsMesh(const PeridynamicsMesh & /* other_mesh */) = default;
30 
31  PeridynamicsMesh & operator=(const PeridynamicsMesh & other_mesh) = delete;
32  virtual std::unique_ptr<MooseMesh> safeClone() const override;
33  virtual void buildMesh() override;
34  virtual unsigned int dimension() const override;
35 
40  dof_id_type nPDNodes() const;
41 
46  dof_id_type nPDBonds() const;
47 
54  void
55  createPeridynamicsMeshData(MeshBase & fe_mesh,
56  std::set<dof_id_type> converted_elem_id,
57  std::multimap<SubdomainID, SubdomainID> connect_block_id_pairs,
58  std::multimap<SubdomainID, SubdomainID> non_connect_block_id_pairs);
59 
65  std::vector<dof_id_type> getNeighbors(dof_id_type node_id);
66 
73  dof_id_type getNeighborIndex(dof_id_type node_i, dof_id_type node_j);
74 
80  std::vector<dof_id_type> getBonds(dof_id_type node_id);
81 
90  std::vector<dof_id_type> getDefGradNeighbors(dof_id_type node_id, unsigned int neighbor_id);
91 
97  SubdomainID getNodeBlockID(dof_id_type node_id);
98 
103  void setNodeBlockID(SubdomainID id);
104 
110  Point getPDNodeCoord(dof_id_type node_id);
111 
116  std::vector<dof_id_type> getPDNodeIDToFiniteElemIDMap();
117 
123  Real getPDNodeVolume(dof_id_type node_id);
124 
130  Real getHorizVolume(dof_id_type node_id);
131 
141  Real getDefGradVolFraction(dof_id_type node_id, dof_id_type neighbor_id);
142 
148  Real getNodeAvgSpacing(dof_id_type node_id);
149 
155  Real getHorizon(dof_id_type node_id);
156 
162  Real getBoundaryOffset(dof_id_type node_id);
163 
164 protected:
166  const Real _horiz_rad;
167  const bool _has_horiz_num;
168  const Real _horiz_num;
169  const Real _bah_ratio;
171 
173  const bool _has_cracks;
174  std::vector<Point> _cracks_start;
175  std::vector<Point> _cracks_end;
176  std::vector<Real> _cracks_width;
178 
180  unsigned int & _dim;
181 
183  unsigned int & _n_pdnodes;
184 
186  unsigned int & _n_pdbonds;
187 
189  std::vector<Point> _pdnode_coord;
190  std::vector<Real> & _pdnode_avg_spacing;
191  std::vector<Real> & _pdnode_horiz_rad;
192  std::vector<Real> & _pdnode_vol;
193  std::vector<Real> & _pdnode_horiz_vol;
194  std::vector<SubdomainID> & _pdnode_blockID;
195  std::vector<dof_id_type> & _pdnode_elemID;
197 
199  std::vector<std::vector<dof_id_type>> & _pdnode_neighbors;
200 
202  std::vector<std::vector<dof_id_type>> & _pdnode_bonds;
203 
205  std::vector<std::vector<std::vector<dof_id_type>>> & _dg_neighbors;
206 
208  std::vector<std::vector<Real>> & _dg_vol_frac;
209 
211  std::map<dof_id_type, Real> & _boundary_node_offset;
212 
218  void createNodeHorizBasedData(std::multimap<SubdomainID, SubdomainID> connect_block_id_pairs,
219  std::multimap<SubdomainID, SubdomainID> non_connect_block_id_pairs);
220 
226  bool checkInterface(SubdomainID pdnode_blockID_i,
227  SubdomainID pdnode_blockID_j,
228  std::multimap<SubdomainID, SubdomainID> blockID_pairs);
229 
235 
245  bool
246  checkPointInsideRectangle(Point point, Point rec_p1, Point rec_p2, Real rec_height, Real tol = 0);
247 
258  Point crack_p1, Point crack_p2, Real crack_width, Point bond_p1, Point bond_p2);
259 
268  bool checkSegmentIntersectSegment(Point seg1_p1, Point seg1_p2, Point seg2_p1, Point seg2_p2);
269 };
PeridynamicsMesh::_dim
unsigned int & _dim
Mesh dimension.
Definition: PeridynamicsMesh.h:180
PeridynamicsMesh::getPDNodeIDToFiniteElemIDMap
std::vector< dof_id_type > getPDNodeIDToFiniteElemIDMap()
Function to return the correspondence between PD node IDs and FE element IDs.
Definition: PeridynamicsMesh.C:429
PeridynamicsMesh::getNodeBlockID
SubdomainID getNodeBlockID(dof_id_type node_id)
Function to return block ID for node node_id.
Definition: PeridynamicsMesh.C:405
PeridynamicsMesh::getPDNodeVolume
Real getPDNodeVolume(dof_id_type node_id)
Function to return nodal volume for node node_id.
Definition: PeridynamicsMesh.C:435
PeridynamicsMesh::checkPointInsideRectangle
bool checkPointInsideRectangle(Point point, Point rec_p1, Point rec_p2, Real rec_height, Real tol=0)
Function to check whether a material point falls within a given rectangular crack geometry.
Definition: PeridynamicsMesh.C:489
PeridynamicsMesh::PeridynamicsMesh
PeridynamicsMesh(const InputParameters &parameters)
Definition: PeridynamicsMesh.C:42
PeridynamicsMesh::_pdnode_horiz_rad
std::vector< Real > & _pdnode_horiz_rad
Definition: PeridynamicsMesh.h:191
PeridynamicsMesh::checkCrackIntersectBond
bool checkCrackIntersectBond(Point crack_p1, Point crack_p2, Real crack_width, Point bond_p1, Point bond_p2)
Function to check whether a bond crosses crack surface.
Definition: PeridynamicsMesh.C:513
PeridynamicsMesh::safeClone
virtual std::unique_ptr< MooseMesh > safeClone() const override
Definition: PeridynamicsMesh.C:105
PeridynamicsMesh::_cracks_width
std::vector< Real > _cracks_width
Definition: PeridynamicsMesh.h:176
PeridynamicsMesh::_dg_vol_frac
std::vector< std::vector< Real > > & _dg_vol_frac
Volume fraction of deformation gradient region to its sum at a node.
Definition: PeridynamicsMesh.h:208
PeridynamicsMesh::dimension
virtual unsigned int dimension() const override
Definition: PeridynamicsMesh.C:120
PeridynamicsMesh::_pdnode_avg_spacing
std::vector< Real > & _pdnode_avg_spacing
Definition: PeridynamicsMesh.h:190
PeridynamicsMesh::_pdnode_bonds
std::vector< std::vector< dof_id_type > > & _pdnode_bonds
Bond lists associated with material points.
Definition: PeridynamicsMesh.h:202
PeridynamicsMesh::checkInterface
bool checkInterface(SubdomainID pdnode_blockID_i, SubdomainID pdnode_blockID_j, std::multimap< SubdomainID, SubdomainID > blockID_pairs)
Function to check existence of interface between two blocks.
Definition: PeridynamicsMesh.C:305
PeridynamicsMesh::_dg_neighbors
std::vector< std::vector< std::vector< dof_id_type > > > & _dg_neighbors
Neighbor lists for deformation gradient calculation using bond-associated horizon.
Definition: PeridynamicsMesh.h:205
PeridynamicsMesh::_pdnode_horiz_vol
std::vector< Real > & _pdnode_horiz_vol
Definition: PeridynamicsMesh.h:193
PeridynamicsMesh::createPeridynamicsMeshData
void createPeridynamicsMeshData(MeshBase &fe_mesh, std::set< dof_id_type > converted_elem_id, std::multimap< SubdomainID, SubdomainID > connect_block_id_pairs, std::multimap< SubdomainID, SubdomainID > non_connect_block_id_pairs)
Function to assign values to member variables (PD mesh data) of this class this function will be call...
Definition: PeridynamicsMesh.C:138
PeridynamicsMesh::getBoundaryOffset
Real getBoundaryOffset(dof_id_type node_id)
Function to return offset for boundary nodes.
Definition: PeridynamicsMesh.C:480
PeridynamicsMesh
Peridynamics mesh class.
Definition: PeridynamicsMesh.h:25
validParams< PeridynamicsMesh >
InputParameters validParams< PeridynamicsMesh >()
Definition: PeridynamicsMesh.C:18
PeridynamicsMesh::_pdnode_neighbors
std::vector< std::vector< dof_id_type > > & _pdnode_neighbors
Neighbor lists for each material point determined using the horizon.
Definition: PeridynamicsMesh.h:199
PeridynamicsMesh::setNodeBlockID
void setNodeBlockID(SubdomainID id)
Function to set block ID for all PD nodes.
Definition: PeridynamicsMesh.C:414
PeridynamicsMesh::createNodeHorizBasedData
void createNodeHorizBasedData(std::multimap< SubdomainID, SubdomainID > connect_block_id_pairs, std::multimap< SubdomainID, SubdomainID > non_connect_block_id_pairs)
Function to create neighbors and other data for each material point with given horizon.
Definition: PeridynamicsMesh.C:237
PeridynamicsMesh::operator=
PeridynamicsMesh & operator=(const PeridynamicsMesh &other_mesh)=delete
PeridynamicsMesh::nPDBonds
dof_id_type nPDBonds() const
Function to return number of PD Edge elements.
Definition: PeridynamicsMesh.C:132
tol
const double tol
Definition: Setup.h:18
PeridynamicsMesh::_horiz_num
const Real _horiz_num
Definition: PeridynamicsMesh.h:168
PeridynamicsMesh::getPDNodeCoord
Point getPDNodeCoord(dof_id_type node_id)
Function to return coordinates for node node_id.
Definition: PeridynamicsMesh.C:420
PeridynamicsMesh::_pdnode_vol
std::vector< Real > & _pdnode_vol
Definition: PeridynamicsMesh.h:192
PeridynamicsMesh::_boundary_node_offset
std::map< dof_id_type, Real > & _boundary_node_offset
Offset of each boundary node to its original FE element boundary edge or face.
Definition: PeridynamicsMesh.h:211
PeridynamicsMesh::_cracks_start
std::vector< Point > _cracks_start
Definition: PeridynamicsMesh.h:174
PeridynamicsMesh::getNeighbors
std::vector< dof_id_type > getNeighbors(dof_id_type node_id)
Function to return neighbor nodes indices for node node_id.
Definition: PeridynamicsMesh.C:362
PeridynamicsMesh::getHorizon
Real getHorizon(dof_id_type node_id)
Function to return horizon size.
Definition: PeridynamicsMesh.C:471
PeridynamicsMesh::_has_cracks
const bool _has_cracks
Information for crack generation.
Definition: PeridynamicsMesh.h:173
PeridynamicsMesh::_cracks_end
std::vector< Point > _cracks_end
Definition: PeridynamicsMesh.h:175
PeridynamicsMesh::checkSegmentIntersectSegment
bool checkSegmentIntersectSegment(Point seg1_p1, Point seg1_p2, Point seg2_p1, Point seg2_p2)
Function to check whether a segment crosses another segment.
Definition: PeridynamicsMesh.C:548
PeridynamicsMesh::getHorizVolume
Real getHorizVolume(dof_id_type node_id)
Function to return summation of neighbor nodal volumes for node node_id.
Definition: PeridynamicsMesh.C:444
PeridynamicsMesh::_pdnode_elemID
std::vector< dof_id_type > & _pdnode_elemID
Definition: PeridynamicsMesh.h:195
PeridynamicsMesh::getBonds
std::vector< dof_id_type > getBonds(dof_id_type node_id)
Function to return the bond number connected with node node_id.
Definition: PeridynamicsMesh.C:382
PeridynamicsMesh::getNeighborIndex
dof_id_type getNeighborIndex(dof_id_type node_i, dof_id_type node_j)
Function to return the local neighbor index of node_j from node_i's neighbor list.
Definition: PeridynamicsMesh.C:368
PeridynamicsMesh::_pdnode_blockID
std::vector< SubdomainID > & _pdnode_blockID
Definition: PeridynamicsMesh.h:194
PeridynamicsMesh::_n_pdbonds
unsigned int & _n_pdbonds
Number of total bonds.
Definition: PeridynamicsMesh.h:186
PeridynamicsMesh::createNeighborHorizonBasedData
void createNeighborHorizonBasedData()
Function to create node neighbors and other data for each material point based on NEIGHBOR_HORIZON ba...
Definition: PeridynamicsMesh.C:329
PeridynamicsMesh::getNodeAvgSpacing
Real getNodeAvgSpacing(dof_id_type node_id)
Function to return the average spacing between node node_id with its most adjacent neighbors.
Definition: PeridynamicsMesh.C:462
PeridynamicsMesh::buildMesh
virtual void buildMesh() override
Definition: PeridynamicsMesh.C:111
PeridynamicsMesh::getDefGradNeighbors
std::vector< dof_id_type > getDefGradNeighbors(dof_id_type node_id, unsigned int neighbor_id)
Function to return indices of neighbors used in formulation of bond-associated deformation gradient f...
Definition: PeridynamicsMesh.C:391
PeridynamicsMesh::_bah_ratio
const Real _bah_ratio
Definition: PeridynamicsMesh.h:169
PeridynamicsMesh::getDefGradVolFraction
Real getDefGradVolFraction(dof_id_type node_id, dof_id_type neighbor_id)
Function to return summation of volumes of bond-associated neighbors used in the deformation gradient...
Definition: PeridynamicsMesh.C:453
PeridynamicsMesh::_n_pdnodes
unsigned int & _n_pdnodes
Number of total material points.
Definition: PeridynamicsMesh.h:183
PeridynamicsMesh::nPDNodes
dof_id_type nPDNodes() const
Function to return number of PD nodes.
Definition: PeridynamicsMesh.C:126
PeridynamicsMesh::_horiz_rad
const Real _horiz_rad
Horizon size control parameters.
Definition: PeridynamicsMesh.h:166
PeridynamicsMesh::_pdnode_coord
std::vector< Point > _pdnode_coord
Data associated with each peridynamics node.
Definition: PeridynamicsMesh.h:189
PeridynamicsMesh::_has_horiz_num
const bool _has_horiz_num
Definition: PeridynamicsMesh.h:167