https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeSimoHughesJ2PlasticityStress Class Referenceabstract

#include <ComputeSimoHughesJ2PlasticityStress.h>

Inheritance diagram for ComputeSimoHughesJ2PlasticityStress:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 ComputeSimoHughesJ2PlasticityStress (const InputParameters &parameters)
 
virtual void initialSetup () override
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void initQpStatefulProperties () override
 
virtual void computeQpPK1Stress () override
 
bool hasGuaranteedMaterialProperty (const MaterialPropertyName &prop, Guarantee guarantee)
 
void returnMappingSolve (const GenericReal< is_ad > &effective_trial_stress, GenericReal< is_ad > &scalar, const ConsoleStream &console)
 Perform the return mapping iterations. More...
 
virtual GenericReal< is_ad > minimumPermissibleValue (const GenericReal< is_ad > &effective_trial_stress) const
 Compute the minimum permissible value of the scalar. More...
 
virtual GenericReal< is_ad > maximumPermissibleValue (const GenericReal< is_ad > &effective_trial_stress) const
 Compute the maximum permissible value of the scalar. More...
 
virtual GenericReal< is_ad > initialGuess (const GenericReal< is_ad > &)
 Compute an initial guess for the value of the scalar. More...
 
virtual GenericReal< is_ad > computeResidual (const GenericReal< is_ad > &, const GenericReal< is_ad > &)=0
 Compute the residual for a predicted value of the scalar. More...
 
virtual GenericReal< is_ad > computeDerivative (const GenericReal< is_ad > &, const GenericReal< is_ad > &)=0
 Compute the derivative of the residual as a function of the scalar variable. More...
 
virtual GenericChainedReal< is_ad > computeResidualAndDerivative (const GenericReal< is_ad > &, const GenericChainedReal< is_ad > &)
 Compute the residual and the derivative for a predicted value of the scalar. More...
 
virtual Real computeReferenceResidual (const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar)=0
 Compute a reference quantity to be used for checking relative convergence. More...
 
virtual void preStep (const GenericReal< is_ad > &, const GenericReal< is_ad > &, const GenericReal< is_ad > &)
 This method is called before taking a step in the return mapping algorithm. More...
 
virtual void iterationFinalize (const GenericReal< is_ad > &)
 Finalize internal state variables for a model for a given iteration. More...
 
virtual void outputIterationSummary (std::stringstream *iter_output, const unsigned int total_it)
 Output summary information for the convergence history of the model. More...
 
virtual void outputIterationStep (std::stringstream *iter_output, const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar, const Real reference_residual)
 Output information for a single iteration step to build the convergence history of the model. More...
 
bool converged (const GenericReal< is_ad > &residual, const Real reference)
 Check to see whether the residual is within the convergence limits. More...
 
virtual Real computeReferenceResidual (const Real &effective_trial_stress, const Real &scalar) override
 The return mapping residual and derivative. More...
 
virtual Real computeResidual (const Real &effective_trial_stress, const Real &scalar) override
 
virtual Real computeDerivative (const Real &effective_trial_stress, const Real &scalar) override
 
virtual void preStep (const Real &scalar_old, const Real &residual, const Real &jacobian) override
 

Protected Attributes

const MaterialPropertyName _elasticity_tensor_name
 
const MaterialProperty< RankFourTensor > & _elasticity_tensor
 
const MaterialProperty< RankTwoTensor > & _F_old
 
const std::string _ep_name
 
MaterialProperty< Real > & _ep
 
const MaterialProperty< Real > & _ep_old
 
MaterialProperty< RankTwoTensor > & _be
 
const MaterialProperty< RankTwoTensor > & _be_old
 
MaterialProperty< RankTwoTensor > & _Np
 
MaterialBase_flow_stress_material
 
const std::string _flow_stress_name
 
const MaterialProperty< Real > & _H
 
const MaterialProperty< Real > & _dH
 
const MaterialProperty< Real > & _d2H
 
bool _check_range
 Whether to check to see whether iterative solution is within admissible range, and set within that range if outside. More...
 
bool _line_search
 Whether to use line searches to improve convergence. More...
 
bool _bracket_solution
 Whether to save upper and lower bounds of root for scalar, and set solution to the midpoint between those bounds if outside them. More...
 

Private Attributes

RankFourTensor _d_be_d_F
 Helper (dummy) variables for iteratively updating the consistant tangent during return mapping. More...
 
RankFourTensor _d_n_d_be
 
RankTwoTensor _d_deltaep_d_betr
 
RankTwoTensor _d_R_d_betr
 
