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 "GenericConstantSymmetricRankTwoTensor.h" 11 : 12 : registerMooseObject("MooseApp", GenericConstantSymmetricRankTwoTensor); 13 : registerMooseObject("MooseApp", ADGenericConstantSymmetricRankTwoTensor); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 28632 : GenericConstantSymmetricRankTwoTensorTempl<is_ad>::validParams() 18 : { 19 28632 : InputParameters params = Material::validParams(); 20 28632 : params.addClassDescription( 21 : "Object for declaring a constant symmetric rank two tensor as a material property."); 22 28632 : params.addRequiredParam<std::vector<Real>>( 23 : "tensor_values", "Vector of values defining the constant rank two tensor"); 24 28632 : params.addRequiredParam<MaterialPropertyName>( 25 : "tensor_name", "Name of the tensor material property to be created"); 26 28632 : params.set<MooseEnum>("constant_on") = "SUBDOMAIN"; 27 28632 : return params; 28 0 : } 29 : 30 : template <bool is_ad> 31 78 : GenericConstantSymmetricRankTwoTensorTempl<is_ad>::GenericConstantSymmetricRankTwoTensorTempl( 32 : const InputParameters & parameters) 33 : : Material(parameters), 34 234 : _prop(declareGenericProperty<SymmetricRankTwoTensor, is_ad>( 35 78 : getParam<MaterialPropertyName>("tensor_name"))) 36 : { 37 78 : _tensor.fillFromInputVector(getParam<std::vector<Real>>("tensor_values")); 38 78 : } 39 : 40 : template <bool is_ad> 41 : void 42 0 : GenericConstantSymmetricRankTwoTensorTempl<is_ad>::initQpStatefulProperties() 43 : { 44 0 : GenericConstantSymmetricRankTwoTensorTempl<is_ad>::computeQpProperties(); 45 0 : } 46 : 47 : template <bool is_ad> 48 : void 49 66 : GenericConstantSymmetricRankTwoTensorTempl<is_ad>::computeQpProperties() 50 : { 51 66 : _prop[_qp] = _tensor; 52 66 : } 53 : 54 : template class GenericConstantSymmetricRankTwoTensorTempl<false>; 55 : template class GenericConstantSymmetricRankTwoTensorTempl<true>;