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 "Compute2DIncrementalStrain.h" 11 : 12 : #include "libmesh/quadrature.h" 13 : 14 : InputParameters 15 528 : Compute2DIncrementalStrain::validParams() 16 : { 17 528 : InputParameters params = ComputeIncrementalStrain::validParams(); 18 528 : params.addClassDescription("Compute strain increment for incremental strains in 2D geometries."); 19 : 20 1056 : MooseEnum outOfPlaneDirection("x y z", "z"); 21 1056 : params.addParam<MooseEnum>( 22 : "out_of_plane_direction", outOfPlaneDirection, "The direction of the out-of-plane strain."); 23 528 : return params; 24 528 : } 25 : 26 396 : Compute2DIncrementalStrain::Compute2DIncrementalStrain(const InputParameters & parameters) 27 : : ComputeIncrementalStrain(parameters), 28 792 : _out_of_plane_direction(getParam<MooseEnum>("out_of_plane_direction")) 29 : { 30 396 : } 31 : 32 : void 33 252 : Compute2DIncrementalStrain::initialSetup() 34 : { 35 1008 : for (unsigned int i = 0; i < 3; ++i) 36 : { 37 756 : if (_out_of_plane_direction == i) 38 : { 39 252 : _disp[i] = &_zero; 40 252 : _grad_disp[i] = &_grad_zero; 41 : } 42 : else 43 : { 44 504 : _disp[i] = &coupledValue("displacements", i); 45 504 : _grad_disp[i] = &coupledGradient("displacements", i); 46 : } 47 : 48 756 : if (_fe_problem.isTransient() && i != _out_of_plane_direction) 49 504 : _grad_disp_old[i] = &coupledGradientOld("displacements", i); 50 : else 51 252 : _grad_disp_old[i] = &_grad_zero; 52 : } 53 252 : } 54 : 55 : void 56 242512 : Compute2DIncrementalStrain::computeTotalStrainIncrement(RankTwoTensor & total_strain_increment) 57 : { 58 : // Deformation gradient calculation for 2D problems 59 : auto A = RankTwoTensor::initializeFromRows( 60 242512 : (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]); 61 : 62 : // Old Deformation gradient 63 : auto Fbar = RankTwoTensor::initializeFromRows( 64 242512 : (*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]); 65 : 66 : // Compute the displacement gradient of the out of plane direction for plane strain, 67 : // generalized plane strain, or axisymmetric problems 68 242512 : A(_out_of_plane_direction, _out_of_plane_direction) = computeOutOfPlaneGradDisp(); 69 242512 : Fbar(_out_of_plane_direction, _out_of_plane_direction) = computeOutOfPlaneGradDispOld(); 70 : 71 242512 : _deformation_gradient[_qp] = A; 72 242512 : _deformation_gradient[_qp].addIa(1.0); 73 : 74 242512 : A -= Fbar; // very nearly A = gradU - gradUold 75 : 76 242512 : total_strain_increment = 0.5 * (A + A.transpose()); 77 242512 : } 78 : 79 : void 80 144 : Compute2DIncrementalStrain::displacementIntegrityCheck() 81 : { 82 144 : if (_out_of_plane_direction != 2 && _ndisp != 3) 83 0 : mooseError("For 2D simulations where the out-of-plane direction is x or y the number of " 84 : "supplied displacements must be three."); 85 144 : else if (_out_of_plane_direction == 2 && _ndisp != 2) 86 0 : mooseError("For 2D simulations where the out-of-plane direction is z the number of supplied " 87 : "displacements must be two."); 88 144 : }