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 "ComputeStrainBase.h" 11 : #include "MooseMesh.h" 12 : #include "Assembly.h" 13 : 14 : InputParameters 15 26282 : ComputeStrainBase::validParams() 16 : { 17 26282 : InputParameters params = Material::validParams(); 18 52564 : params.addRequiredCoupledVar( 19 : "displacements", 20 : "The displacements appropriate for the simulation geometry and coordinate system"); 21 52564 : params.addParam<std::string>("base_name", 22 : "Optional parameter that allows the user to define " 23 : "multiple mechanics material systems on the same " 24 : "block, i.e. for multiple phases"); 25 52564 : params.addParam<bool>( 26 52564 : "volumetric_locking_correction", false, "Flag to correct volumetric locking"); 27 52564 : params.addParam<std::vector<MaterialPropertyName>>( 28 : "eigenstrain_names", {}, "List of eigenstrains to be applied in this strain calculation"); 29 52564 : params.addParam<MaterialPropertyName>("global_strain", 30 : "Optional material property holding a global strain " 31 : "tensor applied to the mesh as a whole"); 32 26282 : params.suppressParameter<bool>("use_displaced_mesh"); 33 26282 : return params; 34 0 : } 35 : 36 19698 : ComputeStrainBase::ComputeStrainBase(const InputParameters & parameters) 37 : : DerivativeMaterialInterface<Material>(parameters), 38 19698 : _ndisp(coupledComponents("displacements")), 39 19698 : _disp(coupledValues("displacements")), 40 19698 : _grad_disp(coupledGradients("displacements")), 41 40068 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 42 19698 : _mechanical_strain(declareProperty<RankTwoTensor>(_base_name + "mechanical_strain")), 43 19698 : _total_strain(declareProperty<RankTwoTensor>(_base_name + "total_strain")), 44 39396 : _eigenstrain_names(getParam<std::vector<MaterialPropertyName>>("eigenstrain_names")), 45 19698 : _eigenstrains(_eigenstrain_names.size()), 46 19698 : _global_strain(isParamValid("global_strain") 47 20034 : ? &getMaterialProperty<RankTwoTensor>(_base_name + "global_strain") 48 : : nullptr), 49 58276 : _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction") && 50 : !isBoundaryMaterial()), 51 39396 : _current_elem_volume(_assembly.elemVolume()) 52 : { 53 23379 : for (unsigned int i = 0; i < _eigenstrains.size(); ++i) 54 : { 55 3681 : _eigenstrain_names[i] = _base_name + _eigenstrain_names[i]; 56 3681 : _eigenstrains[i] = &getMaterialProperty<RankTwoTensor>(_eigenstrain_names[i]); 57 : } 58 : 59 : // set unused dimensions to zero 60 19698 : _disp.resize(3, &_zero); 61 19698 : _grad_disp.resize(3, &_grad_zero); 62 : 63 19698 : if (_ndisp == 1 && _volumetric_locking_correction) 64 0 : paramError("volumetric_locking_correction", "has to be set to false for 1-D problems."); 65 : 66 39396 : if (getParam<bool>("use_displaced_mesh")) 67 0 : paramError("use_displaced_mesh", "The strain calculator needs to run on the undisplaced mesh."); 68 : 69 : // Generate warning when volumetric locking correction is used with second order elements 70 19698 : if (_mesh.hasSecondOrderElements() && _volumetric_locking_correction) 71 0 : mooseWarning("Volumetric locking correction is not required for second order elements. Using " 72 : "volumetric locking with second order elements could cause zigzag patterns in " 73 : "stresses and strains."); 74 19698 : } 75 : 76 : void 77 16716 : ComputeStrainBase::initialSetup() 78 : { 79 16716 : displacementIntegrityCheck(); 80 16716 : } 81 : 82 : void 83 16557 : ComputeStrainBase::displacementIntegrityCheck() 84 : { 85 : // Checking for consistency between mesh size and length of the provided displacements vector 86 16557 : if (_ndisp != _mesh.dimension()) 87 0 : paramError( 88 : "displacements", 89 : "The number of variables supplied in 'displacements' must match the mesh dimension."); 90 16557 : } 91 : 92 : void 93 320 : ComputeStrainBase::initQpStatefulProperties() 94 : { 95 320 : _mechanical_strain[_qp].zero(); 96 320 : _total_strain[_qp].zero(); 97 320 : }