https://mooseframework.inl.gov
PeridynamicsMesh.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 "MooseMesh.h"
13 #include "MooseApp.h"
14 
15 #include "libmesh/point.h"
16 
21 {
22 public:
24 
26  PeridynamicsMesh(const PeridynamicsMesh & /* other_mesh */) = default;
27 
28  PeridynamicsMesh & operator=(const PeridynamicsMesh & other_mesh) = delete;
29  virtual std::unique_ptr<MooseMesh> safeClone() const override;
30  virtual void buildMesh() override;
31  virtual unsigned int dimension() const override;
32 
37  dof_id_type nPDNodes() const;
38 
43  dof_id_type nPDBonds() const;
44 
51  void createPeridynamicsMeshData(MeshBase & fe_mesh,
52  std::set<dof_id_type> converted_elem_id,
53  std::multimap<SubdomainID, SubdomainID> bonding_block_pairs,
54  std::multimap<SubdomainID, SubdomainID> non_bonding_block_pairs);
55 
61  std::vector<dof_id_type> getNeighbors(dof_id_type node_id);
62 
70 
76  std::vector<dof_id_type> getBonds(dof_id_type node_id);
77 
86  std::vector<dof_id_type> getBondDeformationGradientNeighbors(dof_id_type node_id,
87  dof_id_type neighbor_id);
88 
95 
100  void setNodeBlockID(SubdomainID id);
101 
107  Point getNodeCoord(dof_id_type node_id);
108 
113  std::vector<dof_id_type> getPDNodeIDToFEElemIDMap();
114 
120  Real getNodeVolume(dof_id_type node_id);
121 
128 
136  Real getHorizonSubsetVolume(dof_id_type node_id, dof_id_type neighbor_id);
137 
144 
153 
160 
166  Real getHorizon(dof_id_type node_id);
167 
174 
182  Real getNeighborWeight(dof_id_type node_id, dof_id_type neighbor_id);
183 
184 protected:
191 
193  const bool _has_cracks;
194  std::vector<Point> _cracks_start;
195  std::vector<Point> _cracks_end;
196  std::vector<Real> _cracks_width;
198 
200  unsigned int & _dim;
201 
203  unsigned int & _n_pdnodes;
204 
206  unsigned int & _n_pdbonds;
207 
209  std::vector<Point> _pdnode_coord;
210  std::vector<Real> & _pdnode_average_spacing;
211  std::vector<Real> & _pdnode_horizon_radius;
212  std::vector<Real> & _pdnode_vol;
213  std::vector<Real> & _pdnode_horizon_vol;
214  std::vector<SubdomainID> & _pdnode_blockID;
215  std::vector<dof_id_type> & _pdnode_elemID;
217 
219  std::vector<std::vector<dof_id_type>> & _pdnode_neighbors;
220 
222  std::vector<std::vector<dof_id_type>> & _pdnode_bonds;
223 
225  std::vector<std::vector<std::vector<dof_id_type>>> & _dg_neighbors;
226 
228  std::vector<std::vector<Real>> & _pdnode_sub_vol;
229 
231  std::vector<Real> & _pdnode_sub_vol_sum;
232 
234  std::map<dof_id_type, Real> & _boundary_node_offset;
235 
237  std::vector<Real> & _pdnode_weight_normalizer;
238 
244  void createNodeHorizBasedData(std::multimap<SubdomainID, SubdomainID> bonding_block_pairs,
245  std::multimap<SubdomainID, SubdomainID> non_bonding_block_pairs);
246 
252  bool checkInterface(SubdomainID pdnode_blockID_i,
253  SubdomainID pdnode_blockID_j,
254  std::multimap<SubdomainID, SubdomainID> blockID_pairs);
255 
261 
271  bool
272  checkPointInsideRectangle(Point point, Point rec_p1, Point rec_p2, Real rec_height, Real tol = 0);
273 
284  Point crack_p1, Point crack_p2, Real crack_width, Point bond_p1, Point bond_p2);
285 
294  bool checkSegmentIntersectSegment(Point seg1_p1, Point seg1_p2, Point seg2_p1, Point seg2_p2);
295 };
std::vector< std::vector< dof_id_type > > & _pdnode_neighbors
Neighbor lists for each material point determined using the horizon.
std::vector< SubdomainID > & _pdnode_blockID
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.
static InputParameters validParams()
Real getNeighborWeight(dof_id_type node_id, dof_id_type neighbor_id)
Function to return normalized weight for neighbor neighbor_id of node node_id based on predefined wei...
std::vector< dof_id_type > getBondDeformationGradientNeighbors(dof_id_type node_id, dof_id_type neighbor_id)
Function to return indices of neighbors used in formulation of bond-associated deformation gradient f...
dof_id_type nPDBonds() const
Function to return number of PD Edge elements.
void createPeridynamicsMeshData(MeshBase &fe_mesh, std::set< dof_id_type > converted_elem_id, std::multimap< SubdomainID, SubdomainID > bonding_block_pairs, std::multimap< SubdomainID, SubdomainID > non_bonding_block_pairs)
Function to assign values to member variables (PD mesh data) of this class this function will be call...
bool checkSegmentIntersectSegment(Point seg1_p1, Point seg1_p2, Point seg2_p1, Point seg2_p2)
Function to check whether a segment crosses another segment.
Real getBoundaryOffset(dof_id_type node_id)
Function to return offset for boundary nodes.
void createNodeHorizBasedData(std::multimap< SubdomainID, SubdomainID > bonding_block_pairs, std::multimap< SubdomainID, SubdomainID > non_bonding_block_pairs)
Function to create neighbors and other data for each material point with given horizon.
std::vector< Point > _cracks_end
std::vector< dof_id_type > getNeighbors(dof_id_type node_id)
Function to return neighbor nodes indices for node node_id.
const double tol
Peridynamics mesh class.
std::vector< std::vector< Real > > & _pdnode_sub_vol
Volume of horizon subsets for bond-associated deformation gradients at a node.
unsigned int & _n_pdnodes
Number of total material points.
Real getHorizonSubsetVolumeSum(dof_id_type node_id)
Function to return the summation of all horizon subset volumes for node node_id.
std::vector< Real > & _pdnode_vol
std::vector< Real > & _pdnode_sub_vol_sum
Summation of volumes of all horizon subsets at a node.
std::vector< Real > & _pdnode_average_spacing
std::map< dof_id_type, Real > & _boundary_node_offset
Offset of each boundary node to its original FE element boundary edge or face.
Real getNodeAverageSpacing(dof_id_type node_id)
Function to return the average spacing between node node_id with its most adjacent neighbors...
std::vector< dof_id_type > getPDNodeIDToFEElemIDMap()
Function to return the correspondence between PD node IDs and FE element IDs.
std::vector< dof_id_type > & _pdnode_elemID
std::vector< Point > _pdnode_coord
Data associated with each peridynamics node.
PeridynamicsMesh(const InputParameters &parameters)
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&#39;s neighbor list.
virtual void buildMesh() override
void createNeighborHorizonBasedData()
Function to create node neighbors and other data for each material point based on NEIGHBOR_HORIZON ba...
const Real _horizon_number
const Real _horizon_radius
Horizon size control parameters.
const bool _has_cracks
Information for crack generation.
Real getHorizonVolume(dof_id_type node_id)
Function to return summation of neighbor nodal volumes for node node_id.
virtual std::unique_ptr< MooseMesh > safeClone() const override
unsigned int & _dim
Mesh dimension.
std::vector< Real > & _pdnode_horizon_vol
SubdomainID getNodeBlockID(dof_id_type node_id)
Function to return block ID for node node_id.
dof_id_type nPDNodes() const
Function to return number of PD nodes.
Real getHorizonSubsetVolumeFraction(dof_id_type node_id, dof_id_type neighbor_id)
Function to return the volume fraction of a horizon subset used for bond-associated deformation gradi...
std::vector< Real > & _pdnode_horizon_radius
std::vector< Real > & _pdnode_weight_normalizer
normalizer for calculating weighted values at a node from elemental values within its horizon ...
Real getNodeVolume(dof_id_type node_id)
Function to return nodal volume for node node_id.
std::vector< Real > _cracks_width
std::vector< std::vector< dof_id_type > > & _pdnode_bonds
Bond lists associated with material points.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Point getNodeCoord(dof_id_type node_id)
Function to return coordinates for node node_id.
Real getHorizonSubsetVolume(dof_id_type node_id, dof_id_type neighbor_id)
Function to return the volume of a horizon subset for bond-associated deformation gradient calculatio...
PeridynamicsMesh & operator=(const PeridynamicsMesh &other_mesh)=delete
const bool _has_horizon_number
std::vector< std::vector< std::vector< dof_id_type > > > & _dg_neighbors
Neighbor lists for deformation gradient calculation using bond-associated horizon.
const InputParameters & parameters() const
virtual unsigned int dimension() const override
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.
std::vector< dof_id_type > getBonds(dof_id_type node_id)
Function to return the bond number connected with node node_id.
std::vector< Point > _cracks_start
unsigned int & _n_pdbonds
Number of total bonds.
void setNodeBlockID(SubdomainID id)
Function to set block ID for all PD nodes.
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...
uint8_t dof_id_type
Real getHorizon(dof_id_type node_id)
Function to return horizon size.