LCOV - code coverage report
Current view: top level - src/materials/crystal_plasticity - CrystalPlasticityHCPDislocationSlipBeyerleinUpdate.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 299 307 97.4 %
Date: 2025-07-25 05:00:39 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         356 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::validParams()
      17             : {
      18         356 :   InputParameters params = CrystalPlasticityStressUpdateBase::validParams();
      19         356 :   params.addClassDescription("Two-term dislocation slip model for hexagonal close packed crystals "
      20             :                              "from Beyerline and Tome");
      21             : 
      22         712 :   params.set<MooseEnum>("crystal_lattice_type") = "HCP";
      23         356 :   params.suppressParameter<MooseEnum>("crystal_lattice_type");
      24             : 
      25         712 :   params.addCoupledVar("temperature", "The name of the temperature variable");
      26         712 :   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         712 :   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         712 :   params.addParam<unsigned int>(
      37             :       "slip_system_modes",
      38         712 :       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         712 :   params.addParam<std::vector<unsigned int>>(
      42             :       "number_slip_systems_per_mode",
      43         356 :       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         712 :   params.addParam<std::vector<Real>>(
      47             :       "lattice_friction_per_mode",
      48         356 :       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         712 :   params.addParam<std::vector<Real>>(
      53             :       "effective_shear_modulus_per_mode",
      54         356 :       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         712 :   params.addParam<std::vector<Real>>(
      59             :       "burgers_vector_per_mode",
      60         356 :       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         712 :   params.addParam<std::vector<Real>>(
      65             :       "slip_generation_coefficient_per_mode",
      66         356 :       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         712 :   params.addParam<std::vector<Real>>(
      71             :       "normalized_slip_activiation_energy_per_mode",
      72         356 :       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         712 :   params.addParam<std::vector<Real>>(
      77             :       "slip_energy_proportionality_factor_per_mode",
      78         356 :       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         712 :   params.addParam<std::vector<Real>>(
      84             :       "substructure_rate_coefficient_per_mode",
      85         356 :       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         712 :   params.addParam<Real>("gamma_o", 1.0e-3, "Reference strain rate on each slip system, in 1/s");
      92         712 :   params.addParam<Real>("strain_rate_sensitivity_exponent",
      93         712 :                         0.05,
      94             :                         "The strain rate sensitivity exponent for the power law relationship of "
      95             :                         "resolved shear stress");
      96         712 :   params.addParam<Real>("forest_interaction_parameter",
      97         712 :                         0.9,
      98             :                         "Forest dislocation interaction parameter, Chi, dimensionless.");
      99         712 :   params.addParam<Real>("Boltzman_constant", 1.38065e-20, "Boltzman constant, in MPa-mm^3/K");
     100        1068 :   params.addRangeCheckedParam<Real>("applied_strain_rate",
     101         712 :                                     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         712 :   params.addParam<Real>("reference_macroscopic_strain_rate",
     106         712 :                         1.0e7,
     107             :                         "Value of the reference macroscopic strain rate for the thermal "
     108             :                         "dislocation attraction, in 1/s.");
     109         712 :   params.addParam<Real>("substructure_hardening_coefficient",
     110         712 :                         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         712 :   params.addParam<std::vector<Real>>(
     115             :       "Hall_Petch_like_constant_per_mode",
     116         356 :       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         712 :   params.addRequiredRangeCheckedParam<Real>(
     120             :       "grain_size", "grain_size>0", "Value of the crystal grain size, in mm");
     121             : 
     122         712 :   params.addParam<MaterialPropertyName>(
     123             :       "total_twin_volume_fraction",
     124             :       "Total twin volume fraction, if twinning is considered in the simulation");
     125             : 
     126         356 :   return params;
     127           0 : }
     128             : 
     129         274 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::
     130         274 :     CrystalPlasticityHCPDislocationSlipBeyerleinUpdate(const InputParameters & parameters)
     131             :   : CrystalPlasticityStressUpdateBase(parameters),
     132             : 
     133         266 :     _temperature(coupledValue("temperature")),
     134         266 :     _forest_dislocation_density(
     135         266 :         declareProperty<std::vector<Real>>(_base_name + "forest_dislocation_density")),
     136         266 :     _forest_dislocation_density_old(
     137         266 :         getMaterialPropertyOld<std::vector<Real>>(_base_name + "forest_dislocation_density")),
     138         266 :     _forest_dislocation_increment(
     139         266 :         declareProperty<std::vector<Real>>(_base_name + "forest_dislocation_increment")),
     140         266 :     _forest_dislocations_removed_increment(
     141         266 :         declareProperty<std::vector<Real>>(_base_name + "_forest_dislocations_removed_increment")),
     142         532 :     _initial_forest_dislocation_density(getParam<Real>("initial_forest_dislocation_density")),
     143         266 :     _total_substructure_density(declareProperty<Real>(_base_name + "total_substructure_density")),
     144         266 :     _total_substructure_density_old(
     145         266 :         getMaterialPropertyOld<Real>(_base_name + "total_substructure_density")),
     146         266 :     _total_substructure_density_increment(
     147         266 :         declareProperty<Real>(_base_name + "total_substructure_increment")),
     148         532 :     _initial_substructure_density(getParam<Real>("initial_substructure_density")),
     149             : 
     150         532 :     _slip_system_modes(getParam<unsigned int>("slip_system_modes")),
     151         532 :     _number_slip_systems_per_mode(
     152             :         getParam<std::vector<unsigned int>>("number_slip_systems_per_mode")),
     153         532 :     _lattice_friction(getParam<std::vector<Real>>("lattice_friction_per_mode")),
     154             : 
     155         532 :     _reference_strain_rate(getParam<Real>("gamma_o")),
     156         532 :     _rate_sensitivity_exponent(getParam<Real>("strain_rate_sensitivity_exponent")),
     157             : 
     158         532 :     _burgers_vector(getParam<std::vector<Real>>("burgers_vector_per_mode")),
     159         532 :     _slip_generation_coefficient(
     160             :         getParam<std::vector<Real>>("slip_generation_coefficient_per_mode")),
     161         532 :     _slip_activation_energy(
     162             :         getParam<std::vector<Real>>("normalized_slip_activiation_energy_per_mode")),
     163         532 :     _proportionality_factor(
     164             :         getParam<std::vector<Real>>("slip_energy_proportionality_factor_per_mode")),
     165         532 :     _forest_interaction_coefficient(getParam<Real>("forest_interaction_parameter")),
     166         532 :     _boltzman_constant(getParam<Real>("Boltzman_constant")),
     167         532 :     _macro_applied_strain_rate(getParam<Real>("applied_strain_rate")),
     168         532 :     _macro_reference_strain_rate(getParam<Real>("reference_macroscopic_strain_rate")),
     169             : 
     170         532 :     _shear_modulus(getParam<std::vector<Real>>("effective_shear_modulus_per_mode")),
     171         532 :     _substructure_rate_coefficient(
     172             :         getParam<std::vector<Real>>("substructure_rate_coefficient_per_mode")),
     173         532 :     _substructure_hardening_coefficient(getParam<Real>("substructure_hardening_coefficient")),
     174         532 :     _hallpetch_like_coefficient(getParam<std::vector<Real>>("Hall_Petch_like_constant_per_mode")),
     175         532 :     _grain_size(getParam<Real>("grain_size")),
     176             : 
     177             :     // Twinning contributions, if used
     178         266 :     _include_twinning_in_Lp(parameters.isParamValid("total_twin_volume_fraction")),
     179         532 :     _twin_volume_fraction_total(_include_twinning_in_Lp
     180         302 :                                     ? &getMaterialPropertyOld<Real>("total_twin_volume_fraction")
     181         540 :                                     : nullptr)
     182             : {
     183             :   // resize local caching vectors used for substepping
     184         266 :   _previous_substep_slip_resistance.resize(_number_slip_systems);
     185         266 :   _previous_substep_forest_dislocations.resize(_number_slip_systems);
     186         266 :   _slip_resistance_before_update.resize(_number_slip_systems);
     187         266 :   _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         266 :   if (_number_slip_systems_per_mode.size() != _slip_system_modes)
     191           2 :     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         264 :   if (_burgers_vector.size() != _slip_system_modes)
     198           2 :     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         262 :   if (_slip_generation_coefficient.size() != _slip_system_modes)
     203           2 :     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         260 :   if (_slip_activation_energy.size() != _slip_system_modes)
     208           2 :     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         258 :   if (_proportionality_factor.size() != _slip_system_modes)
     213           2 :     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         256 :   if (_shear_modulus.size() != _slip_system_modes)
     218           2 :     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         254 :   if (_substructure_rate_coefficient.size() != _slip_system_modes)
     223           2 :     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         252 :   if (_hallpetch_like_coefficient.size() != _slip_system_modes)
     228           2 :     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         250 :   if (_lattice_friction.size() != _slip_system_modes)
     233           2 :     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         744 :   for (const auto i : make_range(_slip_system_modes))
     239         496 :     sum += _number_slip_systems_per_mode[i];
     240         248 :   if (sum != _number_slip_systems)
     241           2 :     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         246 : }
     245             : 
     246             : void
     247       10368 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::initQpStatefulProperties()
     248             : {
     249       10368 :   CrystalPlasticityStressUpdateBase::initQpStatefulProperties();
     250             : 
     251             :   // Resize constitutive-model specific material properties
     252       10368 :   _forest_dislocation_density[_qp].resize(_number_slip_systems);
     253             : 
     254             :   // Set constitutive-model specific initial values from parameters
     255       10368 :   const Real forest_density_per_system = _initial_forest_dislocation_density / _number_slip_systems;
     256      152320 :   for (const auto i : make_range(_number_slip_systems))
     257             :   {
     258      141952 :     _forest_dislocation_density[_qp][i] = forest_density_per_system;
     259      141952 :     _forest_dislocation_increment[_qp][i] = 0.0;
     260      141952 :     _slip_increment[_qp][i] = 0.0;
     261             :   }
     262             : 
     263             :   // Set initial resistance from lattice friction, which is type dependent
     264       10368 :   DenseVector<Real> lattice_resistance(_number_slip_systems, 0.0);
     265             :   unsigned int slip_mode = 0;
     266             :   unsigned int counter_adjustment = 0;
     267      152320 :   for (const auto i : make_range(_number_slip_systems))
     268             :   {
     269      141952 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     270      132352 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     271             :     else
     272             :     {
     273        9600 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     274        9600 :       ++slip_mode;
     275        9600 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     276             :     }
     277             :   }
     278             : 
     279       10368 :   calculateGrainSizeResistance(lattice_resistance);
     280             : 
     281      152320 :   for (const auto i : make_range(_number_slip_systems))
     282      141952 :     _slip_resistance[_qp][i] = lattice_resistance(i);
     283             : 
     284       10368 :   _total_substructure_density[_qp] = _initial_substructure_density;
     285       10368 :   _total_substructure_density_increment[_qp] = 0.0;
     286       10368 : }
     287             : 
     288             : void
     289      355652 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setMaterialVectorSize()
     290             : {
     291      355652 :   CrystalPlasticityStressUpdateBase::setMaterialVectorSize();
     292             : 
     293             :   // Resize non-stateful material properties
     294      355652 :   _forest_dislocation_increment[_qp].resize(_number_slip_systems);
     295      355652 :   _forest_dislocations_removed_increment[_qp].resize(_number_slip_systems);
     296      355652 : }
     297             : 
     298             : void
     299     1802344 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateGrainSizeResistance(
     300             :     DenseVector<Real> & lattice_resistance)
     301             : {
     302             :   unsigned int slip_mode = 0;
     303             :   unsigned int counter_adjustment = 0;
     304    26587016 :   for (const auto i : make_range(_number_slip_systems))
     305             :   {
     306             :     Real hallpetch_burgers_term = 0.0;
     307    24784672 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     308    23142136 :       hallpetch_burgers_term = _hallpetch_like_coefficient[slip_mode] * _shear_modulus[slip_mode] *
     309    23142136 :                                std::sqrt(_burgers_vector[slip_mode]);
     310             :     else
     311             :     {
     312     1642536 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     313     1642536 :       ++slip_mode;
     314     1642536 :       hallpetch_burgers_term = _hallpetch_like_coefficient[slip_mode] * _shear_modulus[slip_mode] *
     315     1642536 :                                std::sqrt(_burgers_vector[slip_mode]);
     316             :     }
     317    24784672 :     lattice_resistance(i) += hallpetch_burgers_term / std::sqrt(_grain_size);
     318             :   }
     319     1802344 : }
     320             : 
     321             : void
     322      480196 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setInitialConstitutiveVariableValues()
     323             : {
     324      480196 :   _slip_resistance[_qp] = _slip_resistance_old[_qp];
     325      480196 :   _previous_substep_slip_resistance = _slip_resistance_old[_qp];
     326             : 
     327      480196 :   _forest_dislocation_density[_qp] = _forest_dislocation_density_old[_qp];
     328      480196 :   _previous_substep_forest_dislocations = _forest_dislocation_density_old[_qp];
     329             : 
     330      480196 :   _total_substructure_density[_qp] = _total_substructure_density_old[_qp];
     331      480196 :   _previous_substep_total_substructure_density = _total_substructure_density_old[_qp];
     332      480196 : }
     333             : 
     334             : void
     335      851140 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::setSubstepConstitutiveVariableValues()
     336             : {
     337      851140 :   _slip_resistance[_qp] = _previous_substep_slip_resistance;
     338      851140 :   _forest_dislocation_density[_qp] = _previous_substep_forest_dislocations;
     339      851140 :   _total_substructure_density[_qp] = _previous_substep_total_substructure_density;
     340      851140 : }
     341             : 
     342             : bool
     343     5876734 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSlipRate()
     344             : {
     345    70854114 :   for (const auto i : make_range(_number_slip_systems))
     346             :   {
     347    65107954 :     Real driving_force = std::abs(_tau[_qp][i] / _slip_resistance[_qp][i]);
     348    65107954 :     if (driving_force < _zero_tol)
     349     9557844 :       _slip_increment[_qp][i] = 0.0;
     350             :     else
     351             :     {
     352    55550110 :       _slip_increment[_qp][i] =
     353    55550110 :           _reference_strain_rate * std::pow(driving_force, (1.0 / _rate_sensitivity_exponent));
     354    55550110 :       if (_tau[_qp][i] < 0.0)
     355    28398822 :         _slip_increment[_qp][i] *= -1.0;
     356             :     }
     357    65107954 :     if (std::abs(_slip_increment[_qp][i]) * _substep_dt > _slip_incr_tol)
     358             :     {
     359      130574 :       if (_print_convergence_message)
     360           2 :         mooseWarning("Maximum allowable slip increment exceeded ",
     361           2 :                      std::abs(_slip_increment[_qp][i]) * _substep_dt);
     362             :       return false;
     363             :     }
     364             :   }
     365             :   return true;
     366             : }
     367             : 
     368             : void
     369     5746160 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateEquivalentSlipIncrement(
     370             :     RankTwoTensor & equivalent_slip_increment)
     371             : {
     372     5746160 :   if (_include_twinning_in_Lp)
     373             :   {
     374    14617792 :     for (const auto i : make_range(_number_slip_systems))
     375    13704180 :       equivalent_slip_increment += (1.0 - (*_twin_volume_fraction_total)[_qp]) *
     376    13704180 :                                    _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     4832548 :     CrystalPlasticityStressUpdateBase::calculateEquivalentSlipIncrement(equivalent_slip_increment);
     380     5746160 : }
     381             : 
     382             : void
     383     5746160 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateConstitutiveSlipDerivative(
     384             :     std::vector<Real> & dslip_dtau)
     385             : {
     386    70331856 :   for (const auto i : make_range(_number_slip_systems))
     387             :   {
     388    64585696 :     if (MooseUtils::absoluteFuzzyEqual(_tau[_qp][i], 0.0))
     389     7731410 :       dslip_dtau[i] = 0.0;
     390             :     else
     391    56854286 :       dslip_dtau[i] = _slip_increment[_qp][i] /
     392    56854286 :                       (_rate_sensitivity_exponent * std::abs(_tau[_qp][i])) * _substep_dt;
     393             :   }
     394     5746160 : }
     395             : 
     396             : bool
     397      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::areConstitutiveStateVariablesConverged()
     398             : {
     399      940836 :   if (isConstitutiveStateVariableConverged(_forest_dislocation_density[_qp],
     400      940836 :                                            _forest_dislocations_before_update,
     401      940836 :                                            _previous_substep_forest_dislocations,
     402     1690616 :                                            _rel_state_var_tol) &&
     403     1659320 :       isSubstructureDislocationDensityConverged() &&
     404      718484 :       isConstitutiveStateVariableConverged(_slip_resistance[_qp],
     405      718484 :                                            _slip_resistance_before_update,
     406      718484 :                                            _previous_substep_slip_resistance,
     407      718484 :                                            _resistance_tol))
     408             :     return true;
     409             :   return false;
     410             : }
     411             : 
     412             : bool
     413      749780 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::isSubstructureDislocationDensityConverged()
     414             : {
     415             :   bool converged_flag = true;
     416             : 
     417             :   Real substructure_diff =
     418      749780 :       std::abs(_total_substructure_density_before_update - _total_substructure_density[_qp]);
     419             : 
     420      749780 :   if (_previous_substep_total_substructure_density < _zero_tol && substructure_diff > _zero_tol)
     421             :     converged_flag = false;
     422      749780 :   else if (_previous_substep_total_substructure_density > _zero_tol &&
     423      749780 :            substructure_diff > _rel_state_var_tol * _previous_substep_total_substructure_density)
     424             :     converged_flag = false;
     425             : 
     426      749780 :   return converged_flag;
     427             : }
     428             : 
     429             : void
     430      716180 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::updateSubstepConstitutiveVariableValues()
     431             : {
     432      716180 :   _previous_substep_slip_resistance = _slip_resistance[_qp];
     433      716180 :   _previous_substep_forest_dislocations = _forest_dislocation_density[_qp];
     434      716180 :   _previous_substep_total_substructure_density = _total_substructure_density[_qp];
     435      716180 : }
     436             : 
     437             : void
     438      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::cacheStateVariablesBeforeUpdate()
     439             : {
     440      940836 :   _slip_resistance_before_update = _slip_resistance[_qp];
     441      940836 :   _forest_dislocations_before_update = _forest_dislocation_density[_qp];
     442      940836 :   _total_substructure_density_before_update = _total_substructure_density[_qp];
     443      940836 : }
     444             : 
     445             : void
     446      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateStateVariableEvolutionRateComponent()
     447             : {
     448      940836 :   calculateForestDislocationEvolutionIncrement();
     449      940836 :   calculateSubstructureDensityEvolutionIncrement();
     450      940836 : }
     451             : 
     452             : void
     453      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateForestDislocationEvolutionIncrement()
     454             : {
     455      940836 :   DenseVector<Real> k1_term(_number_slip_systems);
     456      940836 :   DenseVector<Real> k2_term(_number_slip_systems);
     457             : 
     458             :   const Real temperature_strain_term =
     459      940836 :       _boltzman_constant * _temperature[_qp] *
     460      940836 :       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    13343688 :   for (const auto i : make_range(_number_slip_systems))
     466             :   {
     467             :     Real interaction_term = 0.0;
     468             :     Real volume_term = 0.0;
     469    12402852 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     470             :     {
     471    11590720 :       k1_term(i) = _slip_generation_coefficient[slip_mode];
     472    11590720 :       interaction_term = _forest_interaction_coefficient * _burgers_vector[slip_mode] /
     473             :                          _slip_activation_energy[slip_mode];
     474    11590720 :       volume_term =
     475    11590720 :           _proportionality_factor[slip_mode] * Utility::pow<3>(_burgers_vector[slip_mode]);
     476             :     }
     477             :     else
     478             :     {
     479      812132 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     480      812132 :       ++slip_mode;
     481             : 
     482      812132 :       k1_term(i) = _slip_generation_coefficient[slip_mode];
     483      812132 :       interaction_term = _forest_interaction_coefficient * _burgers_vector[slip_mode] /
     484             :                          _slip_activation_energy[slip_mode];
     485      812132 :       volume_term =
     486      812132 :           _proportionality_factor[slip_mode] * Utility::pow<3>(_burgers_vector[slip_mode]);
     487             :     }
     488    12402852 :     k2_term(i) = interaction_term * k1_term(i) * (1.0 - temperature_strain_term / volume_term);
     489             :   }
     490             : 
     491    13343688 :   for (const auto i : make_range(_number_slip_systems))
     492             :   {
     493    12402852 :     const Real abs_slip_increment = std::abs(_slip_increment[_qp][i]);
     494             :     Real generated_dislocations = 0.0;
     495             : 
     496    12402852 :     if (_forest_dislocation_density[_qp][i] > 0.0)
     497    12402852 :       generated_dislocations = k1_term(i) * std::sqrt(_forest_dislocation_density[_qp][i]) *
     498    12402852 :                                abs_slip_increment * _substep_dt;
     499             : 
     500    12402852 :     _forest_dislocations_removed_increment[_qp][i] =
     501    12402852 :         k2_term(i) * _forest_dislocation_density[_qp][i] * abs_slip_increment * _substep_dt;
     502             : 
     503    12402852 :     _forest_dislocation_increment[_qp][i] =
     504    12402852 :         generated_dislocations - _forest_dislocations_removed_increment[_qp][i];
     505             :   }
     506      940836 : }
     507             : 
     508             : void
     509      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSubstructureDensityEvolutionIncrement()
     510             : {
     511             :   // calculate the generation coefficient, which depends on the slip mode
     512      940836 :   DenseVector<Real> generation_term(_number_slip_systems, 0.0);
     513             : 
     514             :   unsigned int slip_mode = 0;
     515             :   unsigned int counter_adjustment = 0;
     516    13343688 :   for (const auto i : make_range(_number_slip_systems))
     517             :   {
     518    12402852 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     519    11590720 :       generation_term(i) = _substructure_rate_coefficient[slip_mode] * _burgers_vector[slip_mode];
     520             :     else
     521             :     {
     522      812132 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     523      812132 :       ++slip_mode;
     524      812132 :       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      940836 :   _total_substructure_density_increment[_qp] = 0.0;
     530      940836 :   const Real sqrt_substructures = std::sqrt(_total_substructure_density[_qp]);
     531             : 
     532    13343688 :   for (const auto i : make_range(_number_slip_systems))
     533    12402852 :     _total_substructure_density_increment[_qp] +=
     534    12402852 :         generation_term(i) * sqrt_substructures * _forest_dislocations_removed_increment[_qp][i];
     535      940836 : }
     536             : 
     537             : void
     538     1791976 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSlipResistance()
     539             : {
     540     1791976 :   DenseVector<Real> forest_hardening(_number_slip_systems, 0.0);
     541     1791976 :   DenseVector<Real> substructure_hardening(_number_slip_systems, 0.0);
     542     1791976 :   DenseVector<Real> lattice_resistance(_number_slip_systems, 0.0);
     543             : 
     544             :   unsigned int slip_mode = 0;
     545             :   unsigned int counter_adjustment = 0;
     546    26434696 :   for (const auto i : make_range(_number_slip_systems))
     547             :   {
     548             :     Real burgers = 0.0;
     549             :     Real shear_modulus = 0.0;
     550    24642720 :     if ((i - counter_adjustment) < _number_slip_systems_per_mode[slip_mode])
     551             :     {
     552    23009784 :       burgers = _burgers_vector[slip_mode];
     553    23009784 :       shear_modulus = _shear_modulus[slip_mode];
     554    23009784 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     555             :     }
     556             :     else
     557             :     {
     558     1632936 :       counter_adjustment += _number_slip_systems_per_mode[slip_mode];
     559     1632936 :       ++slip_mode;
     560     1632936 :       burgers = _burgers_vector[slip_mode];
     561     1632936 :       shear_modulus = _shear_modulus[slip_mode];
     562     1632936 :       lattice_resistance(i) = _lattice_friction[slip_mode];
     563             :     }
     564             : 
     565             :     // forest dislocation hardening
     566    24642720 :     if (_forest_dislocation_density[_qp][i] > 0.0)
     567    24642720 :       forest_hardening(i) = _forest_interaction_coefficient * burgers * shear_modulus *
     568    24642720 :                             std::sqrt(_forest_dislocation_density[_qp][i]);
     569             :     else
     570           0 :       forest_hardening(i) = 0.0;
     571             : 
     572             :     // substructure dislocation hardening
     573    24642720 :     if (_total_substructure_density[_qp] > 0.0)
     574             :     {
     575    24642720 :       const Real spacing_term = burgers * std::sqrt(_total_substructure_density[_qp]);
     576    24642720 :       substructure_hardening(i) = _substructure_hardening_coefficient * shear_modulus *
     577    24642720 :                                   spacing_term * std::log10(1.0 / spacing_term);
     578             :     }
     579             :     else
     580           0 :       substructure_hardening(i) = 0.0;
     581             :   }
     582             : 
     583     1791976 :   calculateGrainSizeResistance(lattice_resistance);
     584             : 
     585             :   // have the constant initial value, while it's not a function of temperature, sum
     586    26434696 :   for (const auto i : make_range(_number_slip_systems))
     587    24642720 :     _slip_resistance[_qp][i] =
     588    24642720 :         lattice_resistance(i) + forest_hardening(i) + substructure_hardening(i);
     589     1791976 : }
     590             : 
     591             : bool
     592      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::updateStateVariables()
     593             : {
     594      940836 :   if (calculateForestDislocationDensity() && calculateSubstructureDislocationDensity())
     595             :     return true;
     596             :   else
     597           0 :     return false;
     598             : }
     599             : 
     600             : bool
     601      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateForestDislocationDensity()
     602             : {
     603    13343688 :   for (const auto i : make_range(_number_slip_systems))
     604             :   {
     605    12402852 :     if (_previous_substep_forest_dislocations[i] < _zero_tol &&
     606      419820 :         _forest_dislocation_increment[_qp][i] < 0.0)
     607           0 :       _forest_dislocation_density[_qp][i] = _previous_substep_forest_dislocations[i];
     608             :     else
     609    12402852 :       _forest_dislocation_density[_qp][i] =
     610    12402852 :           _previous_substep_forest_dislocations[i] + _forest_dislocation_increment[_qp][i];
     611             : 
     612    12402852 :     if (_forest_dislocation_density[_qp][i] < 0.0)
     613             :       return false;
     614             :   }
     615             :   return true;
     616             : }
     617             : 
     618             : bool
     619      940836 : CrystalPlasticityHCPDislocationSlipBeyerleinUpdate::calculateSubstructureDislocationDensity()
     620             : {
     621      940836 :   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      940836 :     _total_substructure_density[_qp] =
     626      940836 :         _previous_substep_total_substructure_density + _total_substructure_density_increment[_qp];
     627             : 
     628      940836 :   if (_total_substructure_density[_qp] < 0.0)
     629           0 :     return false;
     630             : 
     631             :   return true;
     632             : }

Generated by: LCOV version 1.14