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 "NodalRankTwoScalarPD.h" 11 : #include "RankTwoScalarTools.h" 12 : #include "RankTwoTensor.h" 13 : #include "AuxiliarySystem.h" 14 : 15 : registerMooseObject("PeridynamicsApp", NodalRankTwoScalarPD); 16 : 17 : InputParameters 18 0 : NodalRankTwoScalarPD::validParams() 19 : { 20 0 : InputParameters params = NodalRankTwoUserObjectBasePD::validParams(); 21 0 : params.addClassDescription( 22 : "Class for calculating scalar quantities of nodal rank-two stress and strain tensors " 23 : "from material properties (stress and strain) for edge elements (i.e., bonds) " 24 : "connected at that node. NOTE: This UserObject only applies to the NOSPD model."); 25 : 26 0 : params.addRequiredParam<MooseEnum>( 27 0 : "scalar_type", RankTwoScalarTools::scalarOptions(), "Type of scalar output"); 28 0 : params.addParam<Point>( 29 : "point1", 30 0 : Point(0, 0, 0), 31 : "Start point for axis used to calculate some cylindrical material tensor quantities"); 32 0 : params.addParam<Point>("point2", 33 0 : Point(0, 1, 0), 34 : "End point for axis used to calculate some material tensor quantities"); 35 0 : params.addParam<Point>("direction", Point(0, 0, 1), "Direction vector"); 36 : 37 0 : return params; 38 0 : } 39 : 40 0 : NodalRankTwoScalarPD::NodalRankTwoScalarPD(const InputParameters & parameters) 41 : : NodalRankTwoUserObjectBasePD(parameters), 42 0 : _scalar_type(getParam<MooseEnum>("scalar_type")), 43 0 : _point1(parameters.get<Point>("point1")), 44 0 : _point2(parameters.get<Point>("point2")), 45 0 : _input_direction(parameters.get<Point>("direction") / parameters.get<Point>("direction").norm()) 46 : { 47 0 : } 48 : 49 : void 50 0 : NodalRankTwoScalarPD::gatherWeightedValue(unsigned int id, dof_id_type dof, Real dg_vol_frac) 51 : { 52 0 : Point curr_point = *_current_elem->node_ptr(id); 53 0 : Real scalar_value = RankTwoScalarTools::getQuantity( 54 0 : _tensor[id], _scalar_type, _point1, _point2, curr_point, _input_direction); 55 : 56 0 : _aux.solution().add(dof, scalar_value * dg_vol_frac); 57 0 : }