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")),
101 _base_name +
"crysrot")),
102 _print_convergence_message(getParam<bool>(
"print_state_variable_convergence_error_messages"))
115 (*_eigenstrain_deformation_gradient)[
_qp].zero();
116 (*_eigenstrain_deformation_gradient)[
_qp].addIa(1.0);
135 _models[i]->initQpStatefulProperties();
149 std::vector<MaterialName> model_names =
150 getParam<std::vector<MaterialName>>(
"crystal_plasticity_models");
164 " is not compatible with ComputeMultipleCrystalPlasticityStress");
168 std::vector<MaterialName> eigenstrain_names =
169 getParam<std::vector<MaterialName>>(
"eigenstrain_names");
180 mooseError(
"Eigenstrain" + eigenstrain_names[i] +
181 " is not compatible with ComputeMultipleCrystalPlasticityStress");
191 _models[i]->setMaterialVectorSize();
209 unsigned int substep_iter = 1;
210 unsigned int num_substep = 1;
240 for (
unsigned int istep = 0; istep < num_substep; ++istep)
252 "The crystal plasticity constitutive model has failed to converge. Increasing " 253 "the number of substeps.");
262 mooseException(
"ComputeMultipleCrystalPlasticityStress: Constitutive failure");
272 _models[i]->setInitialConstitutiveVariableValues();
283 _models[i]->setSubstepConstitutiveVariableValues();
284 _models[i]->calculateSlipResistance();
294 _models[i]->updateSubstepConstitutiveVariableValues();
323 unsigned int iteration;
324 bool iter_flag =
true;
342 _models[i]->cacheStateVariablesBeforeUpdate();
345 _models[i]->calculateStateVariableEvolutionRateComponent();
348 if (!
_models[i]->updateStateVariables())
352 _models[i]->calculateSlipResistance();
361 if (!
_models[i]->areConstitutiveStateVariablesConverged())
373 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: State variables (or the system " 374 "resistance) did not converge at element ",
381 }
while (iter_flag && iteration <
_maxiterg);
387 "ComputeMultipleCrystalPlasticityStress: Hardness Integration error. Reached the " 388 "maximum number of iterations to solve for the state variables at element ",
401 unsigned int iteration = 0;
403 Real rnorm, rnorm0, rnorm_prev;
410 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: the slip increment exceeds tolerance " 435 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: the slip increment exceeds tolerance " 450 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: Failed with line search");
465 mooseWarning(
"ComputeMultipleCrystalPlasticityStress: Stress Integration error rmax = ",
467 " and the tolerance is ",
469 " when the rnorm0 value is ",
493 RankTwoTensor ce, elastic_strain, ce_pk2, equivalent_slip_increment_per_model,
494 equivalent_slip_increment, pk2_new;
496 equivalent_slip_increment.
zero();
501 equivalent_slip_increment_per_model.
zero();
504 _models[i]->calculateShearStress(
512 _models[i]->calculateEquivalentSlipIncrement(equivalent_slip_increment_per_model);
513 equivalent_slip_increment += equivalent_slip_increment_per_model;
528 elastic_strain *= 0.5;
538 RankFourTensor dfedfpinv, deedfe, dfpinvdpk2, dfpinvdpk2_per_model;
545 dfedfpinv(i,
j,
k,
j) = ffeiginv(i,
k);
557 _models[i]->calculateTotalPlasticDeformationGradientDerivative(
558 dfpinvdpk2_per_model,
562 dfpinvdpk2 += dfpinvdpk2_per_model;
598 usingTensorIndices(i_, j_, k_, l_);
609 tan_mod(i,
j, i, l) += pk2fet(l,
j);
610 tan_mod(i,
j,
j, l) += fepk2(i, l);
613 tan_mod += dsigdpk2dfe;
623 dfedf(i,
j, i, l) = feiginvfpinv(l,
j);
625 jacobian_mult = tan_mod * dfedf;
659 unsigned int count = 0;
684 step = 0.5 * (step_b + step_a);
707 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()
void mooseWarning(Args &&... args) const
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
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
IntRange< T > make_range(T beg, T end)
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 ...