Line data Source code
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 : #include "MechanicsMaterialBasePD.h" 11 : #include "MooseVariable.h" 12 : 13 : InputParameters 14 1183 : MechanicsMaterialBasePD::validParams() 15 : { 16 1183 : InputParameters params = PeridynamicsMaterialBase::validParams(); 17 1183 : params.addClassDescription("Base class for Peridynamic mechanic materials"); 18 : 19 2366 : params.addRequiredCoupledVar("displacements", "Nonlinear variable name for the displacements"); 20 2366 : params.addCoupledVar("temperature", "Nonlinear variable name for the temperature"); 21 : 22 1183 : return params; 23 0 : } 24 : 25 930 : MechanicsMaterialBasePD::MechanicsMaterialBasePD(const InputParameters & parameters) 26 : : PeridynamicsMaterialBase(parameters), 27 930 : _has_temp(isCoupled("temperature")), 28 930 : _temp_var(_has_temp ? getVar("temperature", 0) : nullptr), 29 930 : _bond_status_var(&_subproblem.getStandardVariable(_tid, "bond_status")), 30 930 : _total_stretch(declareProperty<Real>("total_stretch")), 31 1860 : _mechanical_stretch(declareProperty<Real>("mechanical_stretch")) 32 : { 33 1860 : if (_dim != coupledComponents("displacements")) 34 0 : mooseError("Size of displacements vector is different from the mesh dimension!"); 35 : 36 5700 : for (unsigned int i = 0; i < coupledComponents("displacements"); ++i) 37 3840 : _disp_var.push_back(getVar("displacements", i)); 38 930 : } 39 : 40 : void 41 2614569 : MechanicsMaterialBasePD::computeBondCurrentLength() 42 : { 43 : RealGradient dxyz; 44 : dxyz.zero(); 45 : 46 8003942 : for (unsigned int i = 0; i < _dim; ++i) 47 : { 48 5389373 : dxyz(i) = (_pdmesh.getNodeCoord(_current_elem->node_id(1)))(i) + 49 5389373 : _disp_var[i]->getNodalValue(*_current_elem->node_ptr(1)); 50 5389373 : dxyz(i) -= (_pdmesh.getNodeCoord(_current_elem->node_id(0)))(i) + 51 5389373 : _disp_var[i]->getNodalValue(*_current_elem->node_ptr(0)); 52 : } 53 : 54 2614569 : _current_len = dxyz.norm(); 55 2614569 : }