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 "RankFourAux.h" 11 : 12 : #include "metaphysicl/raw_type.h" 13 : 14 : registerMooseObject("SolidMechanicsApp", RankFourAux); 15 : registerMooseObject("SolidMechanicsApp", ADRankFourAux); 16 : 17 : template <bool is_ad> 18 : InputParameters 19 1080 : RankFourAuxTempl<is_ad>::validParams() 20 : { 21 1080 : InputParameters params = AuxKernel::validParams(); 22 1080 : params.addClassDescription("Access a component of a RankFourTensor"); 23 : 24 : // add stuff here 25 2160 : params.addRequiredParam<MaterialPropertyName>("rank_four_tensor", 26 : "The rank four material tensor name"); 27 2160 : params.addRequiredRangeCheckedParam<unsigned int>( 28 : "index_i", 29 : "index_i >= 0 & index_i <= 2", 30 : "The index i of ijkl for the tensor to output (0, 1, 2)"); 31 2160 : params.addRequiredRangeCheckedParam<unsigned int>( 32 : "index_j", 33 : "index_j >= 0 & index_j <= 2", 34 : "The index j of ijkl for the tensor to output (0, 1, 2)"); 35 2160 : params.addRequiredRangeCheckedParam<unsigned int>( 36 : "index_k", 37 : "index_k >= 0 & index_k <= 2", 38 : "The index k of ijkl for the tensor to output (0, 1, 2)"); 39 2160 : params.addRequiredRangeCheckedParam<unsigned int>( 40 : "index_l", 41 : "index_l >= 0 & index_l <= 2", 42 : "The index l of ijkl for the tensor to output (0, 1, 2)"); 43 : 44 1080 : return params; 45 0 : } 46 : 47 : template <bool is_ad> 48 540 : RankFourAuxTempl<is_ad>::RankFourAuxTempl(const InputParameters & parameters) 49 : : AuxKernel(parameters), 50 540 : _tensor(getGenericMaterialProperty<RankFourTensor, is_ad>("rank_four_tensor")), 51 1080 : _i(getParam<unsigned int>("index_i")), 52 1080 : _j(getParam<unsigned int>("index_j")), 53 1080 : _k(getParam<unsigned int>("index_k")), 54 1620 : _l(getParam<unsigned int>("index_l")) 55 : { 56 540 : } 57 : 58 : template <bool is_ad> 59 : Real 60 87488 : RankFourAuxTempl<is_ad>::computeValue() 61 : { 62 87488 : return MetaPhysicL::raw_value(_tensor[_qp](_i, _j, _k, _l)); 63 : } 64 : 65 : template class RankFourAuxTempl<false>; 66 : template class RankFourAuxTempl<true>;