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 "SumTensorIncrements.h" 11 : #include "libmesh/quadrature.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", SumTensorIncrements); 14 : 15 : InputParameters 16 0 : SumTensorIncrements::validParams() 17 : { 18 0 : InputParameters params = Material::validParams(); 19 0 : params.addClassDescription("Compute tensor property by summing tensor increments"); 20 0 : params.addRequiredParam<MaterialPropertyName>("tensor_name", "Name of strain property"); 21 0 : params.addParam<std::vector<MaterialPropertyName>>("coupled_tensor_increment_names", 22 : "Name of strain increment properties"); 23 0 : return params; 24 0 : } 25 : 26 0 : SumTensorIncrements::SumTensorIncrements(const InputParameters & parameters) 27 : : DerivativeMaterialInterface<Material>(parameters), 28 0 : _property_names(getParam<std::vector<MaterialPropertyName>>("coupled_tensor_increment_names")), 29 0 : _tensor(declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("tensor_name"))), 30 0 : _tensor_old( 31 0 : getMaterialPropertyOld<RankTwoTensor>(getParam<MaterialPropertyName>("tensor_name"))), 32 0 : _tensor_increment(declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("tensor_name") + 33 0 : "_increment")) 34 : { 35 0 : _num_property = _property_names.size(); 36 : 37 0 : if (_num_property > 0) 38 : { 39 0 : _coupled_tensor_increments.resize(_num_property); 40 : 41 0 : for (unsigned int i = 0; i < _num_property; ++i) 42 0 : _coupled_tensor_increments[i] = &getMaterialProperty<RankTwoTensor>(_property_names[i]); 43 : } 44 0 : } 45 : 46 : void 47 0 : SumTensorIncrements::initQpStatefulProperties() 48 : { 49 0 : _tensor[_qp].zero(); 50 0 : _tensor_increment[_qp].zero(); 51 0 : } 52 : 53 : void 54 0 : SumTensorIncrements::computeQpProperties() 55 : { 56 0 : _tensor_increment[_qp].zero(); 57 : 58 0 : for (unsigned int i = 0; i < _num_property; ++i) 59 0 : _tensor_increment[_qp] += (*_coupled_tensor_increments[i])[_qp]; 60 : 61 0 : _tensor[_qp] = _tensor_old[_qp] + _tensor_increment[_qp]; 62 0 : }