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 "ComputeElasticityTensorBase.h" 11 : #include "Function.h" 12 : 13 : template <bool is_ad, typename T> 14 : InputParameters 15 34640 : ComputeElasticityTensorBaseTempl<is_ad, T>::validParams() 16 : { 17 34640 : InputParameters params = Material::validParams(); 18 69280 : params.addParam<FunctionName>( 19 : "elasticity_tensor_prefactor", 20 : "Optional function to use as a scalar prefactor on the elasticity tensor."); 21 69280 : params.addParam<std::string>("base_name", 22 : "Optional parameter that allows the user to define " 23 : "multiple mechanics material systems on the same " 24 : "block, i.e. for multiple phases"); 25 34640 : return params; 26 0 : } 27 : 28 : template <bool is_ad, typename T> 29 25960 : ComputeElasticityTensorBaseTempl<is_ad, T>::ComputeElasticityTensorBaseTempl( 30 : const InputParameters & parameters) 31 : : DerivativeMaterialInterface<Material>(parameters), 32 : GuaranteeProvider(this), 33 27856 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 34 25960 : _elasticity_tensor_name(_base_name + "elasticity_tensor"), 35 25960 : _elasticity_tensor(declareGenericProperty<T, is_ad>(_elasticity_tensor_name)), 36 51920 : _effective_stiffness(declareGenericProperty<Real, is_ad>(_base_name + "effective_stiffness")), 37 25960 : _prefactor_function(isParamValid("elasticity_tensor_prefactor") 38 26104 : ? &getFunction("elasticity_tensor_prefactor") 39 25960 : : nullptr) 40 : { 41 25960 : } 42 : 43 : template <bool is_ad, typename T> 44 : void 45 183311682 : ComputeElasticityTensorBaseTempl<is_ad, T>::computeQpProperties() 46 : { 47 183311682 : _effective_stiffness[_qp] = 0; // Currently overriden by ComputeIsotropicElasticityTensor 48 183311682 : computeQpElasticityTensor(); 49 : 50 : // Multiply by prefactor 51 183311682 : if (_prefactor_function) 52 : { 53 511648 : _elasticity_tensor[_qp] *= _prefactor_function->value(_t, _q_point[_qp]); 54 511648 : _effective_stiffness[_qp] *= std::sqrt(_prefactor_function->value(_t, _q_point[_qp])); 55 : } 56 183311682 : } 57 : 58 : template class ComputeElasticityTensorBaseTempl<false, RankFourTensor>; 59 : template class ComputeElasticityTensorBaseTempl<true, RankFourTensor>; 60 : template class ComputeElasticityTensorBaseTempl<false, SymmetricRankFourTensor>; 61 : template class ComputeElasticityTensorBaseTempl<true, SymmetricRankFourTensor>;