https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MechanicsOSPD Class Reference

Kernel class for ordinary state based peridynamic solid mechanics models for small strain. More...

#include <MechanicsOSPD.h>

Inheritance diagram for MechanicsOSPD:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 MechanicsOSPD (const InputParameters &parameters)
 
virtual void computeOffDiagJacobian (unsigned int jvar) override
 
virtual void initialSetup () override
 
virtual void prepare () override
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void computeLocalResidual () override
 
virtual void computeNonlocalResidual () override
 
virtual void computeLocalJacobian () override
 
virtual void computeNonlocalJacobian () override
 
void computeLocalOffDiagJacobian (unsigned int, unsigned int coupled_component) override
 Function to compute local contribution to the off-diagonal Jacobian at the current nodes. More...
 
void computePDNonlocalOffDiagJacobian (unsigned int jvar_num, unsigned int coupled_component) override
 Function to compute nonlocal contribution to the off-diagonal Jacobian at the current nodes. More...
 

Protected Attributes

const unsigned int _component
 The index of displacement component. More...
 
std::vector< MooseVariable * > _disp_var
 displacement variables More...
 
unsigned int _ndisp
 number of displacement components More...
 
const std::vector< RealGradient > * _orientation
 Vector of bond in current configuration. More...
 
std::vector< dof_id_type_ivardofs
 Current variable dof numbers for nodes i and j. More...
 
std::vector< Real_weights
 weights used for the current element to obtain the nodal stress More...
 
RealGradient _current_vec
 Vector of bond in current configuration. More...
 
RealGradient _current_unit_vec
 Unit vector of bond in current configuration. More...
 
const MaterialProperty< Real > & _bond_local_force
 Bond based material properties. More...
 
const MaterialProperty< Real > & _bond_nonlocal_force
 
const MaterialProperty< Real > & _bond_local_dfdU
 
const MaterialProperty< Real > & _bond_nonlocal_dfdU
 
const MaterialProperty< Real > & _bond_local_dfdT
 
const MaterialProperty< Real > & _bond_nonlocal_dfdT
 
const bool _temp_coupled
 Temperature variable. More...
 
MooseVariable_temp_var
 
const bool _out_of_plane_strain_coupled
 Parameters for out-of-plane strain in weak plane stress formulation. More...
 
MooseVariable_out_of_plane_strain_var
 

Detailed Description

Kernel class for ordinary state based peridynamic solid mechanics models for small strain.

Definition at line 17 of file MechanicsOSPD.h.

Constructor & Destructor Documentation

◆ MechanicsOSPD()

MechanicsOSPD::MechanicsOSPD ( const InputParameters parameters)

Definition at line 30 of file MechanicsOSPD.C.

31  : MechanicsBasePD(parameters),
32  _bond_local_force(getMaterialProperty<Real>("bond_local_force")),
33  _bond_nonlocal_force(getMaterialProperty<Real>("bond_nonlocal_force")),
34  _bond_local_dfdU(getMaterialProperty<Real>("bond_dfdU")),
35  _bond_nonlocal_dfdU(getMaterialProperty<Real>("bond_nonlocal_dfdU")),
36  _bond_local_dfdT(getMaterialProperty<Real>("bond_dfdT")),
37  _bond_nonlocal_dfdT(getMaterialProperty<Real>("bond_nonlocal_dfdT")),
38  _component(getParam<unsigned int>("component"))
39 {
40 }
MechanicsBasePD(const InputParameters &parameters)
const MaterialProperty< Real > & _bond_local_dfdT
Definition: MechanicsOSPD.h:41
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
const MaterialProperty< Real > & _bond_local_dfdU
Definition: MechanicsOSPD.h:39
const MaterialProperty< Real > & _bond_nonlocal_dfdU
Definition: MechanicsOSPD.h:40
const MaterialProperty< Real > & _bond_local_force
Bond based material properties.
Definition: MechanicsOSPD.h:37
const MaterialProperty< Real > & _bond_nonlocal_dfdT
Definition: MechanicsOSPD.h:42
const MaterialProperty< Real > & _bond_nonlocal_force
Definition: MechanicsOSPD.h:38

