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");
182 mooseError(
"Eigenstrain" + eigenstrain_names[i] +
183 " is not compatible with ComputeMultipleCrystalPlasticityStress");
193 _models[i]->setMaterialVectorSize();
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;
678 unsigned int count = 0;
703 step = 0.5 * (step_b + step_a);
726 mooseError(
"Line search method is not provided.");
const MaterialProperty< RankTwoTensor > & _pk2_old
void solveStateVariables()
Solves the internal variables stress as a function of the slip specified by the constitutive model de...
MaterialProperty< RankFourTensor > & _Jacobian_mult
derivative of stress w.r.t. strain (_dstress_dstrain)
virtual void computeQpStress() override
Compute the stress and store it in the _stress material property for the current quadrature point...
MaterialProperty< RankTwoTensor > & _total_lagrangian_strain
Lagrangian total strain measure for the entire crystal.
RankTwoTensorTempl< Real > inverse() const
void postSolveQp(RankTwoTensor &stress_new, RankFourTensor &jacobian_mult)
Save the final stress and internal variable values after the iterative solve.
RankTwoTensor _temporary_deformation_gradient
Helper deformation gradient tensor variables used in iterative solve.
Real _line_search_tolerance
Line search bisection method tolerance.
static InputParameters validParams()
void calculateEigenstrainDeformationGrad()
Calculates the deformation gradient due to eigenstrain.
bool _convergence_failed
Flag to check whether convergence is achieved or if substepping is needed.
static InputParameters validParams()
void calculateResidual()
Calculate stress residual as the difference between the stored material property PK2 stress and the e...
static RankFourTensorTempl< Real > IdentityFour()
registerMooseObject("SolidMechanicsApp", ComputeMultipleCrystalPlasticityStress)
bool _use_line_search
Flag to activate line serach.
unsigned int _maxiter
Maximum number of iterations for stress update.
ComputeCrystalPlasticityEigenstrainBase is the base class for computing eigenstrain tensors in crysta...
ComputeMultipleCrystalPlasticityStress(const InputParameters ¶meters)
static constexpr std::size_t dim
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...
RankTwoTensor _residual_tensor
Residual tensor.
const unsigned _num_models
number of plastic models
virtual bool isBoundaryMaterial() const override
static RankTwoTensorTempl Identity()
const MaterialProperty< RankTwoTensor > & _crysrot
Crystal rotation in the original, or reference, configuration as defined by Euler angle arguments in ...
LineSearchMethod
strain formulation
bool lineSearchUpdate(const Real &rnorm_prev, const RankTwoTensor &dpk2)
performs the line search update
virtual void initQpStatefulProperties() override
initializes the stateful properties such as PK2 stress, resolved shear stress, plastic deformation gr...
enum ComputeMultipleCrystalPlasticityStress::LineSearchMethod _line_search_method
void calculateJacobian()
Calculates the jacobian as ${J} = {I} - {C} {d{E}^e}{d{F}^e} {d{F}^e}{d{F}^P^{-1}} {d{F}^P^{-1}}{d{PK...
Real _substep_dt
time step size during substepping
const MaterialProperty< RankTwoTensor > & _deformation_gradient
Total deformation gradient RankTwoTensor for the crystal.
RankFourTensor _jacobian
Jacobian tensor.
void elastoPlasticTangentModuli(RankFourTensor &jacobian_mult)
Real _min_line_search_step_size
Minimum line search step size.
void addIa(const Real &a)
MaterialProperty< RankTwoTensor > & _pk2
Second Piola-Kirchoff stress measure.
RankTwoTensor _temporary_deformation_gradient_old
Real doubleContraction(const RankTwoTensorTempl< Real > &a) const
const unsigned _num_eigenstrains
number of eigenstrains
RankTwoTensor _elastic_deformation_gradient
void elasticTangentModuli(RankFourTensor &jacobian_mult)
Real _abs_tol
Stress residual equation absolute tolerance.
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-")
RankTwoTensor _inverse_eigenstrain_deformation_grad
ComputeFiniteStrainElasticStress computes the stress following elasticity theory for finite strains...
const MaterialProperty< RankFourTensor > & _elasticity_tensor
Elasticity tensor as defined by a separate class.
MaterialBase & getMaterialByName(const std::string &name, bool no_warn=false, bool no_dep=false)
unsigned int _line_search_max_iterations
Line search bisection method maximum iteration number.
MaterialProperty< RankTwoTensor > & _updated_rotation
Tracks the rotation of the crystal during deformation Note: this rotation tensor is not applied to th...
unsigned int _max_substep_iter
Maximum number of substep iterations.
RankTwoTensorTempl< Real > transpose() const
MaterialProperty< RankTwoTensor > & _plastic_deformation_gradient
Plastic deformation gradient RankTwoTensor for the crystal.
RankTwoTensor _inverse_plastic_deformation_grad
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
enum ComputeMultipleCrystalPlasticityStress::TangentModuliType _tan_mod_type
const MaterialProperty< RankTwoTensor > & _updated_rotation_old
std::vector< CrystalPlasticityStressUpdateBase * > _models
The user supplied cyrstal plasticity consititutive models.
unsigned int _maxiterg
Maximum number of iterations for internal variable update.
RankFourTensorTempl< Real > times(const RankTwoTensorTempl< Real > &b) const
const MaterialProperty< RankTwoTensor > & _deformation_gradient_old
const MaterialProperty< RankTwoTensor > & _plastic_deformation_gradient_old
void mooseWarning(Args &&... args) const
IntRange< T > make_range(T beg, T end)
MaterialProperty< Real > & _misorientation
Misorientation angle of the crystal during deformation.
void getRUDecompositionRotation(RankTwoTensorTempl< Real > &rot) const
void mooseError(Args &&... args) const
std::vector< ComputeCrystalPlasticityEigenstrainBase * > _eigenstrains
The user supplied cyrstal plasticity eigenstrains.
TangentModuliType
Type of tangent moduli calculation.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
void calculateResidualAndJacobian()
Calls the residual and jacobian functions used in the stress update algorithm.
void solveQp()
Solve the stress and internal state variables (e.g.
ComputeMultipleCrystalPlasticityStress (used together with CrystalPlasticityStressUpdateBase) uses th...
void solveStress()
solves for stress, updates plastic deformation gradient.
const bool _print_convergence_message
Flag to print to console warning messages on stress, constitutive model convergence.
RankFourTensorTempl< T > invSymm() const
void calcTangentModuli(RankFourTensor &jacobian_mult)
Calculates the tangent moduli for use as a preconditioner, using the elastic or elastic-plastic optio...
virtual void initialSetup() override
RankTwoTensor _delta_deformation_gradient
Used for substepping; Uniformly divides the increment in deformation gradient.
Real _rtol
Stress residual equation relative tolerance.
static const std::string k
void ErrorVector unsigned int
const Elem *const & _current_elem
RankTwoTensor _inverse_plastic_deformation_grad_old
void preSolveQp()
Reset the PK2 stress and the inverse deformation gradient to old values and provide an interface for ...