Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "CrystalPlasticityKalidindiUpdate.h" 11 : #include "libmesh/int_range.h" 12 : 13 : registerMooseObject("TensorMechanicsApp", CrystalPlasticityKalidindiUpdate); 14 : 15 : InputParameters 16 321 : CrystalPlasticityKalidindiUpdate::validParams() 17 : { 18 321 : InputParameters params = CrystalPlasticityStressUpdateBase::validParams(); 19 321 : params.addClassDescription("Kalidindi version of homogeneous crystal plasticity."); 20 642 : params.addParam<Real>("r", 1.0, "Latent hardening coefficient"); 21 642 : params.addParam<Real>("h", 541.5, "hardening constants"); 22 642 : params.addParam<Real>("t_sat", 109.8, "saturated slip system strength"); 23 642 : params.addParam<Real>("gss_a", 2.5, "coefficient for hardening"); 24 642 : params.addParam<Real>("ao", 0.001, "slip rate coefficient"); 25 642 : params.addParam<Real>("xm", 0.1, "exponent for slip rate"); 26 642 : params.addParam<Real>("gss_initial", 60.8, "initial lattice friction strength of the material"); 27 : 28 642 : params.addParam<MaterialPropertyName>( 29 : "total_twin_volume_fraction", 30 : "Total twin volume fraction, if twinning is considered in the simulation"); 31 : 32 321 : return params; 33 0 : } 34 : 35 240 : CrystalPlasticityKalidindiUpdate::CrystalPlasticityKalidindiUpdate( 36 240 : const InputParameters & parameters) 37 : : CrystalPlasticityStressUpdateBase(parameters), 38 : // Constitutive values 39 240 : _r(getParam<Real>("r")), 40 480 : _h(getParam<Real>("h")), 41 480 : _tau_sat(getParam<Real>("t_sat")), 42 480 : _gss_a(getParam<Real>("gss_a")), 43 480 : _ao(getParam<Real>("ao")), 44 480 : _xm(getParam<Real>("xm")), 45 480 : _gss_initial(getParam<Real>("gss_initial")), 46 : 47 : // resize vectors used in the consititutive slip hardening 48 240 : _hb(_number_slip_systems, 0.0), 49 240 : _slip_resistance_increment(_number_slip_systems, 0.0), 50 : 51 : // resize local caching vectors used for substepping 52 240 : _previous_substep_slip_resistance(_number_slip_systems, 0.0), 53 240 : _slip_resistance_before_update(_number_slip_systems, 0.0), 54 : 55 : // Twinning contributions, if used 56 240 : _include_twinning_in_Lp(parameters.isParamValid("total_twin_volume_fraction")), 57 480 : _twin_volume_fraction_total(_include_twinning_in_Lp 58 276 : ? &getMaterialPropertyOld<Real>("total_twin_volume_fraction") 59 240 : : nullptr) 60 : { 61 240 : } 62 : 63 : void 64 14080 : CrystalPlasticityKalidindiUpdate::initQpStatefulProperties() 65 : { 66 14080 : CrystalPlasticityStressUpdateBase::initQpStatefulProperties(); 67 : 68 183040 : for (const auto i : make_range(_number_slip_systems)) 69 : { 70 168960 : _slip_resistance[_qp][i] = _gss_initial; 71 168960 : _slip_increment[_qp][i] = 0.0; 72 : } 73 14080 : } 74 : 75 : void 76 583315 : CrystalPlasticityKalidindiUpdate::setInitialConstitutiveVariableValues() 77 : { 78 : // Would also set old dislocation densities here if included in this model 79 583315 : _slip_resistance[_qp] = _slip_resistance_old[_qp]; 80 583315 : _previous_substep_slip_resistance = _slip_resistance_old[_qp]; 81 583315 : } 82 : 83 : void 84 601113 : CrystalPlasticityKalidindiUpdate::setSubstepConstitutiveVariableValues() 85 : { 86 : // Would also set substepped dislocation densities here if included in this model 87 601113 : _slip_resistance[_qp] = _previous_substep_slip_resistance; 88 601113 : } 89 : 90 : bool 91 2502894 : CrystalPlasticityKalidindiUpdate::calculateSlipRate() 92 : { 93 32370738 : for (const auto i : make_range(_number_slip_systems)) 94 : { 95 29882019 : _slip_increment[_qp][i] = 96 29882019 : _ao * std::pow(std::abs(_tau[_qp][i] / _slip_resistance[_qp][i]), 1.0 / _xm); 97 29882019 : if (_tau[_qp][i] < 0.0) 98 12221091 : _slip_increment[_qp][i] *= -1.0; 99 : 100 29882019 : if (std::abs(_slip_increment[_qp][i]) * _substep_dt > _slip_incr_tol) 101 : { 102 14175 : if (_print_convergence_message) 103 0 : mooseWarning("Maximum allowable slip increment exceeded ", 104 0 : std::abs(_slip_increment[_qp][i]) * _substep_dt); 105 : 106 : return false; 107 : } 108 : } 109 : return true; 110 : } 111 : 112 : void 113 2488719 : CrystalPlasticityKalidindiUpdate::calculateEquivalentSlipIncrement( 114 : RankTwoTensor & equivalent_slip_increment) 115 : { 116 2488719 : if (_include_twinning_in_Lp) 117 : { 118 5238376 : for (const auto i : make_range(_number_slip_systems)) 119 4835424 : equivalent_slip_increment += (1.0 - (*_twin_volume_fraction_total)[_qp]) * 120 4835424 : _flow_direction[_qp][i] * _slip_increment[_qp][i] * _substep_dt; 121 : } 122 : else // if no twinning volume fraction material property supplied, use base class 123 2085767 : CrystalPlasticityStressUpdateBase::calculateEquivalentSlipIncrement(equivalent_slip_increment); 124 2488719 : } 125 : 126 : void 127 2462799 : CrystalPlasticityKalidindiUpdate::calculateConstitutiveSlipDerivative( 128 : std::vector<Real> & dslip_dtau) 129 : { 130 32016387 : for (const auto i : make_range(_number_slip_systems)) 131 : { 132 29553588 : if (MooseUtils::absoluteFuzzyEqual(_tau[_qp][i], 0.0)) 133 1916193 : dslip_dtau[i] = 0.0; 134 : else 135 27637395 : dslip_dtau[i] = _ao / _xm * 136 27637395 : std::pow(std::abs(_tau[_qp][i] / _slip_resistance[_qp][i]), 1.0 / _xm - 1.0) / 137 : _slip_resistance[_qp][i]; 138 : } 139 2462799 : } 140 : 141 : bool 142 590346 : CrystalPlasticityKalidindiUpdate::areConstitutiveStateVariablesConverged() 143 : { 144 590346 : return isConstitutiveStateVariableConverged(_slip_resistance[_qp], 145 590346 : _slip_resistance_before_update, 146 590346 : _previous_substep_slip_resistance, 147 590346 : _resistance_tol); 148 : } 149 : 150 : void 151 586938 : CrystalPlasticityKalidindiUpdate::updateSubstepConstitutiveVariableValues() 152 : { 153 : // Would also set substepped dislocation densities here if included in this model 154 586938 : _previous_substep_slip_resistance = _slip_resistance[_qp]; 155 586938 : } 156 : 157 : void 158 644424 : CrystalPlasticityKalidindiUpdate::cacheStateVariablesBeforeUpdate() 159 : { 160 644424 : _slip_resistance_before_update = _slip_resistance[_qp]; 161 644424 : } 162 : 163 : void 164 644424 : CrystalPlasticityKalidindiUpdate::calculateStateVariableEvolutionRateComponent() 165 : { 166 8377512 : for (const auto i : make_range(_number_slip_systems)) 167 : { 168 : // Clear out increment from the previous iteration 169 7733088 : _slip_resistance_increment[i] = 0.0; 170 : 171 7733088 : _hb[i] = _h * std::pow(std::abs(1.0 - _slip_resistance[_qp][i] / _tau_sat), _gss_a); 172 7733088 : const Real hsign = 1.0 - _slip_resistance[_qp][i] / _tau_sat; 173 7733088 : if (hsign < 0.0) 174 0 : _hb[i] *= -1.0; 175 : } 176 : 177 8377512 : for (const auto i : make_range(_number_slip_systems)) 178 : { 179 100530144 : for (const auto j : make_range(_number_slip_systems)) 180 : { 181 : unsigned int iplane, jplane; 182 92797056 : iplane = i / 3; 183 92797056 : jplane = j / 3; 184 : 185 92797056 : if (iplane == jplane) // self vs. latent hardening 186 23199264 : _slip_resistance_increment[i] += 187 23199264 : std::abs(_slip_increment[_qp][j]) * _hb[j]; // q_{ab} = 1.0 for self hardening 188 : else 189 69597792 : _slip_resistance_increment[i] += 190 69597792 : std::abs(_slip_increment[_qp][j]) * _r * _hb[j]; // latent hardenign 191 : } 192 : } 193 644424 : } 194 : 195 : bool 196 644424 : CrystalPlasticityKalidindiUpdate::updateStateVariables() 197 : { 198 : // Now perform the check to see if the slip system should be updated 199 8377512 : for (const auto i : make_range(_number_slip_systems)) 200 : { 201 7733088 : _slip_resistance_increment[i] *= _substep_dt; 202 7733088 : if (_previous_substep_slip_resistance[i] < _zero_tol && _slip_resistance_increment[i] < 0.0) 203 0 : _slip_resistance[_qp][i] = _previous_substep_slip_resistance[i]; 204 : else 205 7733088 : _slip_resistance[_qp][i] = 206 7733088 : _previous_substep_slip_resistance[i] + _slip_resistance_increment[i]; 207 : 208 7733088 : if (_slip_resistance[_qp][i] < 0.0) 209 : return false; 210 : } 211 : return true; 212 : }