Member Function Documentation

◆ computeLocalJacobian()

void MechanicsOSPD::computeLocalJacobian ( )
overrideprotectedvirtual

Definition at line 111 of file MechanicsOSPD.C.

112 {
113  const Real val =
116  _current_vec.norm();
117 
118  for (unsigned int i = 0; i < _nnodes; ++i)
119  for (unsigned int j = 0; j < _nnodes; ++j)
120  _local_ke(i, j) += (i == j ? 1 : -1) * val * _bond_status;
121 }
auto norm() const -> decltype(std::norm(Real()))
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
const MaterialProperty< Real > & _bond_local_dfdU
Definition: MechanicsOSPD.h:39
RealGradient _current_vec
Vector of bond in current configuration.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _bond_local_force
Bond based material properties.
Definition: MechanicsOSPD.h:37
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ computeLocalOffDiagJacobian()

void MechanicsOSPD::computeLocalOffDiagJacobian ( unsigned int  ,
unsigned int   
)
overrideprotectedvirtual

Function to compute local contribution to the off-diagonal Jacobian at the current nodes.

Parameters
coupled_componentThe coupled variable number

Reimplemented from MechanicsBasePD.

Definition at line 124 of file MechanicsOSPD.C.

125 {
126  if (_temp_coupled && jvar_num == _temp_var->number())
127  {
128  for (unsigned int i = 0; i < _nnodes; ++i)
129  for (unsigned int j = 0; j < _nnodes; ++j)
130  _local_ke(i, j) +=
131  (i == 1 ? 1 : -1) * _current_unit_vec(_component) * _bond_local_dfdT[0] * _bond_status;
132  }
133  else
134  {
135  const Real val =
138  _current_unit_vec(coupled_component) / _current_vec.norm();
139 
140  for (unsigned int i = 0; i < _nnodes; ++i)
141  for (unsigned int j = 0; j < _nnodes; ++j)
142  _local_ke(i, j) += (i == j ? 1 : -1) * val * _bond_status;
143  }
144 }
const bool _temp_coupled
Temperature variable.
auto norm() const -> decltype(std::norm(Real()))
unsigned int number() const
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
const MaterialProperty< Real > & _bond_local_dfdT
Definition: MechanicsOSPD.h:41
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
const MaterialProperty< Real > & _bond_local_dfdU
Definition: MechanicsOSPD.h:39
RealGradient _current_vec
Vector of bond in current configuration.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _bond_local_force
Bond based material properties.
Definition: MechanicsOSPD.h:37
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
MooseVariable * _temp_var

◆ computeLocalResidual()

void MechanicsOSPD::computeLocalResidual ( )
overrideprotectedvirtual

Definition at line 43 of file MechanicsOSPD.C.

44 {
45  // H term
46  _local_re(0) = -_bond_local_force[0] * _current_unit_vec(_component) * _bond_status;
47  _local_re(1) = -_local_re(0);
48 }
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
const MaterialProperty< Real > & _bond_local_force
Bond based material properties.
Definition: MechanicsOSPD.h:37

◆ computeNonlocalJacobian()

void MechanicsOSPD::computeNonlocalJacobian ( )
overrideprotectedvirtual

Definition at line 147 of file MechanicsOSPD.C.

