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 "ADComputeVolumetricEigenstrain.h" 11 : #include "RankTwoTensor.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", ADComputeVolumetricEigenstrain); 14 : 15 : InputParameters 16 24 : ADComputeVolumetricEigenstrain::validParams() 17 : { 18 24 : InputParameters params = ADComputeEigenstrainBase::validParams(); 19 24 : params.addClassDescription("Computes an eigenstrain that is defined by a set of scalar material " 20 : "properties that summed together define the volumetric change."); 21 48 : params.addRequiredParam<std::vector<MaterialPropertyName>>( 22 : "volumetric_materials", "List of scalar material properties defining the volumetric change"); 23 24 : return params; 24 0 : } 25 : 26 18 : ADComputeVolumetricEigenstrain::ADComputeVolumetricEigenstrain(const InputParameters & parameters) 27 : : ADComputeEigenstrainBase(parameters), 28 18 : _volumetric_materials( 29 18 : getParam<std::vector<MaterialPropertyName>>("volumetric_materials").size()) 30 : { 31 : const auto volumetric_material_names = 32 36 : getParam<std::vector<MaterialPropertyName>>("volumetric_materials"); 33 36 : for (unsigned int i = 0; i < volumetric_material_names.size(); ++i) 34 18 : _volumetric_materials[i] = &getADMaterialProperty<Real>(volumetric_material_names[i]); 35 18 : } 36 : 37 : void 38 2592 : ADComputeVolumetricEigenstrain::computeQpEigenstrain() 39 : { 40 2592 : ADReal volumetric_strain = 0.0; 41 5184 : for (unsigned int i = 0; i < _volumetric_materials.size(); ++i) 42 2592 : volumetric_strain += (*_volumetric_materials[i])[_qp]; 43 : 44 2592 : const auto eigenstrain_comp = computeVolumetricStrainComponent(volumetric_strain); 45 2592 : _eigenstrain[_qp].zero(); 46 2592 : _eigenstrain[_qp].addIa(eigenstrain_comp); 47 2592 : }