LCOV - code coverage report
Current view: top level - src/materials/crystal_plasticity - CrystalPlasticityHCPDislocationSlipBeyerleinUpdate.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 299 307 97.4 %
Date: 2026-05-29 20:40:07 Functions: 21 21 100.0 %
Legend: Lines: hit not hit

          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 "CrystalPlasticityHCPDislocationSlipBeyerleinUpdate.h"
      11             : #include "libmesh/int_range.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", CrystalPlasticityHCPDislocationSlipBeyerleinUpdate);
      14             : 
      15             : InputParameters
      16         218 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::validParams()
      17             : {
      18         218 :   InputParameters params = CrystalPlasticityStressUpdateBase::validParams();
      19         218 :   params.addClassDescription("Two-term dislocation slip model for hexagonal close packed crystals "
      20             :                              "from Beyerline and Tome");
      21             : 
      22         436 :   params.set<MooseEnum>("crystal_lattice_type") = "HCP";
      23         218 :   params.suppressParameter<MooseEnum>("crystal_lattice_type");
      24             : 
      25         436 :   params.addCoupledVar("temperature", "The name of the temperature variable");
      26         436 :   params.addRequiredRangeCheckedParam<Real>(
      27             :       "initial_forest_dislocation_density",
      28             :       "initial_forest_dislocation_density>0",
      29             :       "The initial density of the forest dislocations, in 1/mm^2, assumed "
      30             :       "to be split evenly among all slip systems");
      31         436 :   params.addRequiredRangeCheckedParam<Real>(
      32             :       "initial_substructure_density",
      33             :       "initial_substructure_density>0",
      34             :       "The initial total density of the sessile dislocations, in 1/mm^2");
      35             : 
      36         436 :   params.addParam<unsigned int>(
      37             :       "slip_system_modes",
      38         436 :       1,
      39             :       "Number of different types of slip systems in this HCP crystal, e.g. for a material with "
      40             :       "basal<a>, prismatic<a>, and pyramidal<a> active slip systems, this number would be 3");
      41         218 :   params.addParam<std::vector<unsigned int>>(
      42             :       "number_slip_systems_per_mode",
      43         218 :       std::vector<unsigned int>(),
      44             :       "The number of slip systems per each slip system type. The sum of the entries of the vector "
      45             :       "given here must equal the value given for the total number of slip systems.");
      46         218 :   params.addParam<std::vector<Real>>(
      47             :       "lattice_friction_per_mode",
      48         218 :       std::vector<Real>(),
      49             :       "Value of the lattice friction for each type of the slip system, units of MPa. The order "
      50             :       "must be consistent with the number of slip systems per type vector.");
      51             : 
      52         218 :   params.addParam<std::vector<Real>>(
      53             :       "effective_shear_modulus_per_mode",
      54         218 :       std::vector<Real>(),
      55             :       "Effective isotropic shear modulus value, mu, in MPa. The order "
      56             :       "must be consistent with the number of slip systems per type vector.");
      57             : 
      58         218 :   params.addParam<std::vector<Real>>(
      59             :       "burgers_vector_per_mode",
      60         218 :       std::vector<Real>(),
      61             :       "Value of the Burgers vector, b,  for each type of the slip system, units of mm. The order "
      62             :       "must "
      63             :       "be consistent with the number of slip systems per type vector.");
      64         218 :   params.addParam<std::vector<Real>>(
      65             :       "slip_generation_coefficient_per_mode",
      66         218 :       std::vector<Real>(),
      67             :       "Slip dislocation generation coefficient value for each type of the slip system, k_1, units "
      68             :       "of 1/mm. The order "
      69             :       "must be consistent with the number of slip systems per type vector.");
      70         218 :   params.addParam<std::vector<Real>>(
      71             :       "normalized_slip_activiation_energy_per_mode",
      72         218 :       std::vector<Real>(),
      73             :       "Value of the slip dislocation attraction activation energy for each type of the slip "
      74             :       "system, g, dimensionless. The order must be consistent with the number of slip systems per "
      75             :       "type vector.");
      76         218 :   params.addParam<std::vector<Real>>(
      77             :       "slip_energy_proportionality_factor_per_mode",
      78         218 :       std::vector<Real>(),
      79             :       "Value of the the dislocation slip attraction energy proportionality factor for each type of "
      80             :       "the slip system, D, units of MPa. The order must be consistent with the number of slip "
      81             :       "systems "
      82             :       "per type vector.");
      83         218 :   params.addParam<std::vector<Real>>(
      84             :       "substructure_rate_coefficient_per_mode",
      85         218 :       std::vector<Real>(),
      86             :       "Material-independent rate constant that accounts for locking of slip dislocations in "
      87             :       "sessile substructure dislocation segments, q, dimensionless. This value is often determined "
      88             :       "through dislocation dynamics calculations. The order must be consistent with the number of "
      89             :       "slip systems per type vector.");
      90             : 
      91         436 :   params.addParam<Real>("gamma_o", 1.0e-3, "Reference strain rate on each slip system, in 1/s");
      92         436 :   params.addParam<Real>("strain_rate_sensitivity_exponent",
      93         436 :                         0.05,
      94             :                         "The strain rate sensitivity exponent for the power law relationship of "
      95             :                         "resolved shear stress");
      96         436 :   params.addParam<Real>("forest_interaction_parameter",
      97         436 :                         0.9,
      98             :                         "Forest dislocation interaction parameter, Chi, dimensionless.");
      99         436 :   params.addParam<Real>("Boltzman_constant", 1.38065e-20, "Boltzman constant, in MPa-mm^3/K");
     100         654 :   params.addRangeCheckedParam<Real>("applied_strain_rate",
     101         436 :                                     1.0e-4,
     102             :                                     "applied_strain_rate<=1.0e-3 & applied_strain_rate>=1.0e-5",
     103             :                                     "Value of the applied macroscopic strain rate and should "
     104             :                                     "correspond to the simulation loading conditions, in 1/s.");
     105         436 :   params.addParam<Real>("reference_macroscopic_strain_rate",
     106         436 :                         1.0e7,
     107             :                         "Value of the reference macroscopic strain rate for the thermal "
     108             :                         "dislocation attraction, in 1/s.");
     109         436 :   params.addParam<Real>("substructure_hardening_coefficient",
     110         436 :                         0.086,
     111             :                         "Value of the coefficient for the expanded Taylor hardening substructure "
     112             :                         "hardening relation, set to recover the Taylor hardening law for low "
     113             :                         "substructure densities, k_{sub}, dimensionless.");
     114         218 :   params.addParam<std::vector<Real>>(
     115             :       "Hall_Petch_like_constant_per_mode",
     116         218 :       std::vector<Real>(),
     117             :       "The microstructure Hall-Petch like coefficient value used to capture the influence of grain "
     118             :       "size on slip system resistance in the absence of twin dislocations, dimensionless");
     119         436 :   params.addRequiredRangeCheckedParam<Real>(
     120             :       "grain_size", "grain_size>0", "Value of the crystal grain size, in mm");
     121             : 
     122         436 :   params.addParam<MaterialPropertyName>(
     123             :       "total_twin_volume_fraction",
     124             :       "Total twin volume fraction, if twinning is considered in the simulation");
     125             : 
     126         218 :   return params;
     127           0 : }
     128             : 
     129         167 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::
     130         167 :     CrystalPlasticityHCPDislocationSlipBeyerleinUpdate(const InputParameters & parameters)
     131             :   : CrystalPlasticityStressUpdateBase(parameters),
     132             : 
     133         163 :     _temperature(coupledValue("temperature")),
     134         163 :     _forest_dislocation_density(
     135         163 :         declareProperty<std::vector<Real>>(_base_name + "forest_dislocation_density")),
     136         163 :     _forest_dislocation_density_old(
     137         163 :         getMaterialPropertyOld<std::vector<Real>>(_base_name + "forest_dislocation_density")),
     138         163 :     _forest_dislocation_increment(
     139         163 :         declareProperty<std::vector<Real>>(_base_name + "forest_dislocation_increment")),
     140         163 :     _forest_dislocations_removed_increment(
     141         163 :         declareProperty<std::vector<Real>>(_base_name + "_forest_dislocations_removed_increment")),
     142         326 :     _initial_forest_dislocation_density(getParam<Real>("initial_forest_dislocation_density")),
     143         163 :     _total_substructure_density(declareProperty<Real>(_base_name + "total_substructure_density")),
     144         163 :     _total_substructure_density_old(
     145         163 :         getMaterialPropertyOld<Real>(_base_name + "total_substructure_density")),
     146         163 :     _total_substructure_density_increment(
     147         163 :         declareProperty<Real>(_base_name + "total_substructure_increment")),
     148         326 :     _initial_substructure_density(getParam<Real>("initial_substructure_density")),
     149             : 
     150         326 :     _slip_system_modes(getParam<unsigned int>("slip_system_modes")),
     151         326 :     _number_slip_systems_per_mode(
     152             :         getParam<std::vector<unsigned int>>("number_slip_systems_per_mode")),
     153         326 :     _lattice_friction(getParam<std::vector<Real>>("lattice_friction_per_mode")),
     154             : 
     155         326 :     _reference_strain_rate(getParam<Real>("gamma_o")),
     156         326 :     _rate_sensitivity_exponent(getParam<Real>("strain_rate_sensitivity_exponent")),
     157             : 
     158         326 :     _burgers_vector(getParam<std::vector<Real>>("burgers_vector_per_mode")),
     159         326 :     _slip_generation_coefficient(
     160             :         getParam<std::vector<Real>>("slip_generation_coefficient_per_mode")),
     161         326 :     _slip_activation_energy(
     162             :         getParam<std::vector<Real>>("normalized_slip_activiation_energy_per_mode")),
     163         326 :     _proportionality_factor(
     164             :         getParam<std::vector<Real>>("slip_energy_proportionality_factor_per_mode")),
     165         326 :     _forest_interaction_coefficient(getParam<Real>("forest_interaction_parameter")),
     166         326 :     _boltzman_constant(getParam<Real>("Boltzman_constant")),
     167         326 :     _macro_applied_strain_rate(getParam<Real>("applied_strain_rate")),
     168         326 :     _macro_reference_strain_rate(getParam<Real>("reference_macroscopic_strain_rate")),
     169             : 
     170         326 :     _shear_modulus(getParam<std::vector<Real>>("effective_shear_modulus_per_mode")),
     171         326 :     _substructure_rate_coefficient(
     172             :         getParam<std::vector<Real>>("substructure_rate_coefficient_per_mode")),
     173         326 :     _substructure_hardening_coefficient(getParam<Real>("substructure_hardening_coefficient")),
     174         326 :     _hallpetch_like_coefficient(getParam<std::vector<Real>>("Hall_Petch_like_constant_per_mode")),
     175         326 :     _grain_size(getParam<Real>("grain_size")),
     176             : 
     177             :     // Twinning contributions, if used
     178         163 :     _include_twinning_in_Lp(parameters.isParamValid("total_twin_volume_fraction")),
     179         326 :     _twin_volume_fraction_total(_include_twinning_in_Lp
     180         184 :                                     ? &getMaterialPropertyOld<Real>("total_twin_volume_fraction")
     181         167 :                                     : nullptr)
     182             : {
     183             :   // resize local caching vectors used for substepping
     184         163 :   _previous_substep_slip_resistance.resize(_number_slip_systems);
     185         163 :   _previous_substep_forest_dislocations.resize(_number_slip_systems);
     186         163 :   _slip_resistance_before_update.resize(_number_slip_systems);
     187         163 :   _forest_dislocations_before_update.resize(_number_slip_systems);
     188             : 
     189             :   // check that the number of slip systems is equal to the sum of the types of slip system
     190         163 :   if (_number_slip_systems_per_mode.size() != _slip_system_modes)
     191           1 :     paramError("number_slip_systems_per_mode",
     192             :                "The size the number of slip systems per mode is not equal to the number of slip "
     193             :                "system types.");
     194             : 
     195             :   // Check that the number of slip mode dependent parameters is given matches the number of slip
     196             :   // modes
     197         162 :   if (_burgers_vector.size() != _slip_system_modes)
     198           1 :     paramError("burgers_vector_per_mode",
     199             :                "Please ensure that the size of burgers_vector_per_mode equals the value supplied "
     200             :                "for slip_system_modes");
     201             : 
     202         161 :   if (_slip_generation_coefficient.size() != _slip_system_modes)
     203           1 :     paramError("slip_generation_coefficient_per_mode",
     204             :                "Please ensure that the size of slip_generation_coefficient_per_mode equals the "
     205             :                "value supplied for slip_system_modes");
     206             : 
     207         160 :   if (_slip_activation_energy.size() != _slip_system_modes)
     208           1 :     paramError("normalized_slip_activiation_energy_per_mode",
     209             :                "Please ensure that the size of normalized_slip_activiation_energy_per_mode equals "
     210             :                "the value supplied for slip_system_modes");
     211             : 
     212         159 :   if (_proportionality_factor.size() != _slip_system_modes)
     213           1 :     paramError("slip_energy_proportionality_factor_per_mode",
     214             :                "Please ensure that the size of slip_energy_proportionality_factor_per_mode equals "
     215             :                "the value supplied for slip_system_modes");
     216             : 
     217         158 :   if (_shear_modulus.size() != _slip_system_modes)
     218           1 :     paramError("effective_shear_modulus_per_mode",
     219             :                "Please ensure that the size of effective_shear_modulus_per_mode equals the "
     220             :                "value supplied for slip_system_modes");
     221             : 
     222         157 :   if (_substructure_rate_coefficient.size() != _slip_system_modes)
     223           1 :     paramError("substructure_rate_coefficient_per_mode",
     224             :                "Please ensure that the size of substructure_rate_coefficient_per_mode equals the "
     225             :                "value supplied for slip_system_modes");
     226             : 
     227         156 :   if (_hallpetch_like_coefficient.size() != _slip_system_modes)
     228           1 :     paramError("Hall_Petch_like_constant_per_mode",
     229             :                "Please ensure that the size of Hall_Petch_like_constant_per_mode equals the value "
     230             :                "supplied for slip_system_modes");
     231             : 
     232         155 :   if (_lattice_friction.size() != _slip_system_modes)
     233           1 :     paramError("lattice_friction_per_mode",
     234             :                "Please ensure that the size of lattice_friction_per_mode equals the value supplied "
     235             :                "for slip_system_modes");
     236             : 
     237             :   unsigned int sum = 0;
     238         465 :   for (const auto i : make_range(_slip_system_modes))
     239         311 :     sum += _number_slip_systems_per_mode[i];
     240         154 :   if (sum != _number_slip_systems)
     241           1 :     paramError("slip_system_modes",
     242             :                "The number of slip systems and the sum of the slip systems in each of the slip "
     243             :                "system modes are not equal");
     244         153 : }
     245             : 
     246             : void
     247        7520 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::initQpStatefulProperties()
     248             : {
     249        7520 :   CrystalPlasticityStressUpdateBase::initQpStatefulProperties();
     250             : 
     251             :   // Resize constitutive-model specific material properties
     252        7520 :   _forest_dislocation_density[_qp].resize(_number_slip_systems);
     253             : 
     254             :   // Set constitutive-model specific initial values from parameters
     255        7520 :   const Real forest_density_per_system = _initial_forest_dislocation_density / _number_slip_systems;
     256      110144 :   for (const auto i : make_range(_number_slip_systems))
     257             :   {
     258      102624 :     _forest_dislocation_density[_qp][i] = forest_density_per_system;
     259      102624 :     _forest_dislocation_increment[_qp][i] = 0.0;
     260      102624 :     _slip_increment[_qp][i] = 0.0;
     261             :   }
     262             : 
     263             :   // Set initial resistance from lattice friction, which is type dependent
     264        7520 :   DenseVector<Real> lattice_resistance(_number_slip_systems, 0.0);
     265             :   unsigned int slip_mode = 0;
     266             :   unsigned int counter_adjustment = 0;
     267      110144 :   for (const auto i : make_range(_number_slip_systems))
     268             :   {
     269      102624 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     270       95680 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     271             :     else
     272             :     {
     273        6944 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     274        6944 :       ++slip_mode;
     275        6944 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     276             :     }
     277             :   }
     278             : 
     279        7520 :   calculateGrainSizeResistance(lattice_resistance);
     280             : 
     281      110144 :   for (const auto i : make_range(_number_slip_systems))
     282      102624 :     _slip_resistance[_qp][i] = lattice_resistance(i);
     283             : 
     284        7520 :   _total_substructure_density[_qp] = _initial_substructure_density;
     285        7520 :   _total_substructure_density_increment[_qp] = 0.0;
     286        7520 : }
     287             : 
     288             : void
     289      264511 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setMaterialVectorSize()
     290             : {
     291      264511 :   CrystalPlasticityStressUpdateBase::setMaterialVectorSize();
     292             : 
     293             :   // Resize non-stateful material properties
     294      264511 :   _forest_dislocation_increment[_qp].resize(_number_slip_systems);
     295      264511 :   _forest_dislocations_removed_increment[_qp].resize(_number_slip_systems);
     296      264511 : }
     297             : 
     298             : void
     299     1349366 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateGrainSizeResistance(
     300             :     DenseVector<Real> & lattice_resistance)
     301             : {
     302             :   unsigned int slip_mode = 0;
     303             :   unsigned int counter_adjustment = 0;
     304    20081750 :   for (const auto i : make_range(_number_slip_systems))
     305             :   {
     306             :     Real hallpetch_burgers_term = 0.0;
     307    18732384 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     308    17487078 :       hallpetch_burgers_term = _hallpetch_like_coefficient[slip_mode] * _shear_modulus[slip_mode] *
     309    17487078 :                                std::sqrt(_burgers_vector[slip_mode]);
     310             :     else
     311             :     {
     312     1245306 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     313     1245306 :       ++slip_mode;
     314     1245306 :       hallpetch_burgers_term = _hallpetch_like_coefficient[slip_mode] * _shear_modulus[slip_mode] *
     315     1245306 :                                std::sqrt(_burgers_vector[slip_mode]);
     316             :     }
     317    18732384 :     lattice_resistance(i) += hallpetch_burgers_term / std::sqrt(_grain_size);
     318             :   }
     319     1349366 : }
     320             : 
     321             : void
     322      361567 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setInitialConstitutiveVariableValues()
     323             : {
     324      361567 :   _slip_resistance[_qp] = _slip_resistance_old[_qp];
     325      361567 :   _previous_substep_slip_resistance = _slip_resistance_old[_qp];
     326             : 
     327      361567 :   _forest_dislocation_density[_qp] = _forest_dislocation_density_old[_qp];
     328      361567 :   _previous_substep_forest_dislocations = _forest_dislocation_density_old[_qp];
     329             : 
     330      361567 :   _total_substructure_density[_qp] = _total_substructure_density_old[_qp];
     331      361567 :   _previous_substep_total_substructure_density = _total_substructure_density_old[_qp];
     332      361567 : }
     333             : 
     334             : void
     335      646943 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setSubstepConstitutiveVariableValues()
     336             : {
     337      646943 :   _slip_resistance[_qp] = _previous_substep_slip_resistance;
     338      646943 :   _forest_dislocation_density[_qp] = _previous_substep_forest_dislocations;
     339      646943 :   _total_substructure_density[_qp] = _previous_substep_total_substructure_density;
     340      646943 : }
     341             : 
     342             : bool
     343     4064100 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSlipRate()
     344             : {
     345    50434331 :   for (const auto i : make_range(_number_slip_systems))
     346             :   {
     347    46471424 :     Real driving_force = std::abs(_tau[_qp][i] / _slip_resistance[_qp][i]);
     348    46471424 :     if (driving_force < _zero_tol)
     349     7242822 :       _slip_increment[_qp][i] = 0.0;
     350             :     else
     351             :     {
     352    39228602 :       _slip_increment[_qp][i] =
     353    39228602 :           _reference_strain_rate * std::pow(driving_force, (1.0 / _rate_sensitivity_exponent));
     354    39228602 :       if (_tau[_qp][i] < 0.0)
     355    19965961 :         _slip_increment[_qp][i] *= -1.0;
     356             :     }
     357    46471424 :     if (std::abs(_slip_increment[_qp][i]) * _substep_dt > _slip_incr_tol)
     358             :     {
     359      101193 :       if (_print_convergence_message)
     360           1 :         mooseWarning("Maximum allowable slip increment exceeded ",
     361           1 :                      std::abs(_slip_increment[_qp][i]) * _substep_dt);
     362             :       return false;
     363             :     }
     364             :   }
     365             :   return true;
     366             : }
     367             : 
     368             : void
     369     3962907 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateEquivalentSlipIncrement(
     370             :     RankTwoTensor & equivalent_slip_increment)
     371             : {
     372     3962907 :   if (_include_twinning_in_Lp)
     373             :   {
     374     8356240 :     for (const auto i : make_range(_number_slip_systems))
     375     7833975 :       equivalent_slip_increment += (1.0 - (*_twin_volume_fraction_total)[_qp]) *
     376     7833975 :                                    _flow_direction[_qp][i] * _slip_increment[_qp][i] * _substep_dt;
     377             :   }
     378             :   else // if no twinning volume fraction material property supplied, use base class
     379     3440642 :     CrystalPlasticityStressUpdateBase::calculateEquivalentSlipIncrement(equivalent_slip_increment);
     380     3962907 : }
     381             : 
     382             : void
     383     3962907 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateConstitutiveSlipDerivative(
     384             :     std::vector<Real> & dslip_dtau)
     385             : {
     386    50029584 :   for (const auto i : make_range(_number_slip_systems))
     387             :   {
     388    46066677 :     if (MooseUtils::absoluteFuzzyEqual(_tau[_qp][i], 0.0))
     389     5930761 :       dslip_dtau[i] = 0.0;
     390             :     else
     391    40135916 :       dslip_dtau[i] = _slip_increment[_qp][i] /
     392    40135916 :                       (_rate_sensitivity_exponent * std::abs(_tau[_qp][i])) * _substep_dt;
     393             :   }
     394     3962907 : }
     395             : 
     396             : bool
     397      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::areConstitutiveStateVariablesConverged()
     398             : {
     399      694903 :   if (isConstitutiveStateVariableConverged(_forest_dislocation_density[_qp],
     400      694903 :                                            _forest_dislocations_before_update,
     401      694903 :                                            _previous_substep_forest_dislocations,
     402     1259546 :                                            _rel_state_var_tol) &&
     403     1238774 :       isSubstructureDislocationDensityConverged() &&
     404      543871 :       isConstitutiveStateVariableConverged(_slip_resistance[_qp],
     405      543871 :                                            _slip_resistance_before_update,
     406      543871 :                                            _previous_substep_slip_resistance,
     407      543871 :                                            _resistance_tol))
     408             :     return true;
     409             :   return false;
     410             : }
     411             : 
     412             : bool
     413      564643 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::isSubstructureDislocationDensityConverged()
     414             : {
     415             :   bool converged_flag = true;
     416             : 
     417             :   Real substructure_diff =
     418      564643 :       std::abs(_total_substructure_density_before_update - _total_substructure_density[_qp]);
     419             : 
     420      564643 :   if (_previous_substep_total_substructure_density < _zero_tol && substructure_diff > _zero_tol)
     421             :     converged_flag = false;
     422      564643 :   else if (_previous_substep_total_substructure_density > _zero_tol &&
     423      564643 :            substructure_diff > _rel_state_var_tol * _previous_substep_total_substructure_density)
     424             :     converged_flag = false;
     425             : 
     426      564643 :   return converged_flag;
     427             : }
     428             : 
     429             : void
     430      542335 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::updateSubstepConstitutiveVariableValues()
     431             : {
     432      542335 :   _previous_substep_slip_resistance = _slip_resistance[_qp];
     433      542335 :   _previous_substep_forest_dislocations = _forest_dislocation_density[_qp];
     434      542335 :   _previous_substep_total_substructure_density = _total_substructure_density[_qp];
     435      542335 : }
     436             : 
     437             : void
     438      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::cacheStateVariablesBeforeUpdate()
     439             : {
     440      694903 :   _slip_resistance_before_update = _slip_resistance[_qp];
     441      694903 :   _forest_dislocations_before_update = _forest_dislocation_density[_qp];
     442      694903 :   _total_substructure_density_before_update = _total_substructure_density[_qp];
     443      694903 : }
     444             : 
     445             : void
     446      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateStateVariableEvolutionRateComponent()
     447             : {
     448      694903 :   calculateForestDislocationEvolutionIncrement();
     449      694903 :   calculateSubstructureDensityEvolutionIncrement();
     450      694903 : }
     451             : 
     452             : void
     453      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateForestDislocationEvolutionIncrement()
     454             : {
     455      694903 :   DenseVector<Real> k1_term(_number_slip_systems);
     456      694903 :   DenseVector<Real> k2_term(_number_slip_systems);
     457             : 
     458             :   const Real temperature_strain_term =
     459      694903 :       _boltzman_constant * _temperature[_qp] *
     460      694903 :       std::log(_macro_applied_strain_rate / _macro_reference_strain_rate);
     461             : 
     462             :   // solve first for the coefficients, which depend on the given slip mode
     463             :   unsigned int slip_mode = 0;
     464             :   unsigned int counter_adjustment = 0;
     465     9987430 :   for (const auto i : make_range(_number_slip_systems))
     466             :   {
     467             :     Real interaction_term = 0.0;
     468             :     Real volume_term = 0.0;
     469     9292527 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     470             :     {
     471     8681140 :       k1_term(i) = _slip_generation_coefficient[slip_mode];
     472     8681140 :       interaction_term = _forest_interaction_coefficient * _burgers_vector[slip_mode] /
     473             :                          _slip_activation_energy[slip_mode];
     474     8681140 :       volume_term =
     475     8681140 :           _proportionality_factor[slip_mode] * Utility::pow<3>(_burgers_vector[slip_mode]);
     476             :     }
     477             :     else
     478             :     {
     479      611387 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     480      611387 :       ++slip_mode;
     481             : 
     482      611387 :       k1_term(i) = _slip_generation_coefficient[slip_mode];
     483      611387 :       interaction_term = _forest_interaction_coefficient * _burgers_vector[slip_mode] /
     484             :                          _slip_activation_energy[slip_mode];
     485      611387 :       volume_term =
     486      611387 :           _proportionality_factor[slip_mode] * Utility::pow<3>(_burgers_vector[slip_mode]);
     487             :     }
     488     9292527 :     k2_term(i) = interaction_term * k1_term(i) * (1.0 - temperature_strain_term / volume_term);
     489             :   }
     490             : 
     491     9987430 :   for (const auto i : make_range(_number_slip_systems))
     492             :   {
     493     9292527 :     const Real abs_slip_increment = std::abs(_slip_increment[_qp][i]);
     494             :     Real generated_dislocations = 0.0;
     495             : 
     496     9292527 :     if (_forest_dislocation_density[_qp][i] > 0.0)
     497     9292527 :       generated_dislocations = k1_term(i) * std::sqrt(_forest_dislocation_density[_qp][i]) *
     498     9292527 :                                abs_slip_increment * _substep_dt;
     499             : 
     500     9292527 :     _forest_dislocations_removed_increment[_qp][i] =
     501     9292527 :         k2_term(i) * _forest_dislocation_density[_qp][i] * abs_slip_increment * _substep_dt;
     502             : 
     503     9292527 :     _forest_dislocation_increment[_qp][i] =
     504     9292527 :         generated_dislocations - _forest_dislocations_removed_increment[_qp][i];
     505             :   }
     506      694903 : }
     507             : 
     508             : void
     509      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSubstructureDensityEvolutionIncrement()
     510             : {
     511             :   // calculate the generation coefficient, which depends on the slip mode
     512      694903 :   DenseVector<Real> generation_term(_number_slip_systems, 0.0);
     513             : 
     514             :   unsigned int slip_mode = 0;
     515             :   unsigned int counter_adjustment = 0;
     516     9987430 :   for (const auto i : make_range(_number_slip_systems))
     517             :   {
     518     9292527 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     519     8681140 :       generation_term(i) = _substructure_rate_coefficient[slip_mode] * _burgers_vector[slip_mode];
     520             :     else
     521             :     {
     522      611387 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     523      611387 :       ++slip_mode;
     524      611387 :       generation_term(i) = _substructure_rate_coefficient[slip_mode] * _burgers_vector[slip_mode];
     525             :     }
     526             :   }
     527             : 
     528             :   // perform the summing calculation over all slip systems
     529      694903 :   _total_substructure_density_increment[_qp] = 0.0;
     530      694903 :   const Real sqrt_substructures = std::sqrt(_total_substructure_density[_qp]);
     531             : 
     532     9987430 :   for (const auto i : make_range(_number_slip_systems))
     533     9292527 :     _total_substructure_density_increment[_qp] +=
     534     9292527 :         generation_term(i) * sqrt_substructures * _forest_dislocations_removed_increment[_qp][i];
     535      694903 : }
     536             : 
     537             : void
     538     1341846 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSlipResistance()
     539             : {
     540     1341846 :   DenseVector<Real> forest_hardening(_number_slip_systems, 0.0);
     541     1341846 :   DenseVector<Real> substructure_hardening(_number_slip_systems, 0.0);
     542     1341846 :   DenseVector<Real> lattice_resistance(_number_slip_systems, 0.0);
     543             : 
     544             :   unsigned int slip_mode = 0;
     545             :   unsigned int counter_adjustment = 0;
     546    19971606 :   for (const auto i : make_range(_number_slip_systems))
     547             :   {
     548             :     Real burgers = 0.0;
     549             :     Real shear_modulus = 0.0;
     550    18629760 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     551             :     {
     552    17391398 :       burgers = _burgers_vector[slip_mode];
     553    17391398 :       shear_modulus = _shear_modulus[slip_mode];
     554    17391398 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     555             :     }
     556             :     else
     557             :     {
     558     1238362 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     559     1238362 :       ++slip_mode;
     560     1238362 :       burgers = _burgers_vector[slip_mode];
     561     1238362 :       shear_modulus = _shear_modulus[slip_mode];
     562     1238362 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     563             :     }
     564             : 
     565             :     // forest dislocation hardening
     566    18629760 :     if (_forest_dislocation_density[_qp][i] > 0.0)
     567    18629760 :       forest_hardening(i) = _forest_interaction_coefficient * burgers * shear_modulus *
     568    18629760 :                             std::sqrt(_forest_dislocation_density[_qp][i]);
     569             :     else
     570           0 :       forest_hardening(i) = 0.0;
     571             : 
     572             :     // substructure dislocation hardening
     573    18629760 :     if (_total_substructure_density[_qp] > 0.0)
     574             :     {
     575    18629760 :       const Real spacing_term = burgers * std::sqrt(_total_substructure_density[_qp]);
     576    18629760 :       substructure_hardening(i) = _substructure_hardening_coefficient * shear_modulus *
     577    18629760 :                                   spacing_term * std::log10(1.0 / spacing_term);
     578             :     }
     579             :     else
     580           0 :       substructure_hardening(i) = 0.0;
     581             :   }
     582             : 
     583     1341846 :   calculateGrainSizeResistance(lattice_resistance);
     584             : 
     585             :   // have the constant initial value, while it's not a function of temperature, sum
     586    19971606 :   for (const auto i : make_range(_number_slip_systems))
     587    18629760 :     _slip_resistance[_qp][i] =
     588    18629760 :         lattice_resistance(i) + forest_hardening(i) + substructure_hardening(i);
     589     1341846 : }
     590             : 
     591             : bool
     592      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::updateStateVariables()
     593             : {
     594      694903 :   if (calculateForestDislocationDensity() && calculateSubstructureDislocationDensity())
     595             :     return true;
     596             :   else
     597           0 :     return false;
     598             : }
     599             : 
     600             : bool
     601      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateForestDislocationDensity()
     602             : {
     603     9987430 :   for (const auto i : make_range(_number_slip_systems))
     604             :   {
     605     9292527 :     if (_previous_substep_forest_dislocations[i] < _zero_tol &&
     606      324945 :         _forest_dislocation_increment[_qp][i] < 0.0)
     607           0 :       _forest_dislocation_density[_qp][i] = _previous_substep_forest_dislocations[i];
     608             :     else
     609     9292527 :       _forest_dislocation_density[_qp][i] =
     610     9292527 :           _previous_substep_forest_dislocations[i] + _forest_dislocation_increment[_qp][i];
     611             : 
     612     9292527 :     if (_forest_dislocation_density[_qp][i] < 0.0)
     613             :       return false;
     614             :   }
     615             :   return true;
     616             : }
     617             : 
     618             : bool
     619      694903 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSubstructureDislocationDensity()
     620             : {
     621      694903 :   if (_previous_substep_total_substructure_density < _zero_tol &&
     622           0 :       _total_substructure_density_increment[_qp] < 0.0)
     623           0 :     _total_substructure_density[_qp] = _previous_substep_total_substructure_density;
     624             :   else
     625      694903 :     _total_substructure_density[_qp] =
     626      694903 :         _previous_substep_total_substructure_density + _total_substructure_density_increment[_qp];
     627             : 
     628      694903 :   if (_total_substructure_density[_qp] < 0.0)
     629           0 :     return false;
     630             : 
     631             :   return true;
     632             : }

Generated by: LCOV version 1.14