https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
36void
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)
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}
registerMooseObject("PeridynamicsApp", GeneralizedPlaneStrainUserObjectOSPD)
PeridynamicsMesh & _pdmesh
Reference to Peridynamic mesh.
MooseVariable * _bond_status_var
Bond status aux variable.
const unsigned int _nnodes
number of nodes for a edge element
const Elem *const & _current_elem
virtual Real value(Real t, const Point &p) const
Base userObject class to compute the residual and diagonal Jacobian components for scalar out-of-plan...
const Function & _pressure
Applied out-of-plane force parameters.
const MaterialProperty< RankFourTensor > & _Cijkl
Elasticity tensor.
UserObject class to compute the residual and diagonal Jacobian components for scalar out-of-plane str...
MooseVariable * _out_of_plane_stress_var
Variable for out-of-plane stress component.
GeneralizedPlaneStrainUserObjectOSPD(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual Elem * elemPtr(const dof_id_type i)
DofValue getElementalValue(const Elem *elem, unsigned int idx=0) const
DofValue getNodalValue(const Node &node) const
Real getNodeVolume(dof_id_type node_id)
Function to return nodal volume for node node_id.
Point getNodeCoord(dof_id_type node_id)
Function to return coordinates for node node_id.
std::vector< dof_id_type > getBonds(dof_id_type node_id)
Function to return the bond number connected with node node_id.