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 "NodalRankTwoUserObjectBasePD.h" 11 : #include "RankTwoTensor.h" 12 : #include "AuxiliarySystem.h" 13 : 14 : InputParameters 15 0 : NodalRankTwoUserObjectBasePD::validParams() 16 : { 17 0 : InputParameters params = NodalAuxVariableUserObjectBasePD::validParams(); 18 0 : params.addClassDescription( 19 : "Base class for calculating components and scalar type quantities of nodal rank-two stress " 20 : "and strain tensors from material properties (stress and strain) for edge elements " 21 : "(i.e., bonds) connected at that node. NOTE: This UserObject only applies to the NOSPD " 22 : "model."); 23 : 24 0 : params.addRequiredParam<MaterialPropertyName>( 25 : "rank_two_tensor", "Name of the nodal rank two tensors (stress/strains)"); 26 : 27 0 : params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END; 28 : 29 0 : return params; 30 0 : } 31 : 32 0 : NodalRankTwoUserObjectBasePD::NodalRankTwoUserObjectBasePD(const InputParameters & parameters) 33 : : NodalAuxVariableUserObjectBasePD(parameters), 34 0 : _tensor(getMaterialProperty<RankTwoTensor>("rank_two_tensor")) 35 : { 36 0 : } 37 : 38 : void 39 0 : NodalRankTwoUserObjectBasePD::computeValue(unsigned int id, dof_id_type dof) 40 : { 41 : dof_id_type id_j_in_i = 42 0 : _pdmesh.getNeighborIndex(_current_elem->node_id(id), _current_elem->node_id(1 - id)); 43 0 : Real weight = _pdmesh.getNeighborWeight(_current_elem->node_id(id), id_j_in_i); 44 : 45 : // gather volume weighted contribution only if the bond is active 46 0 : if (_bond_status_var->getElementalValue(_current_elem) > 0.5) 47 0 : gatherWeightedValue(id, dof, weight); 48 0 : }