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 "ADComputePlaneFiniteStrain.h" 11 : #include "UserObject.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", ADComputePlaneFiniteStrain); 14 : 15 : InputParameters 16 32 : ADComputePlaneFiniteStrain::validParams() 17 : { 18 32 : InputParameters params = ADCompute2DFiniteStrain::validParams(); 19 32 : params.addClassDescription("Compute strain increment and rotation increment for finite strain " 20 : "under 2D planar assumptions."); 21 64 : params.addParam<UserObjectName>("subblock_index_provider", 22 : "SubblockIndexProvider user object name"); 23 64 : params.addCoupledVar("scalar_out_of_plane_strain", 24 : "Scalar variable for generalized plane strain"); 25 64 : params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for plane stress condition"); 26 : 27 32 : return params; 28 0 : } 29 : 30 24 : ADComputePlaneFiniteStrain::ADComputePlaneFiniteStrain(const InputParameters & parameters) 31 : : ADCompute2DFiniteStrain(parameters), 32 72 : _subblock_id_provider(isParamValid("subblock_index_provider") 33 24 : ? &getUserObject<SubblockIndexProvider>("subblock_index_provider") 34 : : nullptr), 35 24 : _scalar_out_of_plane_strain_coupled(isCoupledScalar("scalar_out_of_plane_strain")), 36 24 : _out_of_plane_strain_coupled(isCoupled("out_of_plane_strain")), 37 24 : _out_of_plane_strain(_out_of_plane_strain_coupled ? adCoupledValue("out_of_plane_strain") 38 : : _ad_zero), 39 24 : _out_of_plane_strain_old(_out_of_plane_strain_coupled ? coupledValueOld("out_of_plane_strain") 40 24 : : _zero) 41 : { 42 24 : if (_out_of_plane_strain_coupled && _scalar_out_of_plane_strain_coupled) 43 0 : mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain"); 44 : 45 24 : if (_scalar_out_of_plane_strain_coupled) 46 : { 47 0 : const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain"); 48 0 : _scalar_out_of_plane_strain.resize(nscalar_strains); 49 0 : _scalar_out_of_plane_strain_old.resize(nscalar_strains); 50 0 : for (unsigned int i = 0; i < nscalar_strains; ++i) 51 : { 52 0 : _scalar_out_of_plane_strain[i] = &adCoupledScalarValue("scalar_out_of_plane_strain", i); 53 0 : _scalar_out_of_plane_strain_old[i] = &coupledScalarValueOld("scalar_out_of_plane_strain", i); 54 : } 55 : } 56 24 : } 57 : 58 : ADReal 59 2352 : ADComputePlaneFiniteStrain::computeOutOfPlaneGradDisp() 60 : { 61 : using std::exp; 62 : /** 63 : * This is consistent with the approximation of stretch rate tensor 64 : * D = log(sqrt(Fhat^T * Fhat)) / dt 65 : */ 66 2352 : if (_scalar_out_of_plane_strain_coupled) 67 0 : return exp((*_scalar_out_of_plane_strain[getCurrentSubblockIndex()])[0]) - 1.0; 68 : else 69 4704 : return exp(_out_of_plane_strain[_qp]) - 1.0; 70 : } 71 : 72 : Real 73 2352 : ADComputePlaneFiniteStrain::computeOutOfPlaneGradDispOld() 74 : { 75 : using std::exp; 76 2352 : if (_scalar_out_of_plane_strain_coupled) 77 0 : return exp((*_scalar_out_of_plane_strain_old[getCurrentSubblockIndex()])[0]) - 1.0; 78 : else 79 2352 : return exp(_out_of_plane_strain_old[_qp]) - 1.0; 80 : }