148 {
149  for (unsigned int nd = 0; nd < _nnodes; ++nd)
150  {
151  // calculation of jacobian contribution to current_node's neighbors
152  std::vector<dof_id_type> ivardofs(_nnodes);
153  ivardofs[nd] = _ivardofs[nd];
154  std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors(_current_elem->node_id(nd));
155  std::vector<dof_id_type> bonds = _pdmesh.getBonds(_current_elem->node_id(nd));
156 
157  Real vol_nb;
158  RealGradient origin_vec_nb, current_vec_nb;
159 
160  for (unsigned int nb = 0; nb < neighbors.size(); ++nb)
161  if (_bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[nb])) > 0.5)
162  {
163  ivardofs[1 - nd] =
164  _pdmesh.nodePtr(neighbors[nb])->dof_number(_sys.number(), _var.number(), 0);
165  vol_nb = _pdmesh.getNodeVolume(neighbors[nb]);
166 
167  origin_vec_nb =
168  _pdmesh.getNodeCoord(neighbors[nb]) - _pdmesh.getNodeCoord(_current_elem->node_id(nd));
169 
170  for (unsigned int k = 0; k < _dim; ++k)
171  current_vec_nb(k) = origin_vec_nb(k) +
172  _disp_var[k]->getNodalValue(*_pdmesh.nodePtr(neighbors[nb])) -
173  _disp_var[k]->getNodalValue(*_current_elem->node_ptr(nd));
174 
175  current_vec_nb /= current_vec_nb.norm();
176 
177  const Real val = (nd == 0 ? 1 : -1) * current_vec_nb(_component) *
179 
180  _local_ke.zero();
181  for (unsigned int i = 0; i < _nnodes; ++i)
182  for (unsigned int j = 0; j < _nnodes; ++j)
183  _local_ke(i, j) +=
184  (i == j ? 1 : -1) * val / origin_vec_nb.norm() * vol_nb * _bond_status;
185 
186  addJacobian(_assembly, _local_ke, ivardofs, _ivardofs, _var.scalingFactor());
187 
188  if (_has_diag_save_in)
189  {
190  unsigned int rows = _nnodes;
191  DenseVector<Real> diag(rows);
192  for (unsigned int i = 0; i < rows; ++i)
193  diag(i) = _local_ke(i, i);
194 
195  diag(1 - nd) = 0;
196 
197  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
198  for (unsigned int i = 0; i < _diag_save_in.size(); ++i)
199  {
200  std::vector<dof_id_type> diag_save_in_dofs(2);
201  diag_save_in_dofs[nd] = _current_elem->node_ptr(nd)->dof_number(
202  _diag_save_in[i]->sys().number(), _diag_save_in[i]->number(), 0);
203  diag_save_in_dofs[1 - nd] =
204  _pdmesh.nodePtr(neighbors[nb])
205  ->dof_number(_diag_save_in[i]->sys().number(), _diag_save_in[i]->number(), 0);
206 
207  _diag_save_in[i]->sys().solution().add_vector(diag, diag_save_in_dofs);
208  }
209  }
210 
211  const Real val2 = _bond_nonlocal_force[nd] *
212  (1.0 - current_vec_nb(_component) * current_vec_nb(_component)) /
213  current_vec_nb.norm();
214 
215  _local_ke.zero();
216  for (unsigned int i = 0; i < _nnodes; ++i)
217  for (unsigned int j = 0; j < _nnodes; ++j)
218  _local_ke(i, j) +=
219  (i == j ? 1 : -1) * val2 / origin_vec_nb.norm() * vol_nb * _bond_status;
220 
221  addJacobian(_assembly, _local_ke, ivardofs, ivardofs, _var.scalingFactor());
222 
223  if (_has_diag_save_in)
224  {
225  unsigned int rows = _nnodes;
226  DenseVector<Real> diag(rows);
227  for (unsigned int i = 0; i < rows; ++i)
228  diag(i) = _local_ke(i, i);
229 
230  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
231  for (unsigned int i = 0; i < _diag_save_in.size(); ++i)
232  {
233  std::vector<dof_id_type> diag_save_in_dofs(2);
234  diag_save_in_dofs[nd] = _current_elem->node_ptr(nd)->dof_number(
235  _diag_save_in[i]->sys().number(), _diag_save_in[i]->number(), 0);
236  diag_save_in_dofs[1 - nd] =
237  _pdmesh.nodePtr(neighbors[nb])
238  ->dof_number(_diag_save_in[i]->sys().number(), _diag_save_in[i]->number(), 0);
239 
240  _diag_save_in[i]->sys().solution().add_vector(diag, diag_save_in_dofs);
241  }
242  }
243  }
244  }
245 }
auto norm() const -> decltype(std::norm(Real()))
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
std::vector< MooseVariable * > _disp_var
displacement variables
std::vector< dof_id_type > _ivardofs
Current variable dof numbers for nodes i and j.
const MaterialProperty< Real > & _bond_nonlocal_dfdU
Definition: MechanicsOSPD.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const MaterialProperty< Real > & _bond_nonlocal_force
Definition: MechanicsOSPD.h:38
static const std::string k
Definition: NS.h:130

