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