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 "LargeDeformationJ2Plasticity.h" 6 : #include "RaccoonUtils.h" 7 : 8 : registerMooseObject("raccoonApp", LargeDeformationJ2Plasticity); 9 : 10 : InputParameters 11 324 : LargeDeformationJ2Plasticity::validParams() 12 : { 13 324 : InputParameters params = LargeDeformationPlasticityModel::validParams(); 14 324 : params.addClassDescription("Large deformation $J_2$ plasticity. The exponential constitutive " 15 : "update is used to update the plastic deformation."); 16 324 : return params; 17 0 : } 18 : 19 39 : LargeDeformationJ2Plasticity::LargeDeformationJ2Plasticity(const InputParameters & parameters) 20 39 : : LargeDeformationPlasticityModel(parameters) 21 : { 22 39 : _check_range = true; 23 39 : } 24 : 25 : void 26 234528 : LargeDeformationJ2Plasticity::updateState(ADRankTwoTensor & stress, ADRankTwoTensor & Fe) 27 : { 28 : using std::sqrt; 29 : // First assume no plastic increment 30 234528 : ADReal delta_ep = 0; 31 234528 : Fe = Fe * _Fp_old[_qp].inverse(); 32 234528 : stress = _elasticity_model->computeMandelStress(Fe); 33 : 34 : // Compute the flow direction following the Prandtl-Reuss flow rule. 35 : // We guard against zero denominator. 36 234528 : ADRankTwoTensor stress_dev = stress.deviatoric(); 37 234528 : ADReal stress_dev_norm = stress_dev.doubleContraction(stress_dev); 38 234528 : if (MooseUtils::absoluteFuzzyEqual(stress_dev_norm, 0)) 39 32840 : stress_dev_norm.value() = libMesh::TOLERANCE * libMesh::TOLERANCE; 40 469056 : stress_dev_norm = sqrt(1.5 * stress_dev_norm); 41 469056 : _Np[_qp] = 1.5 * stress_dev / stress_dev_norm; 42 : // Return mapping 43 234528 : ADReal phi = computeResidual(stress_dev_norm, delta_ep); 44 234528 : if (phi > 0) 45 97426 : returnMappingSolve(stress_dev_norm, delta_ep, _console); 46 : 47 469056 : _ep[_qp] = _ep_old[_qp] + delta_ep; 48 : 49 : // Avoiding /0 issues for rate dependent models 50 234528 : _ep[_qp] = (_ep[_qp] == 0) ? 1e-20 : _ep[_qp]; 51 : 52 469056 : ADRankTwoTensor delta_Fp = RaccoonUtils::exp(delta_ep * _Np[_qp]); 53 234528 : _Fp[_qp] = delta_Fp * _Fp_old[_qp]; 54 : 55 : // Update stress and energy 56 234528 : Fe = Fe * delta_Fp.inverse(); 57 234528 : stress = _elasticity_model->computeCauchyStress(Fe); 58 : 59 234528 : _hardening_model->plasticEnergy(_ep[_qp]); 60 234528 : _hardening_model->plasticDissipation(delta_ep, _ep[_qp], 0); 61 : 62 : // Avoiding NaN issues for rate depedent models 63 234528 : if (_t_step > 0) 64 : { 65 452720 : _heat[_qp] = _hardening_model->plasticDissipation(delta_ep, _ep[_qp], 1) * delta_ep / _dt; 66 : 67 452720 : _heat[_qp] += _hardening_model->thermalConjugate(_ep[_qp]) * delta_ep / _dt; 68 : } 69 : else 70 8168 : _heat[_qp] = 0; 71 234528 : } 72 : 73 : Real 74 298388 : LargeDeformationJ2Plasticity::computeReferenceResidual(const ADReal & effective_trial_stress, 75 : const ADReal & delta_ep) 76 : { 77 596776 : return raw_value(effective_trial_stress - _elasticity_model 78 596776 : ->computeMandelStress(delta_ep * _Np[_qp], 79 : /*plasticity_update = */ true) 80 596776 : .doubleContraction(_Np[_qp])); 81 : } 82 : 83 : ADReal 84 525548 : LargeDeformationJ2Plasticity::computeResidual(const ADReal & effective_trial_stress, 85 : const ADReal & delta_ep) 86 : { 87 525548 : ADReal ep = _ep_old[_qp] + delta_ep; 88 : 89 : // Avoiding /0 errors for rate depedent models 90 525548 : ep = (ep == 0) ? 1e-20 : ep; 91 : 92 525548 : return effective_trial_stress - 93 525548 : _elasticity_model 94 1051096 : ->computeMandelStress(delta_ep * _Np[_qp], 95 : /*plasticity_update = */ true) 96 525548 : .doubleContraction(_Np[_qp]) - 97 525548 : _hardening_model->plasticEnergy(ep, 1) - 98 1051096 : _hardening_model->plasticDissipation(delta_ep, ep, 1); 99 : } 100 : 101 : ADReal 102 292788 : LargeDeformationJ2Plasticity::computeDerivative(const ADReal & /*effective_trial_stress*/, 103 : const ADReal & delta_ep) 104 : { 105 292788 : ADReal ep = _ep_old[_qp] + delta_ep; 106 292788 : if (ep == 0) 107 : { 108 970 : ep = 1e-20; 109 : } 110 585576 : return -_elasticity_model->computeMandelStress(_Np[_qp], /*plasticity_update = */ true) 111 292788 : .doubleContraction(_Np[_qp]) - 112 292788 : _hardening_model->plasticEnergy(ep, 2) - 113 585576 : _hardening_model->plasticDissipation(delta_ep, ep, 2); 114 : }