◆ computeNonlocalResidual()

void MechanicsOSPD::computeNonlocalResidual ( )
overrideprotectedvirtual

Definition at line 51 of file MechanicsOSPD.C.

52 {
53  // P and Q terms
54  for (unsigned int nd = 0; nd < _nnodes; ++nd)
55  {
56  // calculation of residual contribution to current_node's neighbors
57  std::vector<dof_id_type> ivardofs(_nnodes);
58  ivardofs[nd] = _ivardofs[nd];
59  std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors(_current_elem->node_id(nd));
60  std::vector<dof_id_type> bonds = _pdmesh.getBonds(_current_elem->node_id(nd));
61 
62  Real vol_nb;
63  RealGradient origin_vec_nb, current_vec_nb;
64 
65  for (unsigned int nb = 0; nb < neighbors.size(); ++nb)
66  if (_bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[nb])) > 0.5)
67  {
68  ivardofs[1 - nd] =
69  _pdmesh.nodePtr(neighbors[nb])->dof_number(_sys.number(), _var.number(), 0);
70  vol_nb = _pdmesh.getNodeVolume(neighbors[nb]);
71 
72  origin_vec_nb =
73  _pdmesh.getNodeCoord(neighbors[nb]) - _pdmesh.getNodeCoord(_current_elem->node_id(nd));
74 
75  for (unsigned int i = 0; i < _dim; ++i)
76  current_vec_nb(i) = origin_vec_nb(i) +
77  _disp_var[i]->getNodalValue(*_pdmesh.nodePtr(neighbors[nb])) -
78  _disp_var[i]->getNodalValue(*_current_elem->node_ptr(nd));
79 
80  current_vec_nb /= current_vec_nb.norm();
81 
82  _local_re(0) = (nd == 0 ? -1 : 1) * _bond_nonlocal_force[nd] * vol_nb /
83  origin_vec_nb.norm() * current_vec_nb(_component) * _bond_status;
84  _local_re(1) = -_local_re(0);
85 
86  // cache the residual contribution to node_i and its neighbor nb using their global dof
87  // indices
88  addResiduals(_assembly, _local_re, ivardofs, _var.scalingFactor());
89 
90  // save in the displacement residuals
91  if (_has_save_in)
92  {
93  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
94  for (unsigned int i = 0; i < _save_in.size(); ++i)
95  {
96  std::vector<dof_id_type> save_in_dofs(2);
97  save_in_dofs[nd] = _current_elem->node_ptr(nd)->dof_number(
98  _save_in[i]->sys().number(), _save_in[i]->number(), 0);
99  save_in_dofs[1 - nd] =
100  _pdmesh.nodePtr(neighbors[nb])
101  ->dof_number(_save_in[i]->sys().number(), _save_in[i]->number(), 0);
102 
103  _save_in[i]->sys().solution().add_vector(_local_re, save_in_dofs);
104  }
105  }
106  }
107  }
108 }
auto norm() const -> decltype(std::norm(Real()))
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
std::vector< MooseVariable * > _disp_var
displacement variables
std::vector< dof_id_type > _ivardofs
Current variable dof numbers for nodes i and j.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _bond_nonlocal_force
Definition: MechanicsOSPD.h:38

◆ computeOffDiagJacobian()

