Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "ADComputeSmallStrain.h" 11 : #include "RankTwoTensor.h" 12 : #include "SymmetricRankTwoTensor.h" 13 : #include "libmesh/quadrature.h" 14 : 15 : registerMooseObject("TensorMechanicsApp", ADComputeSmallStrain); 16 : registerMooseObject("TensorMechanicsApp", ADSymmetricSmallStrain); 17 : 18 : template <typename R2> 19 : InputParameters 20 756 : ADComputeSmallStrainTempl<R2>::validParams() 21 : { 22 756 : InputParameters params = ADComputeStrainBase::validParams(); 23 756 : params.addClassDescription("Compute a small strain."); 24 756 : return params; 25 0 : } 26 : 27 : template <typename R2> 28 567 : ADComputeSmallStrainTempl<R2>::ADComputeSmallStrainTempl(const InputParameters & parameters) 29 567 : : ADComputeStrainBaseTempl<R2>(parameters) 30 : { 31 567 : } 32 : 33 : template <typename R2> 34 : void 35 694172 : ADComputeSmallStrainTempl<R2>::computeProperties() 36 : { 37 694172 : ADReal volumetric_strain = 0.0; 38 : 39 4703388 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 40 : { 41 : // strain = (grad_disp + grad_disp^R2)/2 42 4009216 : _total_strain[_qp] = Moose::ADType<R2>::type::initializeSymmetric( 43 4009216 : (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]); 44 : 45 4009216 : if (_volumetric_locking_correction) 46 2432 : volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp]; 47 : } 48 : 49 694172 : if (_volumetric_locking_correction) 50 152 : volumetric_strain /= _current_elem_volume; 51 : 52 4703388 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 53 : { 54 4009216 : if (_volumetric_locking_correction) 55 : { 56 1216 : ADReal correction = (volumetric_strain - _total_strain[_qp].trace()) / 3.0; 57 1216 : _total_strain[_qp].addIa(correction); 58 : } 59 : 60 4009216 : if (_global_strain) 61 0 : _total_strain[_qp] += (*_global_strain)[_qp]; 62 : 63 4009216 : _mechanical_strain[_qp] = _total_strain[_qp]; 64 : 65 : // Remove the Eigen strain 66 6109680 : for (auto es : _eigenstrains) 67 2100464 : _mechanical_strain[_qp] -= (*es)[_qp]; 68 : } 69 694172 : } 70 : 71 : template class ADComputeSmallStrainTempl<RankTwoTensor>; 72 : template class ADComputeSmallStrainTempl<SymmetricRankTwoTensor>;