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 "ProjectedStatefulMaterialAux.h" 11 : #include "NodalPatchRecoveryBase.h" 12 : #include "SerialAccess.h" 13 : #include "MaterialBase.h" 14 : #include "Assembly.h" 15 : 16 : registerMooseObject("MooseApp", ProjectedStatefulMaterialRealAux); 17 : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRealAux); 18 : registerMooseObject("MooseApp", ProjectedStatefulMaterialRealVectorValueAux); 19 : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRealVectorValueAux); 20 : registerMooseObject("MooseApp", ProjectedStatefulMaterialRankTwoTensorAux); 21 : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRankTwoTensorAux); 22 : registerMooseObject("MooseApp", ProjectedStatefulMaterialRankFourTensorAux); 23 : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRankFourTensorAux); 24 : 25 : template <typename T, bool is_ad> 26 : InputParameters 27 118820 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::validParams() 28 : { 29 118820 : auto params = AuxKernel::validParams(); 30 118820 : params.addClassDescription( 31 : "Picks a component of an indexable material property to get projected on an elemental " 32 : "Auxvariable. For use by ProjectedStatefulMaterialStorageAction."); 33 118820 : params.addRequiredParam<MaterialPropertyName>( 34 : "prop", "material property to project onto an elemental aux variable"); 35 118820 : params.addRequiredParam<unsigned int>("component", "scalar component of the property to fetch"); 36 118820 : return params; 37 0 : } 38 : 39 : template <typename T, bool is_ad> 40 2444 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::ProjectedStatefulMaterialAuxTempl( 41 : const InputParameters & parameters) 42 : : AuxKernel(parameters), 43 4888 : _current_subdomain_id(_assembly.currentSubdomainID()), 44 2444 : _prop(getGenericMaterialProperty<T, is_ad>("prop")), 45 4888 : _component(getParam<unsigned int>("component")) 46 : { 47 2444 : } 48 : 49 : template <typename T, bool is_ad> 50 : void 51 2444 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::initialSetup() 52 : { 53 : // get all material classes that provide properties for this object 54 2444 : _required_materials = buildRequiredMaterials(); 55 2444 : } 56 : 57 : template <typename T, bool is_ad> 58 : Real 59 962560 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::computeValue() 60 : { 61 962560 : if (_t_step == 0) 62 385024 : for (const auto & mat : _required_materials[_current_subdomain_id]) 63 192512 : mat->initStatefulProperties(_qrule->size()); 64 : 65 962560 : return MetaPhysicL::raw_value(Moose::serialAccess(_prop[_qp])[_component]); 66 : } 67 : 68 : template class ProjectedStatefulMaterialAuxTempl<Real, false>; 69 : template class ProjectedStatefulMaterialAuxTempl<Real, true>; 70 : template class ProjectedStatefulMaterialAuxTempl<RealVectorValue, false>; 71 : template class ProjectedStatefulMaterialAuxTempl<RealVectorValue, true>; 72 : template class ProjectedStatefulMaterialAuxTempl<RankTwoTensor, false>; 73 : template class ProjectedStatefulMaterialAuxTempl<RankTwoTensor, true>; 74 : template class ProjectedStatefulMaterialAuxTempl<RankFourTensor, false>; 75 : template class ProjectedStatefulMaterialAuxTempl<RankFourTensor, true>;