Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
GeneralizedPlaneStrainUserObjectOSPD.C
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 
11 #include "RankFourTensor.h"
12 #include "Function.h"
13 
15 
18 {
20  params.addClassDescription("Class for calculating the scalar residual and diagonal Jacobian "
21  "entry of generalized plane strain in OSPD formulation");
22 
23  params.addCoupledVar("out_of_plane_stress_variable",
24  "Auxiliary variable name for out-of-plane stress in GPS simulation");
25 
26  return params;
27 }
28 
30  const InputParameters & parameters)
32  _out_of_plane_stress_var(getVar("out_of_plane_stress_variable", 0))
33 {
34 }
35 
36 void
38 {
39  // dof_id_type for node i and j
40  dof_id_type node_i = _current_elem->node_id(0);
41  dof_id_type node_j = _current_elem->node_id(1);
42 
43  // coordinates for node i and j
44  Point coord_i = _pdmesh.getNodeCoord(node_i);
45  Point coord_j = _pdmesh.getNodeCoord(node_j);
46 
47  // nodal area for node i and j
48  Real nv_i = _pdmesh.getNodeVolume(node_i);
49  Real nv_j = _pdmesh.getNodeVolume(node_j);
50 
51  // number of neighbors for node i and j, used to avoid repeated accounting nodal stress in
52  // element-wise loop
53 
54  // calculate number of active neighbors for node i and j
55  std::vector<unsigned int> active_neighbors(_nnodes, 0);
56  for (unsigned int nd = 0; nd < _nnodes; nd++)
57  {
58  std::vector<dof_id_type> bonds = _pdmesh.getBonds(_current_elem->node_id(nd));
59  for (unsigned int nb = 0; nb < bonds.size(); ++nb)
60  if (_bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[nb])) > 0.5)
61  active_neighbors[nd]++;
62 
63  if (active_neighbors[nd] == 0) // avoid dividing by zero
64  active_neighbors[nd] = 1;
65  }
66 
68 
69  // residual
71  _pressure.value(_t, coord_i) * _factor) *
72  nv_i / active_neighbors[0] * bond_status;
74  _pressure.value(_t, coord_j) * _factor) *
75  nv_j / active_neighbors[1] * bond_status;
76 
77  // diagonal jacobian
78  _jacobian += (_Cijkl[0](2, 2, 2, 2) * nv_i / active_neighbors[0] +
79  _Cijkl[0](2, 2, 2, 2) * nv_j / active_neighbors[1]) *
80  bond_status;
81 }
const Function & _pressure
Applied out-of-plane force parameters.
const MaterialProperty< RankFourTensor > & _Cijkl
Elasticity tensor.
virtual Elem * elemPtr(const dof_id_type i)
PeridynamicsMesh & _pdmesh
Reference to Peridynamic mesh.
UserObject class to compute the residual and diagonal Jacobian components for scalar out-of-plane str...
registerMooseObject("PeridynamicsApp", GeneralizedPlaneStrainUserObjectOSPD)
OutputData getElementalValue(const Elem *elem, unsigned int idx=0) const
const unsigned int _nnodes
number of nodes for a edge element
MooseVariable * _bond_status_var
Bond status aux variable.
Real getNodeVolume(dof_id_type node_id)
Function to return nodal volume for node node_id.
void addCoupledVar(const std::string &name, const std::string &doc_string)
OutputData getNodalValue(const Node &node) const
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.
const Elem *const & _current_elem
GeneralizedPlaneStrainUserObjectOSPD(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
virtual Real value(Real t, const Point &p) const
std::vector< dof_id_type > getBonds(dof_id_type node_id)
Function to return the bond number connected with node node_id.
MooseVariable * _out_of_plane_stress_var
Variable for out-of-plane stress component.
uint8_t dof_id_type
Base userObject class to compute the residual and diagonal Jacobian components for scalar out-of-plan...