RankTwoTensor _d_J_d_betr
 

Detailed Description

Definition at line 20 of file ComputeSimoHughesJ2PlasticityStress.h.

Constructor & Destructor Documentation

◆ ComputeSimoHughesJ2PlasticityStress()

ComputeSimoHughesJ2PlasticityStress::ComputeSimoHughesJ2PlasticityStress ( const InputParameters parameters)

Definition at line 27 of file ComputeSimoHughesJ2PlasticityStress.C.

30  GuaranteeConsumer(this),
32  _elasticity_tensor_name(_base_name + getParam<MaterialPropertyName>("elasticity_tensor")),
33  _elasticity_tensor(getMaterialProperty<RankFourTensor>(_elasticity_tensor_name)),
34  _F_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "deformation_gradient")),
35  _ep_name(_base_name + "effective_plastic_strain"),
36  _ep(declareProperty<Real>(_ep_name)),
37  _ep_old(getMaterialPropertyOldByName<Real>(_ep_name)),
38  _be(declareProperty<RankTwoTensor>(_base_name +
39  "volume_preserving_elastic_left_cauchy_green_strain")),
40  _be_old(getMaterialPropertyOldByName<RankTwoTensor>(
41  _base_name + "volume_preserving_elastic_left_cauchy_green_strain")),
42  _Np(declareProperty<RankTwoTensor>(_base_name + "flow_direction")),
43  _flow_stress_material(nullptr),
44  _flow_stress_name(_base_name + "flow_stress"),
45  _H(getMaterialPropertyByName<Real>(_flow_stress_name)),
46  _dH(getDefaultMaterialPropertyByName<Real, false>(
48  _d2H(getDefaultMaterialPropertyByName<Real, false>(
50 {
51 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
GuaranteeConsumer(MooseObject *moose_object)
const MaterialProperty< RankTwoTensor > & _be_old
const MaterialProperty< RankTwoTensor > & _F_old
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
SingleVariableReturnMappingSolutionTempl< false > SingleVariableReturnMappingSolution

Member Function Documentation

◆ computeDerivative() [1/2]

Real ComputeSimoHughesJ2PlasticityStress::computeDerivative ( const Real effective_trial_stress,
const Real scalar 
)
overrideprotectedvirtual

Definition at line 166 of file ComputeSimoHughesJ2PlasticityStress.C.

168 {
170 
171  // Update the flow stress
172  _ep[_qp] = _ep_old[_qp] + scalar;
174 
175  return -G * _be[_qp].trace() - _dH[_qp];
176 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
static const std::string G
Definition: NS.h:166
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computePropertiesAtQp(unsigned int qp)

◆ computeDerivative() [2/2]

template<bool is_ad>
virtual GenericReal<is_ad> SingleVariableReturnMappingSolutionTempl< is_ad >::computeDerivative ( const GenericReal< is_ad > &  ,
const GenericReal< is_ad > &   
)
protectedpure virtualinherited

Compute the derivative of the residual as a function of the scalar variable.

The residual should be in strain increment units for all models for consistency.

Parameters
effective_trial_stressEffective trial stress
scalarInelastic strain increment magnitude being solved for

Implemented in LAROMANCEStressUpdateBaseTempl< is_ad >, CompositePowerLawCreepStressUpdateTempl< is_ad >, IsotropicPlasticityStressUpdateTempl< is_ad >, PowerLawCreepStressUpdateTempl< is_ad >, PowerLawCreepTestTempl< is_ad >, and CombinedNonlinearHardeningPlasticityTempl< is_ad >.

◆ computeQpPK1Stress()

void ComputeSimoHughesJ2PlasticityStress::computeQpPK1Stress ( )
overrideprotectedvirtual

Definition at line 72 of file ComputeSimoHughesJ2PlasticityStress.C.

73 {
74  usingTensorIndices(i, j, k, l, m);
77  const auto I = RankTwoTensor::Identity();
78  const auto Fit = _F[_qp].inverse().transpose();
79  const auto detJ = _F[_qp].det();
80 
81  // Update configuration
82  RankTwoTensor f = _inv_df[_qp].inverse();
83  RankTwoTensor f_bar = f / std::cbrt(f.det());
84 
85  // Elastic predictor
86  _be[_qp] = f_bar * _be_old[_qp] * f_bar.transpose();
87  RankTwoTensor s = G * _be[_qp].deviatoric();
88  _Np[_qp] = MooseUtils::absoluteFuzzyEqual(s.norm(), 0) ? std::sqrt(1. / 2.) * I
89  : std::sqrt(3. / 2.) * s / s.norm();
90  Real s_eff = s.doubleContraction(_Np[_qp]);
91 
92  // Compute the derivative of the strain before return mapping
93  if (_fe_problem.currentlyComputingJacobian())
94  _d_be_d_F = _F_old[_qp].inverse().times<l, m, i, j, k, m>(
95  (I.times<i, k, j, l>(f_bar * _be_old[_qp].transpose()) +
96  I.times<j, k, i, l>(f_bar * _be_old[_qp])) /
97  std::cbrt(f.det()) -
98  2. / 3. * _be[_qp].times<i, j, l, k>(_inv_df[_qp]));
99 
100  // Check for plastic loading and do return mapping
101  Real delta_ep = 0;
102  if (computeResidual(s_eff, 0) > 0)
103  {
104  // Initialize the derivative of the internal variable
105  if (_fe_problem.currentlyComputingJacobian())
106  {
109  _d_n_d_be.zero();
110  else
111  _d_n_d_be = G / std::sqrt(6) / s.norm() *
112  (3 * I.times<i, k, j, l>(I) - 2 * _Np[_qp].times<i, j, k, l>(_Np[_qp]) -
113  I.times<i, j, k, l>(I));
114  }
115 
116  returnMappingSolve(s_eff, delta_ep, _console);
117 
118  // Correct the derivative of the strain after return mapping
119  if (_fe_problem.currentlyComputingJacobian())
120  _d_be_d_F -=
121  2. / 3. *
122  (_be[_qp].trace() * _Np[_qp].times<i, j, k, l>(_d_deltaep_d_betr) +
123  delta_ep * _Np[_qp].times<i, j, k, l>(I) + delta_ep * _be[_qp].trace() * _d_n_d_be) *
124  _d_be_d_F;
125  }
126 
127  // Update intermediate and current configurations
128  _ep[_qp] = _ep_old[_qp] + delta_ep;
129  _be[_qp] -= 2. / 3. * delta_ep * _be[_qp].trace() * _Np[_qp];
130  s = G * _be[_qp].deviatoric();
131  RankTwoTensor tau = (K * (detJ * detJ - 1) / 2) * I + s;
132  _pk1_stress[_qp] = tau * Fit;
133 
134  // Compute the consistent tangent, i.e. the derivative of the PK1 stress w.r.t. the deformation
135  // gradient.
136  if (_fe_problem.currentlyComputingJacobian())
137  {
138  RankFourTensor d_tau_d_F = K * detJ * detJ * I.times<i, j, k, l>(Fit) +
139  G * (_d_be_d_F - I.times<i, j, k, l>(I) * _d_be_d_F / 3);
140  _pk1_jacobian[_qp] = Fit.times<m, j, i, m, k, l>(d_tau_d_F) - Fit.times<k, j, i, l>(tau * Fit);
141  }
142 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
static const std::string K
Definition: NS.h:170
void inverse(const std::vector< std::vector< Real >> &m, std::vector< std::vector< Real >> &m_inv)
virtual Real computeResidual(const Real &effective_trial_stress, const Real &scalar) override
static RankTwoTensorTempl Identity()
const MaterialProperty< RankTwoTensor > & _be_old
auto norm() const -> decltype(std::norm(T()))
static const std::string G
Definition: NS.h:166
T getIsotropicBulkModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the bulk modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be i...
void returnMappingSolve(const GenericReal< is_ad > &effective_trial_stress, GenericReal< is_ad > &scalar, const ConsoleStream &console)
Perform the return mapping iterations.
const MaterialProperty< RankTwoTensor > & _F_old
Real f(Real x)
Test function for Brents method.
Real doubleContraction(const RankTwoTensorTempl< Real > &a) const
RankTwoTensorTempl< Real > transpose() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
RankFourTensor _d_be_d_F
Helper (dummy) variables for iteratively updating the consistant tangent during return mapping...
static const std::string k
Definition: NS.h:130

◆ computeReferenceResidual() [1/2]

Real ComputeSimoHughesJ2PlasticityStress::computeReferenceResidual ( const Real effective_trial_stress,
const Real scalar 
)
overrideprotectedvirtual

The return mapping residual and derivative.

Definition at line 145 of file ComputeSimoHughesJ2PlasticityStress.C.

147 {
149  return effective_trial_stress - G * scalar * _be[_qp].trace();
150 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
static const std::string G
Definition: NS.h:166
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ computeReferenceResidual() [2/2]

template<bool is_ad>
virtual Real SingleVariableReturnMappingSolutionTempl< is_ad >::computeReferenceResidual ( const GenericReal< is_ad > &  effective_trial_stress,
const GenericReal< is_ad > &  scalar 
)
protectedpure virtualinherited

Compute a reference quantity to be used for checking relative convergence.

This should be in strain increment units for all models for consistency.

Parameters
effective_trial_stressEffective trial stress
scalarInelastic strain increment magnitude being solved for

Implemented in RadialReturnStressUpdateTempl< is_ad >.

◆ computeResidual() [1/2]

Real ComputeSimoHughesJ2PlasticityStress::computeResidual ( const Real effective_trial_stress,
const Real scalar 
)
overrideprotectedvirtual

Definition at line 153 of file ComputeSimoHughesJ2PlasticityStress.C.

Referenced by computeQpPK1Stress().

155 {
157 
158  // Update the flow stress
159  _ep[_qp] = _ep_old[_qp] + scalar;
161 
162  return effective_trial_stress - G * scalar * _be[_qp].trace() - _H[_qp];
163 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
static const std::string G
Definition: NS.h:166
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computePropertiesAtQp(unsigned int qp)

◆ computeResidual() [2/2]

template<bool is_ad>
virtual GenericReal<is_ad> SingleVariableReturnMappingSolutionTempl< is_ad >::computeResidual ( const GenericReal< is_ad > &  ,
const GenericReal< is_ad > &   
)
protectedpure virtualinherited

Compute the residual for a predicted value of the scalar.

This residual should be in strain increment units for all models for consistency.

Parameters
effective_trial_stressEffective trial stress
scalarInelastic strain increment magnitude being solved for

Implemented in LAROMANCEStressUpdateBaseTempl< is_ad >, IsotropicPlasticityStressUpdateTempl< is_ad >, CompositePowerLawCreepStressUpdateTempl< is_ad >, PowerLawCreepStressUpdateTempl< is_ad >, PowerLawCreepTestTempl< is_ad >, and CombinedNonlinearHardeningPlasticityTempl< is_ad >.

◆ computeResidualAndDerivative()

template<bool is_ad>
virtual GenericChainedReal<is_ad> SingleVariableReturnMappingSolutionTempl< is_ad >::computeResidualAndDerivative ( const GenericReal< is_ad > &  ,
const GenericChainedReal< is_ad > &   
)
inlineprotectedvirtualinherited

Compute the residual and the derivative for a predicted value of the scalar.

This residual should be in strain increment units for all models for consistency.

Parameters
effective_trial_stressEffective trial stress
scalarInelastic strain increment magnitude being solved for

Reimplemented in CompositePowerLawCreepStressUpdateTempl< is_ad >, and PowerLawCreepStressUpdateTempl< is_ad >.

Definition at line 97 of file SingleVariableReturnMappingSolution.h.

99  {
100  mooseError("computeResidualAndDerivative has to be implemented if "
101  "automatic_differentiation_return_mapping = true.");
102  return 0;
103  };
void mooseError(Args &&... args)

◆ converged()

template<bool is_ad>
bool SingleVariableReturnMappingSolutionTempl< is_ad >::converged ( const GenericReal< is_ad > &  residual,
const Real  reference 
)
protectedinherited

Check to see whether the residual is within the convergence limits.

Parameters
residualCurrent value of the residual
referenceCurrent value of the reference quantity
Returns
Whether the model converged

Definition at line 326 of file SingleVariableReturnMappingSolution.C.

328 {
329  const Real residual = MetaPhysicL::raw_value(ad_residual);
330  return (std::abs(residual) <= _absolute_tolerance ||
331  std::abs(residual / reference) <= _relative_tolerance);
332 }
auto raw_value(const Eigen::Map< T > &in)
Real _relative_tolerance
Relative convergence tolerance.
Real _absolute_tolerance
Absolute convergence tolerance.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ hasGuaranteedMaterialProperty()

bool GuaranteeConsumer::hasGuaranteedMaterialProperty ( const MaterialPropertyName &  prop,
Guarantee  guarantee 
)
protectedinherited

Definition at line 28 of file GuaranteeConsumer.C.

Referenced by ComputeFiniteStrainElasticStress::computeQpStress(), ADComputeSmearedCrackingStress::initialSetup(), ComputeSmearedCrackingStress::initialSetup(), ComputeLinearElasticPFFractureStress::initialSetup(), initialSetup(), CriticalTimeStep::initialSetup(), ComputeStVenantKirchhoffStress::initialSetup(), ComputeMultipleInelasticStressBase::initialSetup(), and ADComputeMultipleInelasticStress::initialSetup().

30 {
32  mooseError("hasGuaranteedMaterialProperty() needs to be called in initialSetup()");
33 
34  // Reference to MaterialWarehouse for testing and retrieving block ids
35  const auto & warehouse = _gc_feproblem->getMaterialWarehouse();
36 
37  // Complete set of ids that this object is active
38  const auto & ids = (_gc_block_restrict && _gc_block_restrict->blockRestricted())
41 
42  // Loop over each id for this object
43  for (const auto & id : ids)
44  {
45  // If block materials exist, look if any issue the required guarantee
46  if (warehouse.hasActiveBlockObjects(id))
47  {
48  const std::vector<std::shared_ptr<MaterialBase>> & mats = warehouse.getActiveBlockObjects(id);
49  for (const auto & mat : mats)
50  {
51  const auto & mat_props = mat->getSuppliedItems();
52  if (mat_props.count(prop_name))
53  {
54  auto guarantee_mat = dynamic_cast<GuaranteeProvider *>(mat.get());
55  if (guarantee_mat && !guarantee_mat->hasGuarantee(prop_name, guarantee))
56  {
57  // we found at least one material on the set of block we operate on
58  // that does _not_ provide the requested guarantee
59  return false;
60  }
61  }
62  }
63  }
64  }
65 
66  return true;
67 }
void mooseError(Args &&... args)
Add-on class that provides the functionality to issue guarantees for declared material properties...
BlockRestrictable *const _gc_block_restrict
Access block restrictions of the object with this interface.
virtual const std::set< SubdomainID > & blockIDs() const
virtual bool blockRestricted() const
const MaterialWarehouse & getMaterialWarehouse() const
FEProblemBase *const _gc_feproblem
Reference to the FEProblemBase class.
virtual MooseMesh & mesh() override
virtual bool startedInitialSetup()
const std::set< SubdomainID > & meshSubdomains() const

◆ initialGuess()

template<bool is_ad>
virtual GenericReal<is_ad> SingleVariableReturnMappingSolutionTempl< is_ad >::initialGuess ( const GenericReal< is_ad > &  )
inlineprotectedvirtualinherited

Compute an initial guess for the value of the scalar.

For some cases, an intellegent starting point can provide enhanced robustness in the Newton iterations. This is also an opportunity for classes that derive from this to perform initialization tasks.

Parameters
effective_trial_stressEffective trial stress

Reimplemented in PowerLawCreepTestTempl< is_ad >.

Definition at line 66 of file SingleVariableReturnMappingSolution.h.

67  {
68  return 0.0;
69  }

◆ initialSetup()

void ComputeSimoHughesJ2PlasticityStress::initialSetup ( )
overridevirtual

Definition at line 54 of file ComputeSimoHughesJ2PlasticityStress.C.

55 {
56  _flow_stress_material = &getMaterial("flow_stress_material");
57 
58  // Enforce isotropic elastic tensor
60  mooseError("ComputeSimoHughesJ2PlasticityStress requires an isotropic elasticity tensor");
61 }
void mooseError(Args &&... args)
bool hasGuaranteedMaterialProperty(const MaterialPropertyName &prop, Guarantee guarantee)

◆ initQpStatefulProperties()

void ComputeSimoHughesJ2PlasticityStress::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 64 of file ComputeSimoHughesJ2PlasticityStress.C.

65 {
67  _be[_qp].setToIdentity();
68  _ep[_qp] = 0;
69 }
virtual void initQpStatefulProperties() override
Initialize everything with zeros.

◆ iterationFinalize()

template<bool is_ad>
virtual void SingleVariableReturnMappingSolutionTempl< is_ad >::iterationFinalize ( const GenericReal< is_ad > &  )
inlineprotectedvirtualinherited

Finalize internal state variables for a model for a given iteration.

Parameters
scalarInelastic strain increment magnitude being solved for

Reimplemented in IsotropicPlasticityStressUpdateTempl< is_ad >, and CombinedNonlinearHardeningPlasticityTempl< is_ad >.

Definition at line 128 of file SingleVariableReturnMappingSolution.h.

128 {}

◆ maximumPermissibleValue()

template<bool is_ad>
GenericReal< is_ad > SingleVariableReturnMappingSolutionTempl< is_ad >::maximumPermissibleValue ( const GenericReal< is_ad > &  effective_trial_stress) const
protectedvirtualinherited

Compute the maximum permissible value of the scalar.

For some models, the magnitude of this may be known.

Parameters
effective_trial_stressEffective trial stress

Reimplemented in RadialReturnStressUpdateTempl< is_ad >, LAROMANCEStressUpdateBaseTempl< is_ad >, and PowerLawCreepTestTempl< is_ad >.

Definition at line 92 of file SingleVariableReturnMappingSolution.C.

94 {
95  return std::numeric_limits<Real>::max();
96 }

◆ minimumPermissibleValue()

template<bool is_ad>
GenericReal< is_ad > SingleVariableReturnMappingSolutionTempl< is_ad >::minimumPermissibleValue ( const GenericReal< is_ad > &  effective_trial_stress) const
protectedvirtualinherited

Compute the minimum permissible value of the scalar.

For some models, the magnitude of this may be known.

Parameters
effective_trial_stressEffective trial stress

Reimplemented in RadialReturnStressUpdateTempl< is_ad >, and PowerLawCreepTestTempl< is_ad >.

Definition at line 84 of file SingleVariableReturnMappingSolution.C.

86 {
87  return std::numeric_limits<Real>::lowest();
88 }

◆ outputIterationStep()

template<bool is_ad>
void SingleVariableReturnMappingSolutionTempl< is_ad >::outputIterationStep ( std::stringstream *  iter_output,
const GenericReal< is_ad > &  effective_trial_stress,
const GenericReal< is_ad > &  scalar,
const Real  reference_residual 
)
protectedvirtualinherited

Output information for a single iteration step to build the convergence history of the model.

Parameters
iter_outputOutput stream
effective_trial_stressEffective trial stress
residualCurrent value of the residual
referenceCurrent value of the reference quantity

Reimplemented in LAROMANCEStressUpdateBaseTempl< is_ad >.

Definition at line 419 of file SingleVariableReturnMappingSolution.C.

Referenced by LAROMANCEStressUpdateBaseTempl< is_ad >::outputIterationStep().

424 {
425  if (iter_output)
426  {
427  const unsigned int it = _iteration;
428  const Real residual = MetaPhysicL::raw_value(_residual);
429 
430  *iter_output << " iteration=" << it
431  << " trial_stress=" << MetaPhysicL::raw_value(effective_trial_stress)
432  << " scalar=" << MetaPhysicL::raw_value(scalar) << " residual=" << residual
433  << " ref_res=" << reference_residual
434  << " rel_res=" << std::abs(residual) / reference_residual
435  << " rel_tol=" << _relative_tolerance << " abs_res=" << std::abs(residual)
436  << " abs_tol=" << _absolute_tolerance << '\n';
437  }
438 }
auto raw_value(const Eigen::Map< T > &in)
Real _relative_tolerance
Relative convergence tolerance.
Real _absolute_tolerance
Absolute convergence tolerance.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ outputIterationSummary()

template<bool is_ad>
void SingleVariableReturnMappingSolutionTempl< is_ad >::outputIterationSummary ( std::stringstream *  iter_output,
const unsigned int  total_it 
)
protectedvirtualinherited

Output summary information for the convergence history of the model.

Parameters
iter_outputOutput stream
total_itTotal iteration count

Reimplemented in RadialReturnStressUpdateTempl< is_ad >, LAROMANCEStressUpdateBaseTempl< is_ad >, and ADViscoplasticityStressUpdate.

Definition at line 442 of file SingleVariableReturnMappingSolution.C.

Referenced by ADViscoplasticityStressUpdate::outputIterationSummary(), LAROMANCEStressUpdateBaseTempl< is_ad >::outputIterationSummary(), and RadialReturnStressUpdateTempl< is_ad >::outputIterationSummary().

444 {
445  if (iter_output)
446  *iter_output << "In " << total_it << " iterations the residual went from "
448  << MetaPhysicL::raw_value(_residual) << " in '" << _svrms_name << "'."
449  << std::endl;
450 }
auto raw_value(const Eigen::Map< T > &in)
GenericReal< is_ad > _initial_residual
Residual values, kept as members to retain solver state for summary outputting.
const std::string _svrms_name
MOOSE input name of the object performing the solve.

◆ preStep() [1/2]

void ComputeSimoHughesJ2PlasticityStress::preStep ( const Real scalar_old,
const Real residual,
const Real jacobian 
)
overrideprotectedvirtual

Definition at line 179 of file ComputeSimoHughesJ2PlasticityStress.C.

180 {
181  if (!_fe_problem.currentlyComputingJacobian())
182  return;
183 
184  const auto I = RankTwoTensor::Identity();
186 
187  // Update the flow stress
188  _ep[_qp] = _ep_old[_qp] + scalar;
190 
191  _d_R_d_betr =
192  G * _Np[_qp] - G * scalar * I - (G * _be[_qp].trace() + _dH[_qp]) * _d_deltaep_d_betr;
193  _d_J_d_betr = -G * I - _d2H[_qp] * _d_deltaep_d_betr;
194  _d_deltaep_d_betr += -1 / J * _d_R_d_betr + R / J / J * _d_J_d_betr;
195 }
const MaterialProperty< RankFourTensor > & _elasticity_tensor
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
static RankTwoTensorTempl Identity()
static const std::string G
Definition: NS.h:166
static const std::string R
Definition: NS.h:162
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computePropertiesAtQp(unsigned int qp)

◆ preStep() [2/2]

template<bool is_ad>
virtual void SingleVariableReturnMappingSolutionTempl< is_ad >::preStep ( const GenericReal< is_ad > &  ,
const GenericReal< is_ad > &  ,
const GenericReal< is_ad > &   
)
inlineprotectedvirtualinherited

This method is called before taking a step in the return mapping algorithm.

A typical use case is to accumulate the exact algorithmic tangent during return mapping.

Definition at line 118 of file SingleVariableReturnMappingSolution.h.

121  {
122  }

◆ returnMappingSolve()

template<bool is_ad>
void SingleVariableReturnMappingSolutionTempl< is_ad >::returnMappingSolve ( const GenericReal< is_ad > &  effective_trial_stress,
GenericReal< is_ad > &  scalar,
const ConsoleStream console 
)
protectedinherited

Perform the return mapping iterations.

Parameters
effective_trial_stressEffective trial stress
scalarInelastic strain increment magnitude being solved for
consoleConsole output

Definition at line 100 of file SingleVariableReturnMappingSolution.C.

Referenced by ADViscoplasticityStressUpdate::computeInelasticStrainIncrement(), and computeQpPK1Stress().

104 {
105  // construct the stringstream here only if the debug level is set to ALL
106  std::unique_ptr<std::stringstream> iter_output =
108  ? std::make_unique<std::stringstream>()
109  : nullptr;
110 
111  // do the internal solve and capture iteration info during the first round
112  // iff full history output is requested regardless of whether the solve failed or succeeded
113  auto solve_state =
114  internalSolve(effective_trial_stress,
115  scalar,
116  _internal_solve_full_iteration_history ? iter_output.get() : nullptr);
117  if (solve_state != SolveState::SUCCESS &&
119  {
120  // output suppressed by user, throw immediately
122  mooseException("");
123 
124  // user expects some kind of output, if necessary setup output stream now
125  if (!iter_output)
126  iter_output = std::make_unique<std::stringstream>();
127 
128  // add the appropriate error message to the output
129  switch (solve_state)
130  {
131  case SolveState::NAN_INF:
132  *iter_output << "Encountered inf or nan in material return mapping iterations.\n";
133  break;
134 
136  *iter_output << "Exceeded maximum iterations in material return mapping iterations.\n";
137  break;
138 
139  default:
140  mooseError("Unhandled solver state");
141  }
142 
143  // if full history output is only requested for failed solves we have to repeat
144  // the solve a second time
146  internalSolve(effective_trial_stress, scalar, iter_output.get());
147 
148  // Append summary and throw exception
149  outputIterationSummary(iter_output.get(), _iteration);
150  mooseException(iter_output->str());
151  }
152 
154  {
155  // the solve did not fail but the user requested debug output anyways
156  outputIterationSummary(iter_output.get(), _iteration);
157  console << iter_output->str() << std::flush;
158  }
159 }
void mooseError(Args &&... args)
SolveState internalSolve(const GenericReal< is_ad > effective_trial_stress, GenericReal< is_ad > &scalar, std::stringstream *iter_output=nullptr)
Method called from within this class to perform the actual return mappping iterations.
const bool _internal_solve_full_iteration_history
Whether to output iteration information all the time (regardless of whether iterations converge) ...
virtual void outputIterationSummary(std::stringstream *iter_output, const unsigned int total_it)
Output summary information for the convergence history of the model.
enum SingleVariableReturnMappingSolutionTempl::InternalSolveOutput _internal_solve_output_on

◆ validParams()

InputParameters ComputeSimoHughesJ2PlasticityStress::validParams ( )
static

Definition at line 15 of file ComputeSimoHughesJ2PlasticityStress.C.

16 {
19  params.addClassDescription("The Simo-Hughes style J2 plasticity.");
20  params.addParam<MaterialPropertyName>(
21  "elasticity_tensor", "elasticity_tensor", "The name of the elasticity tensor.");
22  params.addRequiredParam<MaterialName>("flow_stress_material",
23  "The material defining the flow stress");
24  return params;
25 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _be

MaterialProperty<RankTwoTensor>& ComputeSimoHughesJ2PlasticityStress::_be
protected

◆ _be_old

const MaterialProperty<RankTwoTensor>& ComputeSimoHughesJ2PlasticityStress::_be_old
protected

Definition at line 54 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress().

◆ _bracket_solution

template<bool is_ad>
bool SingleVariableReturnMappingSolutionTempl< is_ad >::_bracket_solution
protectedinherited

Whether to save upper and lower bounds of root for scalar, and set solution to the midpoint between those bounds if outside them.

Definition at line 145 of file SingleVariableReturnMappingSolution.h.

◆ _check_range

template<bool is_ad>
bool SingleVariableReturnMappingSolutionTempl< is_ad >::_check_range
protectedinherited

Whether to check to see whether iterative solution is within admissible range, and set within that range if outside.

Definition at line 138 of file SingleVariableReturnMappingSolution.h.

Referenced by ADViscoplasticityStressUpdate::ADViscoplasticityStressUpdate(), LAROMANCEStressUpdateBaseTempl< is_ad >::LAROMANCEStressUpdateBaseTempl(), and PowerLawCreepTestTempl< is_ad >::PowerLawCreepTestTempl().

◆ _d2H

const MaterialProperty<Real>& ComputeSimoHughesJ2PlasticityStress::_d2H
protected

Definition at line 61 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by preStep().

◆ _d_be_d_F

RankFourTensor ComputeSimoHughesJ2PlasticityStress::_d_be_d_F
private

Helper (dummy) variables for iteratively updating the consistant tangent during return mapping.

Definition at line 65 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress().

◆ _d_deltaep_d_betr

RankTwoTensor ComputeSimoHughesJ2PlasticityStress::_d_deltaep_d_betr
private

Definition at line 67 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress(), and preStep().

◆ _d_J_d_betr

RankTwoTensor ComputeSimoHughesJ2PlasticityStress::_d_J_d_betr
private

Definition at line 69 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by preStep().

◆ _d_n_d_be

RankFourTensor ComputeSimoHughesJ2PlasticityStress::_d_n_d_be
private

Definition at line 66 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress().

◆ _d_R_d_betr

RankTwoTensor ComputeSimoHughesJ2PlasticityStress::_d_R_d_betr
private

Definition at line 68 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by preStep().

◆ _dH

const MaterialProperty<Real>& ComputeSimoHughesJ2PlasticityStress::_dH
protected

Definition at line 60 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeDerivative(), and preStep().

◆ _elasticity_tensor

const MaterialProperty<RankFourTensor>& ComputeSimoHughesJ2PlasticityStress::_elasticity_tensor
protected

◆ _elasticity_tensor_name

const MaterialPropertyName ComputeSimoHughesJ2PlasticityStress::_elasticity_tensor_name
protected

Definition at line 46 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by initialSetup().

◆ _ep

MaterialProperty<Real>& ComputeSimoHughesJ2PlasticityStress::_ep
protected

◆ _ep_name

const std::string ComputeSimoHughesJ2PlasticityStress::_ep_name
protected

◆ _ep_old

const MaterialProperty<Real>& ComputeSimoHughesJ2PlasticityStress::_ep_old
protected

◆ _F_old

const MaterialProperty<RankTwoTensor>& ComputeSimoHughesJ2PlasticityStress::_F_old
protected

Definition at line 49 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress().

◆ _flow_stress_material

MaterialBase* ComputeSimoHughesJ2PlasticityStress::_flow_stress_material
protected

◆ _flow_stress_name

const std::string ComputeSimoHughesJ2PlasticityStress::_flow_stress_name
protected

Definition at line 58 of file ComputeSimoHughesJ2PlasticityStress.h.

◆ _H

const MaterialProperty<Real>& ComputeSimoHughesJ2PlasticityStress::_H
protected

Definition at line 59 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeResidual().

◆ _line_search

template<bool is_ad>
bool SingleVariableReturnMappingSolutionTempl< is_ad >::_line_search
protectedinherited

Whether to use line searches to improve convergence.

Definition at line 141 of file SingleVariableReturnMappingSolution.h.

◆ _Np

MaterialProperty<RankTwoTensor>& ComputeSimoHughesJ2PlasticityStress::_Np
protected

Definition at line 55 of file ComputeSimoHughesJ2PlasticityStress.h.

Referenced by computeQpPK1Stress(), and preStep().


The documentation for this class was generated from the following files: