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 202 : ComputeLargeDeformationStress::validParams() 14 : { 15 202 : InputParameters params = Material::validParams(); 16 202 : params += BaseNameInterface::validParams(); 17 202 : params.addClassDescription("Stress calculator given an elasticity model, a plasticity model and " 18 : "a viscoelasticity model. Large deformation is assumed."); 19 : 20 404 : params.addRequiredParam<MaterialName>("elasticity_model", 21 : "Name of the elastic stress-strain constitutive model"); 22 404 : params.addParam<MaterialName>("plasticity_model", "Name of the plasticity model"); 23 404 : params.addParam<MaterialName>("viscoelasticity_model", "Name of the viscoelasticity model"); 24 : 25 202 : params.suppressParameter<bool>("use_displaced_mesh"); 26 202 : return params; 27 0 : } 28 : 29 48 : ComputeLargeDeformationStress::ComputeLargeDeformationStress(const InputParameters & parameters) 30 : : Material(parameters), 31 : BaseNameInterface(parameters), 32 96 : _Fm(getADMaterialProperty<RankTwoTensor>(prependBaseName("mechanical_deformation_gradient"))), 33 48 : _Fm_old(isParamValid("viscoelasticity_model") 34 48 : ? &getMaterialPropertyOld<RankTwoTensor>( 35 57 : prependBaseName("mechanical_deformation_gradient")) 36 : : nullptr), 37 96 : _stress(declareADProperty<RankTwoTensor>(prependBaseName("stress"))) 38 : { 39 96 : if (getParam<bool>("use_displaced_mesh")) 40 0 : mooseError("The stress calculator needs to run on the undisplaced mesh."); 41 48 : } 42 : 43 : void 44 48 : ComputeLargeDeformationStress::initialSetup() 45 : { 46 48 : _elasticity_model = 47 48 : dynamic_cast<LargeDeformationElasticityModel *>(&getMaterial("elasticity_model")); 48 48 : if (!_elasticity_model) 49 0 : paramError("elasticity_model", 50 0 : "Elasticity model " + getParam<MaterialName>("elasticity_model") + 51 : " is not compatible with ComputeLargeDeformationStress"); 52 : 53 48 : _plasticity_model = 54 48 : isParamValid("plasticity_model") 55 87 : ? dynamic_cast<LargeDeformationPlasticityModel *>(&getMaterial("plasticity_model")) 56 : : nullptr; 57 48 : if (_plasticity_model) 58 39 : _elasticity_model->setPlasticityModel(_plasticity_model); 59 : 60 48 : _viscoelasticity_model = isParamValid("viscoelasticity_model") 61 51 : ? dynamic_cast<LargeDeformationViscoelasticityModel *>( 62 54 : &getMaterial("viscoelasticity_model")) 63 : : nullptr; 64 48 : } 65 : 66 : void 67 0 : ComputeLargeDeformationStress::initQpStatefulProperties() 68 : { 69 0 : _stress[_qp].zero(); 70 0 : } 71 : 72 : void 73 287136 : ComputeLargeDeformationStress::computeQpProperties() 74 : { 75 287136 : _elasticity_model->setQp(_qp); 76 287136 : _elasticity_model->updateState(_Fm[_qp], _stress[_qp]); 77 : 78 287136 : if (_viscoelasticity_model) 79 : { 80 62224 : _viscoelasticity_model->setQp(_qp); 81 62224 : _stress[_qp] += _viscoelasticity_model->computeCauchyStress(_Fm[_qp], (*_Fm_old)[_qp]); 82 : } 83 287136 : }