11#include "petscblaslapack.h"
25 params.
addParam<Real>(
"rtol", 1e-6,
"Constitutive stress residue relative tolerance");
26 params.
addParam<Real>(
"abs_tol", 1e-6,
"Constitutive stress residue absolute tolerance");
28 "stol", 1e-2,
"Constitutive slip system resistance relative residual tolerance");
30 "zero_tol", 1e-12,
"Tolerance for residual check when variable value is zero");
31 params.
addParam<
unsigned int>(
"maxiter", 100,
"Maximum number of iterations for stress update");
33 "maxiter_state_variable", 100,
"Maximum number of iterations for state variable update");
34 MooseEnum tan_mod_options(
"exact none",
"none");
37 "Type of tangent moduli for preconditioner: default elastic");
39 "maximum_substep_iteration", 1,
"Maximum number of substep iteration");
40 params.
addParam<
bool>(
"use_line_search",
false,
"Use line search in constitutive update");
41 params.
addParam<Real>(
"min_line_search_step_size", 0.01,
"Minimum line search step size");
42 params.
addParam<Real>(
"line_search_tol", 0.5,
"Line search bisection method tolerance");
44 "line_search_maxiter", 20,
"Line search bisection method maximum number of iteration");
45 MooseEnum line_search_method(
"CUT_HALF BISECTION",
"CUT_HALF");
47 "line_search_method", line_search_method,
"The method used in line search");
50 "List of names of user objects that define the slip rates for this material.");
52 "uo_slip_resistances",
53 "List of names of user objects that define the slip resistances for this material.");
56 "List of names of user objects that define the state variable for this material.");
58 "uo_state_var_evol_rate_comps",
59 "List of names of user objects that define the state "
60 "variable evolution rate components for this material.");
66 _num_uo_slip_rates(parameters.get<
std::vector<UserObjectName>>(
"uo_slip_rates").size()),
67 _num_uo_slip_resistances(
68 parameters.get<
std::vector<UserObjectName>>(
"uo_slip_resistances").size()),
69 _num_uo_state_vars(parameters.get<
std::vector<UserObjectName>>(
"uo_state_vars").size()),
70 _num_uo_state_var_evol_rate_comps(
71 parameters.get<
std::vector<UserObjectName>>(
"uo_state_var_evol_rate_comps").size()),
72 _rtol(getParam<Real>(
"rtol")),
73 _abs_tol(getParam<Real>(
"abs_tol")),
74 _stol(getParam<Real>(
"stol")),
75 _zero_tol(getParam<Real>(
"zero_tol")),
76 _maxiter(getParam<unsigned
int>(
"maxiter")),
77 _maxiterg(getParam<unsigned
int>(
"maxiter_state_variable")),
78 _tan_mod_type(getParam<
MooseEnum>(
"tan_mod_type")),
79 _max_substep_iter(getParam<unsigned
int>(
"maximum_substep_iteration")),
80 _use_line_search(getParam<bool>(
"use_line_search")),
81 _min_lsrch_step(getParam<Real>(
"min_line_search_step_size")),
82 _lsrch_tol(getParam<Real>(
"line_search_tol")),
83 _lsrch_max_iter(getParam<unsigned
int>(
"line_search_maxiter")),
84 _lsrch_method(getParam<
MooseEnum>(
"line_search_method")),
94 _update_rot_old(getMaterialPropertyOld<
RankTwoTensor>(
"update_rot")),
95 _elasticity_tensor_name(_base_name +
"elasticity_tensor"),
96 _elasticity_tensor(getMaterialPropertyByName<
RankFourTensor>(_elasticity_tensor_name)),
97 _deformation_gradient(getMaterialProperty<
RankTwoTensor>(
"deformation_gradient")),
98 _deformation_gradient_old(getMaterialPropertyOld<
RankTwoTensor>(
"deformation_gradient")),
129 _uo_slip_rates[i] = &getUserObjectByName<CrystalPlasticitySlipRate>(
130 parameters.
get<std::vector<UserObjectName>>(
"uo_slip_rates")[i]);
132 parameters.
get<std::vector<UserObjectName>>(
"uo_slip_rates")[i]);
134 parameters.
get<std::vector<UserObjectName>>(
"uo_slip_rates")[i] +
"_flow_direction");
140 parameters.
get<std::vector<UserObjectName>>(
"uo_slip_resistances")[i]);
142 parameters.
get<std::vector<UserObjectName>>(
"uo_slip_resistances")[i]);
147 _uo_state_vars[i] = &getUserObjectByName<CrystalPlasticityStateVariable>(
148 parameters.
get<std::vector<UserObjectName>>(
"uo_state_vars")[i]);
150 parameters.
get<std::vector<UserObjectName>>(
"uo_state_vars")[i]);
152 parameters.
get<std::vector<UserObjectName>>(
"uo_state_vars")[i]);
158 parameters.
get<std::vector<UserObjectName>>(
"uo_state_var_evol_rate_comps")[i]);
160 parameters.
get<std::vector<UserObjectName>>(
"uo_state_var_evol_rate_comps")[i]);
194 _fp[_qp].setToIdentity();
211 if (isBoundaryMaterial())
214 unsigned int substep_iter = 1;
216 unsigned int num_substep = 1;
239 for (
unsigned int istep = 0; istep < num_substep; ++istep)
254 throw MooseException(
"FiniteStrainUObasedCP: Constitutive failure.");
316 bool iter_flag =
true;
342 mooseWarning(
"FiniteStrainUObasedCP: Hardness Integration error\n");
356 for (
unsigned j = 0; j < n; j++)
387 unsigned int iter = 0;
389 Real rnorm, rnorm0, rnorm_prev;
396 mooseWarning(
"FiniteStrainUObasedCP: Slip increment exceeds tolerance - Element number ",
419 mooseWarning(
"FiniteStrainUObasedCP: Slip increment exceeds tolerance - Element number ",
433 mooseWarning(
"FiniteStrainUObasedCP: Failed with line search");
448 mooseWarning(
"FiniteStrainUObasedCP: Stress Integration error rmax = ",
450 " and the tolerance is ",
452 " when the rnorm0 value is ",
523 for (
unsigned int j = 0; j <
_uo_slip_rates[i]->variableSize(); ++j)
527 eqv_slip_incr = iden - eqv_slip_incr;
554 deedfe(i, j, k, i) = deedfe(i, j, k, i) +
_fe(k, j) * 0.5;
555 deedfe(i, j, k, j) = deedfe(i, j, k, j) +
_fe(k, i) * 0.5;
561 std::vector<RankTwoTensor> dtaudpk2(nss), dfpinvdslip(nss);
562 std::vector<Real> dslipdtau;
563 dslipdtau.resize(nss);
565 for (
unsigned int j = 0; j < nss; j++)
569 dfpinvdpk2 += (dfpinvdslip[j] * dslipdtau[j] *
_substep_dt).outerProduct(dtaudpk2[j]);
601 deedfe(i, j, k, i) = deedfe(i, j, k, i) +
_fe(k, j) * 0.5;
602 deedfe(i, j, k, j) = deedfe(i, j, k, j) +
_fe(k, i) * 0.5;
605 usingTensorIndices(i_, j_, k_, l_);
615 tan_mod(i, j, i, l) += pk2fet(l, j);
616 tan_mod(i, j, j, l) += fepk2(i, l);
619 tan_mod += dsigdpk2dfe;
628 dfedf(i, j, i, l) =
_fp_inv(l, j);
652 _pk2[_qp] =
_pk2[_qp] - step * dpk2;
654 _pk2[_qp] =
_pk2[_qp] + step * dpk2;
666 unsigned int count = 0;
682 if ((rnorm1 / rnorm0) <
_lsrch_tol || s_a * s_b > 0)
690 _pk2[_qp] =
_pk2[_qp] - step * dpk2;
691 step = 0.5 * (step_b + step_a);
692 _pk2[_qp] =
_pk2[_qp] + step * dpk2;
715 mooseError(
"Line search method is not provided.");
registerMooseObject("SolidMechanicsApp", FiniteStrainUObasedCP)
void mooseWarning(Args &&... args)
void mooseError(Args &&... args)
void ErrorVector unsigned int
MaterialProperty< RankFourTensor > & _Jacobian_mult
derivative of stress w.r.t. strain (_dstress_dstrain)
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
ComputeStressBase is the base class for stress tensors computed from MOOSE's strain calculators.
static InputParameters validParams()
FiniteStrainUObasedCP uses the multiplicative decomposition of deformation gradient and solves the PK...
std::vector< const CrystalPlasticitySlipRate * > _uo_slip_rates
User objects that define the slip rate.
RankFourTensor _jac
Jacobian tensor.
MaterialProperty< RankTwoTensor > & _lag_e
virtual void postSolveStress()
update stress and plastic deformation gradient after solve.
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_state_vars
State variable material property.
virtual void postSolveQp()
update stress and internal variable after solve.
virtual void calcResidual()
calculate stress residual.
virtual void solveStress()
solves for stress, updates plastic deformation gradient.
const MaterialProperty< RankTwoTensor > & _crysrot
Crystal rotation.
std::vector< std::vector< Real > > _state_vars_old
Local state variable.
virtual void getSlipRates()
updates the slip rates.
static InputParameters validParams()
MaterialProperty< RankTwoTensor > & _update_rot
virtual void computeQpStress()
updates the stress at a quadrature point.
unsigned int _num_uo_slip_resistances
Number of slip resistance user objects.
virtual void calcJacobian()
calculate jacobian.
const MaterialProperty< RankFourTensor > & _elasticity_tensor
Elasticity tensor material property.
virtual void calcResidJacob()
calls the residual and jacobian functions used in the stress update algorithm.
virtual void elastoPlasticTangentModuli()
calculate the exact tangent moduli for preconditioner.
unsigned int _maxiterg
Maximum number of iterations for internal variable update.
virtual void preSolveStatevar()
set variables for internal variable solve.
std::vector< const CrystalPlasticityStateVarRateComponent * > _uo_state_var_evol_rate_comps
User objects that define the state variable evolution rate component.
RankTwoTensor _delta_dfgrd
Used for substepping; Uniformly divides the increment in deformation gradient.
virtual void calcTangentModuli()
calculate the tangent moduli for preconditioner.
unsigned int _max_substep_iter
Maximum number of substep iterations.
virtual void solveStatevar()
solve internal variables.
bool _err_tol
Flag to check whether convergence is achieved.
const MaterialProperty< RankTwoTensor > & _fp_old
MooseEnum _lsrch_method
Line search method.
Real _min_lsrch_step
Minimum line search step size.
RankTwoTensor _dfgrd_tmp_old
const MaterialProperty< RankTwoTensor > & _pk2_old
MooseEnum _tan_mod_type
Type of tangent moduli calculation.
std::vector< const MaterialProperty< std::vector< Real > > * > _mat_prop_state_vars_old
Old state variable material property.
MaterialProperty< RankTwoTensor > & _pk2
RankTwoTensor _fp_old_inv
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_slip_rates
Slip rates material property.
std::vector< MaterialProperty< std::vector< RankTwoTensor > > * > _flow_direction
Real _rtol
Stress residual equation relative tolerance.
virtual void preSolveQp()
set variables for stress and internal variable solve.
const MaterialProperty< RankTwoTensor > & _deformation_gradient_old
virtual bool isStateVariablesConverged()
evaluates convergence of state variables.
std::vector< std::vector< Real > > _state_vars_prev
Local old state variable.
virtual void updateSlipSystemResistanceAndStateVariable()
updates the slip system resistances and state variables.
bool _use_line_search
Flag to activate line serach.
Real _substep_dt
Current substep size.
std::vector< const CrystalPlasticitySlipResistance * > _uo_slip_resistances
User objects that define the slip resistance.
std::vector< const CrystalPlasticityStateVariable * > _uo_state_vars
User objects that define the state variable.
const MaterialProperty< RankTwoTensor > & _deformation_gradient
virtual void postSolveStatevar()
update internal variable after solve.
bool lineSearchUpdate(const Real rnorm_prev, const RankTwoTensor)
performs the line search update
unsigned int _num_uo_state_vars
Number of state variable user objects.
virtual void preSolveStress()
set variables for stress solve.
virtual void solveQp()
solve stress and internal variables.
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_slip_resistances
Slip resistance material property.
std::vector< MaterialProperty< std::vector< Real > > * > _mat_prop_state_var_evol_rate_comps
State variable evolution rate component material property.
Real _lsrch_tol
Line search bisection method tolerance.
Real _zero_tol
Residual tolerance when variable value is zero. Default 1e-12.
std::vector< std::vector< Real > > _state_vars_old_stored
Local stored state variable (for sub-stepping)
virtual void elasticTangentModuli()
calculate the elastic tangent moduli for preconditioner.
Real _abs_tol
Stress residual equation absolute tolerance.
MaterialProperty< RankTwoTensor > & _fp
unsigned int _num_uo_slip_rates
Number of slip rate user objects.
RankTwoTensor _resid
Residual tensor.
virtual void initQpStatefulProperties()
initializes the stateful properties such as stress, plastic deformation gradient, slip system resista...
unsigned int _maxiter
Maximum number of iterations for stress update.
Real _stol
Internal variable update equation tolerance.
FiniteStrainUObasedCP(const InputParameters ¶meters)
unsigned int _lsrch_max_iter
Line search bisection method maximum iteration number.
unsigned int _num_uo_state_var_evol_rate_comps
Number of state variable evolution rate component user objects.
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 constexpr std::size_t dim