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 : #pragma once 11 : 12 : #include "Material.h" 13 : #include "RankTwoTensor.h" 14 : #include "RankFourTensor.h" 15 : #include "DelimitedFileReader.h" 16 : 17 : class CrystalPlasticityStressUpdateBase : public Material 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : 22 : CrystalPlasticityStressUpdateBase(const InputParameters & parameters); 23 : 24 : /// Sets the value of the global variable _qp for inheriting classes 25 : void setQp(const unsigned int & qp); 26 : 27 : /// Sets the value of the _substep_dt for inheriting classes 28 : void setSubstepDt(const Real & substep_dt); 29 : 30 : ///@{ Retained as empty methods to avoid a warning from Material.C in framework. These methods are unused in all inheriting classes and should not be overwritten. 31 0 : virtual void resetQpProperties() final {} 32 242816 : virtual void resetProperties() final {} 33 : ///@} 34 : 35 : /** 36 : * initializes the stateful properties such as PK2 stress, resolved shear 37 : * stress, plastic deformation gradient, slip system resistances, etc. 38 : * This class is often overwritten by inherting classes. 39 : */ 40 : virtual void initQpStatefulProperties() override; 41 : virtual void setMaterialVectorSize(); 42 : 43 : /** 44 : * A helper method to read in plane normal and direction vectors from a file 45 : * and to normalize the vectors. This method is abstracted to allow for reuse 46 : * in inheriting classes with multiple plane normal and direction vector pairs. 47 : */ 48 : virtual void getSlipSystems(); 49 : 50 : /** 51 : * A helper method to transform the Miller-Bravais 4-index notation for HCP 52 : * crystals into a a 3-index Cartesian representation, using the convention 53 : * a$_1$ = x of axis alignment in the basal plane 54 : */ 55 : void transformHexagonalMillerBravaisSlipSystems(const MooseUtils::DelimitedFileReader & reader); 56 : 57 : /** 58 : * Computes the Schmid tensor (m x n) for the original (reference) crystal 59 : * lattice orientation for each glide slip system 60 : */ 61 : void calculateFlowDirection(const RankTwoTensor & crysrot); 62 : 63 : /** 64 : * Computes the shear stess for each slip system 65 : */ 66 : void calculateShearStress(const RankTwoTensor & pk2, 67 : const RankTwoTensor & inverse_eigenstrain_deformation_grad, 68 : const unsigned int & num_eigenstrains); 69 : 70 : /** 71 : * Calculates the total value of $\frac{d\mathbf{F}^P^{-1}}{d\mathbf{PK2}}$ and 72 : * is intended to be an overwritten helper method for inheriting classes with 73 : * multiple constitutive dislocation slip mechanisms, e.g. glide and twinning, 74 : * $\sum_i \frac{d\mathbf{F}^P^{-1}}{d\mathbf{PK2}_i}$ 75 : */ 76 : virtual void calculateTotalPlasticDeformationGradientDerivative( 77 : RankFourTensor & dfpinvdpk2, 78 : const RankTwoTensor & inverse_plastic_deformation_grad_old, 79 : const RankTwoTensor & inverse_eigenstrain_deformation_grad_old, 80 : const unsigned int & num_eigenstrains); 81 : 82 : /** 83 : * A helper method to rotate the a direction and plane normal system set into 84 : * the local crystal llatice orientation as defined by the crystal rotation 85 : * tensor from the Elasticity tensor class. 86 : */ 87 : void calculateSchmidTensor(const unsigned int & number_dislocation_systems, 88 : const std::vector<RealVectorValue> & plane_normal_vector, 89 : const std::vector<RealVectorValue> & direction_vector, 90 : std::vector<RankTwoTensor> & schmid_tensor, 91 : const RankTwoTensor & crysrot); 92 : 93 : /** 94 : * A helper method to sort the slip systems of a crystal into cross slip families based 95 : * on common slip directions. This method determines if slip directions are parallel, 96 : * and stores the index of the slip systems from getSlipSystems (the same index is used 97 : * for the applied shear stress and the internal state variables) in a vector of vectors, 98 : * where the outer vector separates the individual slip system families and the inner vector 99 : * stories the indices of the slip systems within a single family. This vector of vectors 100 : * can then be used in the inheriting classes to calculate cross slip interactions. 101 : * The values of number_cross_slip_directions and number_cross_slip_planes must be set to 102 : * use this sorting method. 103 : */ 104 : void sortCrossSlipFamilies(); 105 : 106 : /** 107 : * A helper method for inherting classes to identify to which cross slip family vector 108 : * a particular slip system index belongs after the slip systems have been sorted. Returns 109 : * the integer value of the identified cross slip system family for the outer vector 110 : * created in sortCrossSlipFamilies. 111 : */ 112 : unsigned int identifyCrossSlipFamily(const unsigned int index); 113 : 114 : /** 115 : * This virtual method is called to set the constitutive internal state variables 116 : * current value and the previous substep value to the old property value for 117 : * the start of the stress convergence while loop. 118 : */ 119 0 : virtual void setInitialConstitutiveVariableValues() {} 120 : 121 : /** 122 : * This virtual method is called to set the current constitutive internal state 123 : * variable value to that of the previous substep at the beginning of the next 124 : * substep increment. In cases where only one substep is taken (or when the first) 125 : * substep is taken, this method sets the current constitutive internal state 126 : * variable value to the old value. 127 : */ 128 0 : virtual void setSubstepConstitutiveVariableValues() {} 129 : 130 : /** 131 : * Stores the current value of the constitutive internal state variables into 132 : * a separate material property in case substepping is required, once the 133 : * constitutive variables have passed convergence tolerances. This separate 134 : * material property is used as the previous substep value in the associated 135 : * setSubstepConstitutiveVariableValues method in the next substep (if taken). 136 : */ 137 0 : virtual void updateSubstepConstitutiveVariableValues() {} 138 : 139 : /** 140 : * This virtual method is called to calculate the slip system slip 141 : * increment based on the constitutive model defined in the child class. 142 : * This method must be overwritten in the child class. 143 : */ 144 : virtual bool calculateSlipRate() = 0; 145 : 146 : virtual void calculateEquivalentSlipIncrement(RankTwoTensor & /*equivalent_slip_increment*/); 147 : 148 : /** 149 : * This virtual method is called to find the derivative of the slip increment 150 : * with respect to the applied shear stress on the slip system based on the 151 : * constiutive model defined in the child class. This method must be overwritten 152 : * in the child class. 153 : */ 154 : virtual void calculateConstitutiveSlipDerivative(std::vector<Real> & /*dslip_dtau*/) = 0; 155 : 156 : /** 157 : * Finalizes the values of the state variables and slip system resistance 158 : * for the current timestep after convergence has been reached. 159 : */ 160 : 161 0 : virtual void cacheStateVariablesBeforeUpdate() {} 162 : 163 0 : virtual void calculateStateVariableEvolutionRateComponent() {} 164 : 165 : /** 166 : * Finalizes the values of the state variables and slip system resistance 167 : * for the current timestep after convergence has been reached. 168 : */ 169 : virtual bool updateStateVariables() = 0; 170 : 171 4664086 : virtual void calculateSlipResistance() {} 172 : 173 : /** 174 : * Determines if all the state variables have converged 175 : */ 176 0 : virtual bool areConstitutiveStateVariablesConverged() { return true; } 177 : 178 : /** 179 : * Check if a typical state variable, e.g. defect density, has converged 180 : * by comparing the change in the values over the iteration period. 181 : */ 182 : virtual bool isConstitutiveStateVariableConverged(const std::vector<Real> & current_var, 183 : const std::vector<Real> & var_before_update, 184 : const std::vector<Real> & previous_substep_var, 185 : const Real & tolerance); 186 : 187 : protected: 188 : /// Base name prepended to all material property names to allow for 189 : /// multi-material systems 190 : const std::string _base_name; 191 : 192 : const enum class CrystalLatticeType { BCC, FCC, HCP } _crystal_lattice_type; 193 : 194 : const std::vector<Real> _unit_cell_dimension; 195 : 196 : ///Maximum number of active slip systems for the crystalline material being modeled 197 : const unsigned int _number_slip_systems; 198 : 199 : /// File should contain slip plane normal and direction. 200 : std::string _slip_sys_file_name; 201 : 202 : /// @{Parameters to characterize the cross slip behavior of the crystal 203 : const Real _number_cross_slip_directions; 204 : const Real _number_cross_slip_planes; 205 : ///@} 206 : 207 : /// Internal variable update equation tolerance 208 : Real _rel_state_var_tol; 209 : /// Slip increment tolerance 210 : Real _slip_incr_tol; 211 : /// Tolerance for change in slip system resistance over an increment 212 : Real _resistance_tol; 213 : /// Residual tolerance when variable value is zero. Default 1e-12. 214 : Real _zero_tol; 215 : 216 : ///@{Slip system resistance 217 : MaterialProperty<std::vector<Real>> & _slip_resistance; 218 : const MaterialProperty<std::vector<Real>> & _slip_resistance_old; 219 : ///@} 220 : 221 : /// Current slip increment material property 222 : MaterialProperty<std::vector<Real>> & _slip_increment; 223 : 224 : ///@{Slip system direction and normal and associated Schmid tensors 225 : std::vector<RealVectorValue> _slip_direction; 226 : std::vector<RealVectorValue> _slip_plane_normal; 227 : MaterialProperty<std::vector<RankTwoTensor>> & _flow_direction; 228 : ///@} 229 : 230 : /// Resolved shear stress on each slip system 231 : MaterialProperty<std::vector<Real>> & _tau; 232 : 233 : /// Flag to print to console warning messages on stress, constitutive model convergence 234 : const bool _print_convergence_message; 235 : 236 : /// Substepping time step value used within the inheriting constitutive models 237 : Real _substep_dt; 238 : 239 : /// Sorted slip system indices into cross slip family groups 240 : std::vector<std::vector<unsigned int>> _cross_slip_familes; 241 : 242 : /// Flag to run the cross slip calculations if cross slip numbers are specified 243 : bool _calculate_cross_slip; 244 : };