void MechanicsBasePD::computeOffDiagJacobian ( unsigned int  jvar)
overridevirtualinherited

Definition at line 73 of file MechanicsBasePD.C.

74 {
75  prepare();
76 
77  if (jvar_num == _var.number())
78  computeJacobian();
79  else
80  {
81  unsigned int coupled_component = 0;
82  bool active = false;
83 
84  for (unsigned int i = 0; i < _dim; ++i)
85  if (jvar_num == _disp_var[i]->number())
86  {
87  coupled_component = i;
88  active = true;
89  }
90 
91  if (_temp_coupled && jvar_num == _temp_var->number())
92  active = true;
93 
95  active = true;
96 
97  if (active)
98  {
99  prepareMatrixTag(_assembly, _var.number(), jvar_num);
100  computeLocalOffDiagJacobian(jvar_num, coupled_component);
101  accumulateTaggedLocalMatrix();
102 
103  if (_use_full_jacobian)
104  computePDNonlocalOffDiagJacobian(jvar_num, coupled_component);
105  }
106  }
107 }
const bool _temp_coupled
Temperature variable.
unsigned int number() const
virtual void computeLocalOffDiagJacobian(unsigned int, unsigned int)
Function to compute local contribution to the off-diagonal Jacobian at the current nodes...
const bool _out_of_plane_strain_coupled
Parameters for out-of-plane strain in weak plane stress formulation.
std::vector< MooseVariable * > _disp_var
displacement variables
virtual void prepare() override
MooseVariable * _out_of_plane_strain_var
virtual void computePDNonlocalOffDiagJacobian(unsigned int, unsigned int)
Function to compute nonlocal contribution to the off-diagonal Jacobian at the current nodes...
MooseVariable * _temp_var

◆ computePDNonlocalOffDiagJacobian()

void MechanicsOSPD::computePDNonlocalOffDiagJacobian ( unsigned int  ,
unsigned int   
)
overrideprotectedvirtual

Function to compute nonlocal contribution to the off-diagonal Jacobian at the current nodes.

Parameters
jvar_numThe number of the first coupled variable
coupled_componentThe component number of the second coupled variable

Reimplemented from MechanicsBasePD.

Definition at line 248 of file MechanicsOSPD.C.

250 {
251  std::vector<dof_id_type> jvardofs_ij(_nnodes);
252  for (unsigned int nd = 0; nd < _nnodes; ++nd)
253  jvardofs_ij[nd] = _current_elem->node_ptr(nd)->dof_number(_sys.number(), jvar_num, 0);
254 
255  for (unsigned int nd = 0; nd < _nnodes; ++nd)
256  {
257  // calculation of jacobian contribution to current_node's neighbors
258  std::vector<dof_id_type> ivardofs(_nnodes), jvardofs(_nnodes);
259  ivardofs[nd] = _ivardofs[nd];
260  jvardofs[nd] = jvardofs_ij[nd];
261  std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors(_current_elem->node_id(nd));
262  std::vector<dof_id_type> bonds = _pdmesh.getBonds(_current_elem->node_id(nd));
263 
264  Real vol_nb;
265  RealGradient origin_vec_nb, current_vec_nb;
266 
267  for (unsigned int nb = 0; nb < neighbors.size(); ++nb)
268  if (_bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[nb])) > 0.5)
269  {
270  ivardofs[1 - nd] =
271  _pdmesh.nodePtr(neighbors[nb])->dof_number(_sys.number(), _var.number(), 0);
272  jvardofs[1 - nd] = _pdmesh.nodePtr(neighbors[nb])->dof_number(_sys.number(), jvar_num, 0);
273  vol_nb = _pdmesh.getNodeVolume(neighbors[nb]);
274 
275  origin_vec_nb =
276  _pdmesh.getNodeCoord(neighbors[nb]) - _pdmesh.getNodeCoord(_current_elem->node_id(nd));
277 
278  for (unsigned int i = 0; i < _dim; ++i)
279  current_vec_nb(i) = origin_vec_nb(i) +
280  _disp_var[i]->getNodalValue(*_pdmesh.nodePtr(neighbors[nb])) -
281  _disp_var[i]->getNodalValue(*_current_elem->node_ptr(nd));
282 
283  current_vec_nb /= current_vec_nb.norm();
284 
285  _local_ke.zero();
286  if (_temp_coupled && jvar_num == _temp_var->number())
287  {
288  const Real val =
289  current_vec_nb(_component) * _bond_nonlocal_dfdT[nd] / origin_vec_nb.norm() * vol_nb;
290 
291  _local_ke(0, nd) += (nd == 0 ? -1 : 1) * val * _bond_status;
292  _local_ke(1, nd) += (nd == 0 ? 1 : -1) * val * _bond_status;
293  }
294  else
295  {
296  const Real val = (nd == 0 ? 1 : -1) * current_vec_nb(_component) *
297  _current_unit_vec(coupled_component) * _bond_nonlocal_dfdU[nd] /
298  origin_vec_nb.norm() * vol_nb;
299 
300  for (unsigned int i = 0; i < _nnodes; ++i)
301  for (unsigned int j = 0; j < _nnodes; ++j)
302  _local_ke(i, j) += (i == j ? 1 : -1) * val * _bond_status;
303  }
304 
305  addJacobian(_assembly, _local_ke, ivardofs, jvardofs_ij, _var.scalingFactor());
306  }
307  }
308 }
const bool _temp_coupled
Temperature variable.
auto norm() const -> decltype(std::norm(Real()))
unsigned int number() const
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
const unsigned int _component
The index of displacement component.
Definition: MechanicsOSPD.h:46
std::vector< MooseVariable * > _disp_var
displacement variables
std::vector< dof_id_type > _ivardofs
Current variable dof numbers for nodes i and j.
const MaterialProperty< Real > & _bond_nonlocal_dfdU
Definition: MechanicsOSPD.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const MaterialProperty< Real > & _bond_nonlocal_dfdT
Definition: MechanicsOSPD.h:42
MooseVariable * _temp_var

◆ initialSetup()

void MechanicsBasePD::initialSetup ( )
overridevirtualinherited

Definition at line 45 of file MechanicsBasePD.C.

46 {
47  _orientation = &_assembly.getFE(FEType(), 1)->get_dxyzdxi();
48 }
const std::vector< RealGradient > * _orientation
Vector of bond in current configuration.

◆ prepare()

void MechanicsBasePD::prepare ( )
overridevirtualinherited

Definition at line 51 of file MechanicsBasePD.C.

Referenced by MechanicsBasePD::computeOffDiagJacobian(), GeneralizedPlaneStrainOffDiagOSPD::computeOffDiagJacobianScalar(), and GeneralizedPlaneStrainOffDiagNOSPD::computeOffDiagJacobianScalar().

52 {
54 
55  _ivardofs.resize(_nnodes);
56  _weights.resize(_nnodes);
57  for (unsigned int nd = 0; nd < _nnodes; ++nd)
58  {
59  _ivardofs[nd] = _current_elem->node_ptr(nd)->dof_number(_sys.number(), _var.number(), 0);
60  _weights[nd] = _pdmesh.getNeighborWeight(
61  _current_elem->node_id(nd),
62  _pdmesh.getNeighborIndex(_current_elem->node_id(nd), _current_elem->node_id(1 - nd)));
63  }
64 
65  for (unsigned int i = 0; i < _dim; ++i)
66  _current_vec(i) = _origin_vec(i) + _disp_var[i]->getNodalValue(*_current_elem->node_ptr(1)) -
67  _disp_var[i]->getNodalValue(*_current_elem->node_ptr(0));
68 
70 }
auto norm() const -> decltype(std::norm(Real()))
RealGradient _current_unit_vec
Unit vector of bond in current configuration.
std::vector< Real > _weights
weights used for the current element to obtain the nodal stress
std::vector< MooseVariable * > _disp_var
displacement variables
RealGradient _current_vec
Vector of bond in current configuration.
std::vector< dof_id_type > _ivardofs
Current variable dof numbers for nodes i and j.
virtual void prepare()
Function to precalculate data which will be used in the derived classes.

