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 "SidesetReaction.h" 11 : #include "metaphysicl/raw_type.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", SidesetReaction); 14 : registerMooseObject("SolidMechanicsApp", ADSidesetReaction); 15 : 16 : template <bool is_ad> 17 : InputParameters 18 12 : SidesetReactionTempl<is_ad>::validParams() 19 : { 20 12 : InputParameters params = SideIntegralPostprocessor::validParams(); 21 12 : params.addClassDescription("Computes the integrated reaction force in a user-specified direction " 22 : "on a sideset from the surface traction"); 23 24 : params.addRequiredParam<MaterialPropertyName>("stress_tensor", "The rank two stress tensor name"); 24 24 : params.addRequiredParam<RealVectorValue>("direction", 25 : "Direction in which the force is to be computed"); 26 12 : params.set<bool>("use_displaced_mesh") = true; 27 12 : return params; 28 0 : } 29 : 30 : template <bool is_ad> 31 6 : SidesetReactionTempl<is_ad>::SidesetReactionTempl(const InputParameters & parameters) 32 : : SideIntegralPostprocessor(parameters), 33 6 : _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("stress_tensor")), 34 18 : _dir(getParam<RealVectorValue>("direction")) 35 : { 36 6 : } 37 : 38 : template <bool is_ad> 39 : Real 40 320 : SidesetReactionTempl<is_ad>::computeQpIntegral() 41 : { 42 320 : return _normals[_qp] * (MetaPhysicL::raw_value(_tensor[_qp]) * _dir); 43 : } 44 : 45 : template class SidesetReactionTempl<false>; 46 : template class SidesetReactionTempl<true>;