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 "RankTwoDirectionalComponent.h" 11 : #include "RankTwoScalarTools.h" 12 : 13 : #include "metaphysicl/raw_type.h" 14 : 15 : registerMooseObject("SolidMechanicsApp", RankTwoDirectionalComponent); 16 : registerMooseObject("SolidMechanicsApp", ADRankTwoDirectionalComponent); 17 : 18 : template <bool is_ad> 19 : InputParameters 20 0 : RankTwoDirectionalComponentTempl<is_ad>::validParams() 21 : { 22 0 : InputParameters params = Material::validParams(); 23 0 : params.addClassDescription("Compute a Direction scalar property of a RankTwoTensor"); 24 0 : params.addRequiredParam<MaterialPropertyName>("rank_two_tensor", 25 : "The rank two material property tensor name"); 26 0 : params.addRequiredParam<MaterialPropertyName>( 27 : "property_name", "Name of the material property computed by this model"); 28 0 : params.addRequiredParam<Point>("direction", "Direction to calculate component in."); 29 0 : return params; 30 0 : } 31 : 32 : template <bool is_ad> 33 0 : RankTwoDirectionalComponentTempl<is_ad>::RankTwoDirectionalComponentTempl( 34 : const InputParameters & parameters) 35 : : Material(parameters), 36 0 : _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("rank_two_tensor")), 37 0 : _property(declareGenericProperty<Real, is_ad>("property_name")), 38 0 : _direction(getParam<Point>("direction")) 39 : { 40 0 : } 41 : 42 : template <bool is_ad> 43 : void 44 0 : RankTwoDirectionalComponentTempl<is_ad>::initQpStatefulProperties() 45 : { 46 0 : _property[_qp] = 0.0; 47 0 : } 48 : 49 : template <bool is_ad> 50 : void 51 0 : RankTwoDirectionalComponentTempl<is_ad>::computeQpProperties() 52 : { 53 0 : _property[_qp] = 54 0 : RankTwoScalarTools::getDirectionalComponent(MetaPhysicL::raw_value(_tensor[_qp]), _direction); 55 0 : } 56 : 57 : template class RankTwoDirectionalComponentTempl<false>; 58 : template class RankTwoDirectionalComponentTempl<true>;