◆ validParams()

InputParameters MechanicsOSPD::validParams ( )
static

Definition at line 16 of file MechanicsOSPD.C.

17 {
19  params.addClassDescription(
20  "Class for calculating the residual and Jacobian for the ordinary state-based "
21  "peridynamic mechanics formulation");
22 
23  params.addRequiredParam<unsigned int>(
24  "component",
25  "An integer corresponding to the variable this kernel acts on (0 for x, 1 for y, 2 for z)");
26 
27  return params;
28 }
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _bond_local_dfdT

const MaterialProperty<Real>& MechanicsOSPD::_bond_local_dfdT
protected

Definition at line 41 of file MechanicsOSPD.h.

Referenced by computeLocalOffDiagJacobian().

◆ _bond_local_dfdU

const MaterialProperty<Real>& MechanicsOSPD::_bond_local_dfdU
protected

Definition at line 39 of file MechanicsOSPD.h.

Referenced by computeLocalJacobian(), and computeLocalOffDiagJacobian().

◆ _bond_local_force

const MaterialProperty<Real>& MechanicsOSPD::_bond_local_force
protected

Bond based material properties.

Definition at line 37 of file MechanicsOSPD.h.

Referenced by computeLocalJacobian(), computeLocalOffDiagJacobian(), and computeLocalResidual().

◆ _bond_nonlocal_dfdT

const MaterialProperty<Real>& MechanicsOSPD::_bond_nonlocal_dfdT
protected

Definition at line 42 of file MechanicsOSPD.h.

Referenced by computePDNonlocalOffDiagJacobian().

◆ _bond_nonlocal_dfdU

const MaterialProperty<Real>& MechanicsOSPD::_bond_nonlocal_dfdU
protected

Definition at line 40 of file MechanicsOSPD.h.

Referenced by computeNonlocalJacobian(), and computePDNonlocalOffDiagJacobian().

◆ _bond_nonlocal_force

const MaterialProperty<Real>& MechanicsOSPD::_bond_nonlocal_force
protected

Definition at line 38 of file MechanicsOSPD.h.

Referenced by computeNonlocalJacobian(), and computeNonlocalResidual().

◆ _component

const unsigned int MechanicsOSPD::_component
protected

◆ _current_unit_vec

RealGradient MechanicsBasePD::_current_unit_vec
protectedinherited

◆ _current_vec

RealGradient MechanicsBasePD::_current_vec
protectedinherited

◆ _disp_var

std::vector<MooseVariable *> MechanicsBasePD::_disp_var
protectedinherited

◆ _ivardofs

std::vector<dof_id_type> MechanicsBasePD::_ivardofs
protectedinherited

◆ _ndisp

unsigned int MechanicsBasePD::_ndisp
protectedinherited

number of displacement components

Definition at line 55 of file MechanicsBasePD.h.

Referenced by MechanicsBasePD::MechanicsBasePD().

◆ _orientation

const std::vector<RealGradient>* MechanicsBasePD::_orientation
protectedinherited

Vector of bond in current configuration.

Definition at line 63 of file MechanicsBasePD.h.

Referenced by MechanicsBasePD::initialSetup().

◆ _out_of_plane_strain_coupled

const bool MechanicsBasePD::_out_of_plane_strain_coupled
protectedinherited

◆ _out_of_plane_strain_var

MooseVariable* MechanicsBasePD::_out_of_plane_strain_var
protectedinherited

◆ _temp_coupled

const bool MechanicsBasePD::_temp_coupled
protectedinherited

◆ _temp_var

MooseVariable* MechanicsBasePD::_temp_var
protectedinherited

◆ _weights

std::vector<Real> MechanicsBasePD::_weights
protectedinherited

The documentation for this class was generated from the following files: