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 "HeatSourceBPD.h" 11 : #include "PeridynamicsMesh.h" 12 : #include "Function.h" 13 : 14 : registerMooseObject("PeridynamicsApp", HeatSourceBPD); 15 : 16 : InputParameters 17 22 : HeatSourceBPD::validParams() 18 : { 19 22 : InputParameters params = PeridynamicsKernelBase::validParams(); 20 22 : params.addClassDescription( 21 : "Class for calculating the residual from heat source for the bond-based " 22 : "peridynamic heat conduction formulation"); 23 : 24 44 : params.addRequiredParam<FunctionName>("power_density", "Volumetric heat source density"); 25 : 26 22 : return params; 27 0 : } 28 : 29 12 : HeatSourceBPD::HeatSourceBPD(const InputParameters & parameters) 30 12 : : PeridynamicsKernelBase(parameters), _power_density(getFunction("power_density")) 31 : { 32 12 : } 33 : 34 : void 35 232006 : HeatSourceBPD::computeLocalResidual() 36 : { 37 696018 : for (unsigned int nd = 0; nd < _nnodes; ++nd) 38 : { 39 464012 : std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors(_current_elem->node_id(nd)); 40 464012 : _local_re(nd) = -_power_density.value(_t) * _node_vol[nd] / neighbors.size(); 41 464012 : } 42 232006 : }