Line data Source code
1 : //* This file is part of the RACCOON application 2 : //* being developed at Dolbow lab at Duke University 3 : //* http://dolbow.pratt.duke.edu 4 : 5 : #include "ComputeLargeDeformationStress.h" 6 : #include "LargeDeformationElasticityModel.h" 7 : #include "LargeDeformationPlasticityModel.h" 8 : #include "LargeDeformationViscoelasticityModel.h" 9 : 10 : registerMooseObject("raccoonApp", ComputeLargeDeformationStress); 11 : 12 : InputParameters 13 212 : ComputeLargeDeformationStress::validParams() 14 : { 15 212 : InputParameters params = Material::validParams(); 16 212 : params += BaseNameInterface::validParams(); 17 212 : params.addClassDescription("Stress calculator given an elasticity model, a plasticity model and " 18 : "a viscoelasticity model. Large deformation is assumed."); 19 : 20 424 : params.addRequiredParam<MaterialName>("elasticity_model", 21 : "Name of the elastic stress-strain constitutive model"); 22 424 : params.addParam<MaterialName>("plasticity_model", "Name of the plasticity model"); 23 424 : params.addParam<MaterialName>("viscoelasticity_model", "Name of the viscoelasticity model"); 24 : 25 212 : params.suppressParameter<bool>("use_displaced_mesh"); 26 212 : return params; 27 0 : } 28 : 29 57 : ComputeLargeDeformationStress::ComputeLargeDeformationStress(const InputParameters & parameters) 30 : : Material(parameters), 31 : BaseNameInterface(parameters), 32 114 : _Fm(getADMaterialProperty<RankTwoTensor>(prependBaseName("mechanical_deformation_gradient"))), 33 114 : _Fm_old(isParamValid("viscoelasticity_model") 34 57 : ? &getMaterialPropertyOld<RankTwoTensor>( 35 63 : prependBaseName("mechanical_deformation_gradient")) 36 : : nullptr), 37 114 : _stress(declareADProperty<RankTwoTensor>(prependBaseName("stress"))) 38 : { 39 114 : if (getParam<bool>("use_displaced_mesh")) 40 0 : mooseError("The stress calculator needs to run on the undisplaced mesh."); 41 57 : } 42 : 43 : void 44 57 : ComputeLargeDeformationStress::initialSetup() 45 : { 46 57 : _elasticity_model = 47 57 : dynamic_cast<LargeDeformationElasticityModel *>(&getMaterial("elasticity_model")); 48 57 : if (!_elasticity_model) 49 0 : paramError("elasticity_model", 50 0 : "Elasticity model " + getParam<MaterialName>("elasticity_model") + 51 : " is not compatible with ComputeLargeDeformationStress"); 52 : 53 57 : _plasticity_model = 54 57 : isParamValid("plasticity_model") 55 114 : ? dynamic_cast<LargeDeformationPlasticityModel *>(&getMaterial("plasticity_model")) 56 : : nullptr; 57 57 : if (_plasticity_model) 58 48 : _elasticity_model->setPlasticityModel(_plasticity_model); 59 : 60 114 : _viscoelasticity_model = isParamValid("viscoelasticity_model") 61 60 : ? dynamic_cast<LargeDeformationViscoelasticityModel *>( 62 60 : &getMaterial("viscoelasticity_model")) 63 : : nullptr; 64 57 : } 65 : 66 : void 67 0 : ComputeLargeDeformationStress::initQpStatefulProperties() 68 : { 69 0 : _stress[_qp].zero(); 70 0 : } 71 : 72 : void 73 263568 : ComputeLargeDeformationStress::computeQpProperties() 74 : { 75 263568 : _elasticity_model->setQp(_qp); 76 263568 : _elasticity_model->updateState(_Fm[_qp], _stress[_qp]); 77 : 78 263568 : if (_viscoelasticity_model) 79 : { 80 57920 : _viscoelasticity_model->setQp(_qp); 81 57920 : _stress[_qp] += _viscoelasticity_model->computeCauchyStress(_Fm[_qp], (*_Fm_old)[_qp]); 82 : } 83 263568 : }