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

Generated by: LCOV version 1.14