13#include "libmesh/utility.h"
25 "Crystal Plasticity base class: handles the Newton iteration over the stress residual and "
26 "calculates the Jacobian based on constitutive laws from multiple material classes "
27 "that are inherited from CrystalPlasticityStressUpdateBase");
30 "Optional parameter that allows the user to define multiple mechanics material systems on "
31 "the same block, i.e. for multiple phases");
34 "crystal_plasticity_models",
35 "The material objects to use to calculate crystal plasticity stress and strains.");
36 params.
addParam<std::vector<MaterialName>>(
37 "eigenstrain_names", {},
"The material objects to calculate eigenstrains.");
40 "Type of tangent moduli for preconditioner: default elastic");
41 params.
addParam<Real>(
"rtol", 1e-6,
"Constitutive stress residual relative tolerance");
42 params.
addParam<Real>(
"abs_tol", 1e-6,
"Constitutive stress residual absolute tolerance");
43 params.
addParam<
unsigned int>(
"maxiter", 100,
"Maximum number of iterations for stress update");
45 "maxiter_state_variable", 100,
"Maximum number of iterations for state variable update");
47 "maximum_substep_iteration", 1,
"Maximum number of substep iteration");
48 params.
addParam<
bool>(
"use_line_search",
false,
"Use line search in constitutive update");
49 params.
addParam<Real>(
"min_line_search_step_size", 0.01,
"Minimum line search step size");
50 params.
addParam<Real>(
"line_search_tol", 0.5,
"Line search bisection method tolerance");
52 "line_search_maxiter", 20,
"Line search bisection method maximum number of iteration");
54 MooseEnum(
"CUT_HALF BISECTION",
"CUT_HALF"),
55 "The method used in line search");
57 "print_state_variable_convergence_error_messages",
59 "Whether or not to print warning messages from the crystal plasticity specific convergence "
60 "checks on the stress measure and general constitutive model quantinties.");
67 _num_models(getParam<
std::vector<MaterialName>>(
"crystal_plasticity_models").size()),
68 _num_eigenstrains(getParam<
std::vector<MaterialName>>(
"eigenstrain_names").size()),
69 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
70 _elasticity_tensor(getMaterialPropertyByName<
RankFourTensor>(_base_name +
"elasticity_tensor")),
71 _rtol(getParam<Real>(
"rtol")),
72 _abs_tol(getParam<Real>(
"abs_tol")),
73 _maxiter(getParam<unsigned
int>(
"maxiter")),
74 _maxiterg(getParam<unsigned
int>(
"maxiter_state_variable")),
76 _max_substep_iter(getParam<unsigned
int>(
"maximum_substep_iteration")),
77 _use_line_search(getParam<bool>(
"use_line_search")),
78 _min_line_search_step_size(getParam<Real>(
"min_line_search_step_size")),
79 _line_search_tolerance(getParam<Real>(
"line_search_tol")),
80 _line_search_max_iterations(getParam<unsigned
int>(
"line_search_maxiter")),
82 _plastic_deformation_gradient(declareProperty<
RankTwoTensor>(
"plastic_deformation_gradient")),
83 _plastic_deformation_gradient_old(
84 getMaterialPropertyOld<
RankTwoTensor>(
"plastic_deformation_gradient")),
85 _eigenstrain_deformation_gradient(
86 _num_eigenstrains ? &declareProperty<
RankTwoTensor>(
"eigenstrain_deformation_gradient")
88 _eigenstrain_deformation_gradient_old(
90 ? &getMaterialPropertyOld<
RankTwoTensor>(
"eigenstrain_deformation_gradient")
92 _deformation_gradient(getMaterialProperty<
RankTwoTensor>(_base_name +
"deformation_gradient")),
93 _deformation_gradient_old(
94 getMaterialPropertyOld<
RankTwoTensor>(_base_name +
"deformation_gradient")),
95 _pk2(declareProperty<
RankTwoTensor>(
"second_piola_kirchhoff_stress")),
96 _pk2_old(getMaterialPropertyOld<
RankTwoTensor>(
"second_piola_kirchhoff_stress")),
97 _total_lagrangian_strain(
99 _updated_rotation(declareProperty<
RankTwoTensor>(
"updated_rotation")),
100 _updated_rotation_old(getMaterialPropertyOld<
RankTwoTensor>(
"updated_rotation")),
101 _misorientation(declareProperty<Real>(
"misorientation")),
103 _base_name +
"crysrot")),
104 _print_convergence_message(getParam<bool>(
"print_state_variable_convergence_error_messages"))
117 (*_eigenstrain_deformation_gradient)[_qp].zero();
118 (*_eigenstrain_deformation_gradient)[_qp].addIa(1.0);
137 _models[i]->initQpStatefulProperties();
151 std::vector<MaterialName> model_names =
152 getParam<std::vector<MaterialName>>(
"crystal_plasticity_models");
166 " is not compatible with ComputeMultipleCrystalPlasticityStress");
170 std::vector<MaterialName> eigenstrain_names =
171 getParam<std::vector<MaterialName>>(
"eigenstrain_names");
177 &getMaterialByName(eigenstrain_names[i]));
182 mooseError(
"Eigenstrain" + eigenstrain_names[i] +
183 " is not compatible with ComputeMultipleCrystalPlasticityStress");
193 _models[i]->setMaterialVectorSize();
207 if (isBoundaryMaterial())
211 unsigned int substep_iter = 1;
212 unsigned int num_substep = 1;
242 for (
unsigned int istep = 0; istep < num_substep; ++istep)
254 "The crystal plasticity constitutive model has failed to converge. Increasing "
255 "the number of substeps.");
264 mooseException(
"ComputeMultipleCrystalPlasticityStress: Constitutive failure");
274 _models[i]->setInitialConstitutiveVariableValues();
285 _models[i]->setSubstepConstitutiveVariableValues();
286 _models[i]->calculateSlipResistance();
296 _models[i]->updateSubstepConstitutiveVariableValues();
323 auto cos_val = (_delta_misorientation_mat.trace() - 1.0) / 2.0;
327 if (cos_val > 1.0 || cos_val < -1.0)
329 if (MooseUtils::absoluteFuzzyEqual(cos_val, -1.0))
331 else if (MooseUtils::absoluteFuzzyEqual(cos_val, 1.0))
334 mooseError(
"Misorientation value is undefined. This should not happen.");
342 unsigned int iteration;
343 bool iter_flag =
true;
361 _models[i]->cacheStateVariablesBeforeUpdate();
364 _models[i]->calculateStateVariableEvolutionRateComponent();
367 if (!
_models[i]->updateStateVariables())
371 _models[i]->calculateSlipResistance();
380 if (!
_models[i]->areConstitutiveStateVariablesConverged())
392 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: State variables (or the system "
393 "resistance) did not converge at element ",
400 }
while (iter_flag && iteration <
_maxiterg);
406 "ComputeMultipleCrystalPlasticityStress: Hardness Integration error. Reached the "
407 "maximum number of iterations to solve for the state variables at element ",
420 unsigned int iteration = 0;
422 Real rnorm, rnorm0, rnorm_prev;
429 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: the slip increment exceeds tolerance "
454 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: the slip increment exceeds tolerance "
469 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: Failed with line search");
484 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: Stress Integration error rmax = ",
486 " and the tolerance is ",
488 " when the rnorm0 value is ",
512 RankTwoTensor ce, elastic_strain, ce_pk2, equivalent_slip_increment_per_model,
513 equivalent_slip_increment, pk2_new;
515 equivalent_slip_increment.zero();
520 equivalent_slip_increment_per_model.zero();
523 _models[i]->calculateShearStress(
531 _models[i]->calculateEquivalentSlipIncrement(equivalent_slip_increment_per_model);
532 equivalent_slip_increment += equivalent_slip_increment_per_model;
547 elastic_strain *= 0.5;
557 RankFourTensor dfedfpinv, deedfe, dfpinvdpk2, dfpinvdpk2_per_model;
564 dfedfpinv(i, j, k, j) = ffeiginv(i, k);
576 _models[i]->calculateTotalPlasticDeformationGradientDerivative(
577 dfpinvdpk2_per_model,
581 dfpinvdpk2 += dfpinvdpk2_per_model;
617 usingTensorIndices(i_, j_, k_, l_);
628 tan_mod(i, j, i, l) += pk2fet(l, j);
629 tan_mod(i, j, j, l) += fepk2(i, l);
632 tan_mod += dsigdpk2dfe;
642 dfedf(i, j, i, l) = feiginvfpinv(l, j);
644 jacobian_mult = tan_mod * dfedf;
665 _pk2[_qp] =
_pk2[_qp] - step * dpk2;
667 _pk2[_qp] =
_pk2[_qp] + step * dpk2;
678 unsigned int count = 0;
702 _pk2[_qp] =
_pk2[_qp] - step * dpk2;
703 step = 0.5 * (step_b + step_a);
704 _pk2[_qp] =
_pk2[_qp] + step * dpk2;
726 mooseError(
"Line search method is not provided.");
registerMooseObject("SolidMechanicsApp", ComputeMultipleCrystalPlasticityStress)
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
void mooseWarning(Args &&... args)
void mooseError(Args &&... args)
void ErrorVector unsigned int
ComputeCrystalPlasticityEigenstrainBase is the base class for computing eigenstrain tensors in crysta...
ComputeFiniteStrainElasticStress computes the stress following elasticity theory for finite strains.
static InputParameters validParams()
MaterialProperty< RankFourTensor > & _Jacobian_mult
derivative of stress w.r.t. strain (_dstress_dstrain)
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
ComputeMultipleCrystalPlasticityStress (used together with CrystalPlasticityStressUpdateBase) uses th...
void preSolveQp()
Reset the PK2 stress and the inverse deformation gradient to old values and provide an interface for ...
const MaterialProperty< RankTwoTensor > & _crysrot
Crystal rotation in the original, or reference, configuration as defined by Euler angle arguments in ...
void postSolveQp(RankTwoTensor &stress_new, RankFourTensor &jacobian_mult)
Save the final stress and internal variable values after the iterative solve.
const MaterialProperty< RankTwoTensor > & _deformation_gradient
Total deformation gradient RankTwoTensor for the crystal.
void solveStress()
solves for stress, updates plastic deformation gradient.
Real _abs_tol
Stress residual equation absolute tolerance.
void calculateResidual()
Calculate stress residual as the difference between the stored material property PK2 stress and the e...
RankTwoTensor _temporary_deformation_gradient
Helper deformation gradient tensor variables used in iterative solve.
const MaterialProperty< RankTwoTensor > & _pk2_old
unsigned int _maxiter
Maximum number of iterations for stress update.
void calculateJacobian()
Calculates the jacobian as $\mathbf{J} = \mathbf{I} - \mathbf{C} \frac{d\mathbf{E}^e}{d\mathbf{F}^e} ...
TangentModuliType
Type of tangent moduli calculation.
RankTwoTensor _inverse_plastic_deformation_grad_old
static InputParameters validParams()
MaterialProperty< RankTwoTensor > & _plastic_deformation_gradient
Plastic deformation gradient RankTwoTensor for the crystal.
RankTwoTensor _inverse_eigenstrain_deformation_grad
void calcTangentModuli(RankFourTensor &jacobian_mult)
Calculates the tangent moduli for use as a preconditioner, using the elastic or elastic-plastic optio...
enum ComputeMultipleCrystalPlasticityStress::TangentModuliType _tan_mod_type
bool _convergence_failed
Flag to check whether convergence is achieved or if substepping is needed.
bool _use_line_search
Flag to activate line serach.
Real _rtol
Stress residual equation relative tolerance.
bool lineSearchUpdate(const Real &rnorm_prev, const RankTwoTensor &dpk2)
performs the line search update
RankTwoTensor _inverse_plastic_deformation_grad
enum ComputeMultipleCrystalPlasticityStress::LineSearchMethod _line_search_method
RankTwoTensor _temporary_deformation_gradient_old
const MaterialProperty< RankFourTensor > & _elasticity_tensor
Elasticity tensor as defined by a separate class.
const bool _print_convergence_message
Flag to print to console warning messages on stress, constitutive model convergence.
Real _substep_dt
time step size during substepping
MaterialProperty< RankTwoTensor > & _updated_rotation
Tracks the rotation of the crystal during deformation Note: this rotation tensor is not applied to th...
RankTwoTensor _elastic_deformation_gradient
RankFourTensor _jacobian
Jacobian tensor.
MaterialProperty< RankTwoTensor > & _total_lagrangian_strain
Lagrangian total strain measure for the entire crystal.
const unsigned _num_eigenstrains
number of eigenstrains
std::vector< CrystalPlasticityStressUpdateBase * > _models
The user supplied cyrstal plasticity consititutive models.
virtual void computeQpStress() override
Compute the stress and store it in the _stress material property for the current quadrature point.
virtual void initQpStatefulProperties() override
initializes the stateful properties such as PK2 stress, resolved shear stress, plastic deformation gr...
void elasticTangentModuli(RankFourTensor &jacobian_mult)
ComputeMultipleCrystalPlasticityStress(const InputParameters ¶meters)
virtual void initialSetup() override
void solveQp()
Solve the stress and internal state variables (e.g.
MaterialProperty< Real > & _misorientation
Misorientation angle of the crystal during deformation.
unsigned int _line_search_max_iterations
Line search bisection method maximum iteration number.
void solveStateVariables()
Solves the internal variables stress as a function of the slip specified by the constitutive model de...
Real _line_search_tolerance
Line search bisection method tolerance.
void calculateEigenstrainDeformationGrad()
Calculates the deformation gradient due to eigenstrain.
void elastoPlasticTangentModuli(RankFourTensor &jacobian_mult)
Real _min_line_search_step_size
Minimum line search step size.
const MaterialProperty< RankTwoTensor > & _updated_rotation_old
unsigned int _maxiterg
Maximum number of iterations for internal variable update.
void calculateResidualAndJacobian()
Calls the residual and jacobian functions used in the stress update algorithm.
RankTwoTensor _delta_deformation_gradient
Used for substepping; Uniformly divides the increment in deformation gradient.
const MaterialProperty< RankTwoTensor > & _deformation_gradient_old
MaterialProperty< RankTwoTensor > & _pk2
Second Piola-Kirchoff stress measure.
const unsigned _num_models
number of plastic models
RankTwoTensor _residual_tensor
Residual tensor.
unsigned int _max_substep_iter
Maximum number of substep iterations.
const MaterialProperty< RankTwoTensor > & _plastic_deformation_gradient_old
virtual void updateStress(RankTwoTensor &cauchy_stress, RankFourTensor &jacobian_mult)
Updates the stress (PK2) at a quadrature point by calling constiutive relationship as defined in a ch...
std::vector< ComputeCrystalPlasticityEigenstrainBase * > _eigenstrains
The user supplied cyrstal plasticity eigenstrains.
LineSearchMethod
strain formulation
RankFourTensorTempl< T > invSymm() const
static RankFourTensorTempl< T > IdentityFour()
RankFourTensorTempl< T > times(const RankTwoTensorTempl< T > &b) const
T doubleContraction(const RankTwoTensorTempl< T > &a) const
RankTwoTensorTempl< T > inverse() const
void getRUDecompositionRotation(RankTwoTensorTempl< T > &rot) const
RankTwoTensorTempl< T > transpose() const
static RankTwoTensorTempl Identity()
static constexpr std::size_t dim