- cohesionA TensorMechanicsHardening UserObject that defines hardening of the cohesion
C++ Type:UserObjectName
Description:A TensorMechanicsHardening UserObject that defines hardening of the cohesion
 - dilation_angleA TensorMechanicsHardening UserObject that defines hardening of the dilation angle (in radians)
C++ Type:UserObjectName
Description:A TensorMechanicsHardening UserObject that defines hardening of the dilation angle (in radians)
 - friction_angleA TensorMechanicsHardening UserObject that defines hardening of the friction angle (in radians)
C++ Type:UserObjectName
Description:A TensorMechanicsHardening UserObject that defines hardening of the friction angle (in radians)
 - internal_constraint_toleranceThe Newton-Raphson process is only deemed converged if the internal constraint is less than this.
C++ Type:double
Description:The Newton-Raphson process is only deemed converged if the internal constraint is less than this.
 - yield_function_toleranceIf the yield function is less than this amount, the (stress, internal parameter) are deemed admissible.
C++ Type:double
Description:If the yield function is less than this amount, the (stress, internal parameter) are deemed admissible.
 
TensorMechanicsPlasticMohrCoulombMulti
The TensorMechanicsPlasticMohrCoulombMulti has not been documented. The content listed below should be used as a starting point for documenting the class, which includes the typical automatic documentation associated with a MooseObject; however, what is contained is ultimately determined by what is necessary to make the documentation clear for users.
Non-associative Mohr-Coulomb plasticity with hardening/softening
Overview
Example Input File Syntax
Input Parameters
- execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM.
Default:TIMESTEP_END
C++ Type:ExecFlagEnum
Options:NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM
Description:The list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM.
 - max_iterations10Maximum number of Newton-Raphson iterations allowed in the custom return-map algorithm. For highly nonlinear hardening this may need to be higher than 10.
Default:10
C++ Type:unsigned int
Options:
Description:Maximum number of Newton-Raphson iterations allowed in the custom return-map algorithm. For highly nonlinear hardening this may need to be higher than 10.
 - shiftYield surface is shifted by this amount to avoid problems with defining derivatives when eigenvalues are equal. If this is larger than f_tol, a warning will be issued. This may be set very small when using the custom returnMap. Default = f_tol.
C++ Type:double
Options:
Description:Yield surface is shifted by this amount to avoid problems with defining derivatives when eigenvalues are equal. If this is larger than f_tol, a warning will be issued. This may be set very small when using the custom returnMap. Default = f_tol.
 - use_custom_returnMapTrueUse a custom return-map algorithm for this plasticity model, which may speed up computations considerably. Set to true only for isotropic elasticity with no hardening of the dilation angle. In this case you may set 'shift' very small.
Default:True
C++ Type:bool
Options:
Description:Use a custom return-map algorithm for this plasticity model, which may speed up computations considerably. Set to true only for isotropic elasticity with no hardening of the dilation angle. In this case you may set 'shift' very small.
 
Optional Parameters
- allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
Default:False
C++ Type:bool
Options:
Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
 - control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Options:
Description:Adds user-defined labels for accessing object parameters via control logic.
 - enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Options:
Description:Set the enabled status of the MooseObject.
 - force_preauxFalseForces the GeneralUserObject to be executed in PREAUX
Default:False
C++ Type:bool
Options:
Description:Forces the GeneralUserObject to be executed in PREAUX
 - force_preicFalseForces the GeneralUserObject to be executed in PREIC during initial setup
Default:False
C++ Type:bool
Options:
Description:Forces the GeneralUserObject to be executed in PREIC during initial setup
 - use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Options:
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
 
Advanced Parameters
Input Files
- (modules/tensor_mechanics/test/tests/mohr_coulomb/uni_axial2_planar.i)
 - (modules/tensor_mechanics/test/tests/multi/paper3.i)
 - (modules/tensor_mechanics/test/tests/jacobian/cto15.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/random_planar.i)
 - (modules/tensor_mechanics/test/tests/notched_plastic_block/biaxial_planar.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard4.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar3.i)
 - (modules/tensor_mechanics/test/tests/multi/special_rock1.i)
 - (modules/tensor_mechanics/test/tests/jacobian/cto14.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar1.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard2.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard1.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/uni_axial3_planar.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard5.i)
 - (modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard3.i)
 - (modules/tensor_mechanics/test/tests/notched_plastic_block/cmc_planar.i)
 
(modules/tensor_mechanics/test/tests/mohr_coulomb/uni_axial2_planar.i)
# same as uni_axial2 but with planar mohr-coulomb
[Mesh]
  type = FileMesh
  file = quarter_hole.e
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./zmin_zzero]
    type = DirichletBC
    variable = disp_z
    boundary = 'zmin'
    value = '0'
  [../]
  [./xmin_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin'
    value = '0'
  [../]
  [./ymin_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin'
    value = '0'
  [../]
  [./ymax_disp]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'ymax'
    function = '-1E-4*t'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_zz
  [../]
  [./f]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./coh]
    type = TensorMechanicsHardeningConstant
    value = 1E7
  [../]
  [./fric]
    type = TensorMechanicsHardeningConstant
    value = 2
    convert_to_radians = true
  [../]
  [./dil]
    type = TensorMechanicsHardeningConstant
    value = 2
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = coh
    friction_angle = fric
    dilation_angle = dil
    yield_function_tolerance = 1.0 # THIS IS HIGHER THAN THE SMOOTH CASE TO AVOID PRECISION-LOSS PROBLEMS!
    shift = 1.0
    internal_constraint_tolerance = 1E-9
    use_custom_returnMap = false
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 1
    fill_method = symmetric_isotropic
    C_ijkl = '0 5E9' # young = 10Gpa, poisson = 0.0
  [../]
  [./strain]
    type = ComputeIncrementalSmallStrain
    block = 1
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 1
    ep_plastic_tolerance = 1E-9
    plastic_models = mc
    max_NR_iterations = 100
    deactivation_scheme = 'safe'
    min_stepsize = 1
    max_stepsize_for_dumb = 1
    debug_fspb = crash
  [../]
[]
# Preconditioning and Executioner options kindly provided by Andrea
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  end_time = 0.5
  dt = 0.1
  solve_type = NEWTON
  type = Transient
[]
[Outputs]
  file_base = uni_axial2_planar
  [./exodus]
    type = Exodus
    hide = 'stress_xx stress_xy stress_xz stress_yy stress_yz stress_zz yield_fcn s_xx s_xy s_xz s_yy s_yz s_zz f'
  [../]
  [./csv]
    type = CSV
    interval = 1
  [../]
[]
(modules/tensor_mechanics/test/tests/multi/paper3.i)
# This runs the third example models described in the 'MultiSurface' plasticity paper
# Just change the deactivation_scheme
#
# Plasticity models:
# Mohr-Coulomb with cohesion = 40MPa, friction angle = 35deg, dilation angle = 5deg
# Tensile with strength = 1MPa
# WeakPlaneTensile with strength = 1000Pa
# WeakPlaneShear with cohesion = 0.1MPa and friction angle = 25, dilation angle = 5deg
#
# Lame lambda = 1.2GPa.  Lame mu = 1.2GPa (Young = 3GPa, poisson = 0.5)
#
# A line of elements is perturbed randomly, and return to the yield surface at each quadpoint is checked
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1000
  ny = 125
  nz = 1
  xmin = 0
  xmax = 1000
  ymin = 0
  ymax = 125
  zmin = 0
  zmax = 1
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[GlobalParams]
  volumetric_locking_correction=true
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[ICs]
  [./x]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_x
  [../]
  [./y]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_y
  [../]
  [./z]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_z
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '0'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '0'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./linesearch]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ld]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./constr_added]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./linesearch]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = linesearch
  [../]
  [./ld]
    type = MaterialRealAux
    property = plastic_linear_dependence_encountered
    variable = ld
  [../]
  [./constr_added]
    type = MaterialRealAux
    property = plastic_constraints_added
    variable = constr_added
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
[]
[Postprocessors]
  [./max_iter]
    type = ElementExtremeValue
    variable = iter
    outputs = console
  [../]
  [./av_iter]
    type = ElementAverageValue
    variable = iter
    outputs = 'console csv'
  [../]
  [./av_linesearch]
    type = ElementAverageValue
    variable = linesearch
    outputs = 'console csv'
  [../]
  [./av_ld]
    type = ElementAverageValue
    variable = ld
    outputs = 'console csv'
  [../]
  [./av_constr_added]
    type = ElementAverageValue
    variable = constr_added
    outputs = 'console csv'
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 4E7
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1.0
    shift = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./mc_smooth]
    type = TensorMechanicsPlasticMohrCoulomb
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    mc_tip_smoother = 4E6
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./ts]
    type = TensorMechanicsHardeningConstant
    value = 1E6
  [../]
  [./tensile]
    type = TensorMechanicsPlasticTensileMulti
    tensile_strength = ts
    yield_function_tolerance = 1.0
    shift = 1.0
    internal_constraint_tolerance = 1.0E-7
    use_custom_returnMap = false
    use_custom_cto = false
  [../]
  [./tensile_smooth]
    type = TensorMechanicsPlasticTensile
    tensile_strength = ts
    tensile_tip_smoother = 1E5
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./wpt_str]
    type = TensorMechanicsHardeningConstant
    value = 1.0E3
  [../]
  [./wpt]
    type = TensorMechanicsPlasticWeakPlaneTensile
    tensile_strength = wpt_str
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./wps_c]
    type = TensorMechanicsHardeningConstant
    value = 1.0E5
  [../]
  [./wps_tan_phi]
    type = TensorMechanicsHardeningConstant
    value = 0.466
  [../]
  [./wps_tan_psi]
    type = TensorMechanicsHardeningConstant
    value = 0.087
  [../]
  [./wps]
    type = TensorMechanicsPlasticWeakPlaneShear
    cohesion = wps_c
    tan_friction_angle = wps_tan_phi
    tan_dilation_angle = wps_tan_psi
    smoother = 1.0E4
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '1.2E9 1.2E9'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./multi]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-7
    plastic_models = 'tensile_smooth mc_smooth wpt wps'
    max_NR_iterations = 30
    specialIC = 'none'
    deactivation_scheme = 'optimized'
    min_stepsize = 1E-6
    max_stepsize_for_dumb = 1E-2
    debug_fspb = crash
    debug_jac_at_stress = '10 0 0 0 10 0 0 0 10'
    debug_jac_at_pm = '1 1 1 1'
    debug_jac_at_intnl = '1 1 1 1'
    debug_stress_change = 1E1
    debug_pm_change = '1E-6 1E-6 1E-6 1E-6'
    debug_intnl_change = '1E-6 1E-6 1E-6 1E-6'
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = paper3
  exodus = false
  csv = true
[]
(modules/tensor_mechanics/test/tests/jacobian/cto15.i)
# Jacobian check for nonlinear, multi-surface plasticity
# This returns to the edge of Mohr Coulomb.
# This is a very nonlinear test and a delicate test because it perturbs around
# an edge of the yield function where some derivatives are not well defined
#
# Plasticity models:
# Mohr-Coulomb with cohesion = 40MPa, friction angle = 35deg, dilation angle = 5deg
# Tensile with strength = 1MPa
#
# Lame lambda = 1GPa.  Lame mu = 1.3GPa
#
# NOTE: The yield function tolerances here are set at 100-times what i would usually use
# This is because otherwise the test fails on the 'pearcey' architecture.
# This is because identical stress tensors yield slightly different eigenvalues
# (and hence return-map residuals) on 'pearcey' than elsewhere, which results in
# a different number of NR iterations are needed to return to the yield surface.
# This is presumably because of compiler internals, or the BLAS routines being
# optimised differently or something similar.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./linesearch]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ld]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./constr_added]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int3]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int4]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int5]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int6]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int7]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int8]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int0]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./linesearch]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = linesearch
  [../]
  [./ld]
    type = MaterialRealAux
    property = plastic_linear_dependence_encountered
    variable = ld
  [../]
  [./constr_added]
    type = MaterialRealAux
    property = plastic_constraints_added
    variable = constr_added
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./int0]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int0
    index = 0
  [../]
  [./int1]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int1
    index = 1
  [../]
  [./int2]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int2
    index = 2
  [../]
  [./int3]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int3
    index = 3
  [../]
  [./int4]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int4
    index = 4
  [../]
  [./int5]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int5
    index = 5
  [../]
  [./int6]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int6
    index = 6
  [../]
  [./int7]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int7
    index = 7
  [../]
  [./int8]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int8
    index = 8
  [../]
[]
[Postprocessors]
  [./max_int0]
    type = ElementExtremeValue
    variable = int0
    outputs = console
  [../]
  [./max_int1]
    type = ElementExtremeValue
    variable = int1
    outputs = console
  [../]
  [./max_int2]
    type = ElementExtremeValue
    variable = int2
    outputs = console
  [../]
  [./max_int3]
    type = ElementExtremeValue
    variable = int3
    outputs = console
  [../]
  [./max_int4]
    type = ElementExtremeValue
    variable = int4
    outputs = console
  [../]
  [./max_int5]
    type = ElementExtremeValue
    variable = int5
    outputs = console
  [../]
  [./max_int6]
    type = ElementExtremeValue
    variable = int6
    outputs = console
  [../]
  [./max_int7]
    type = ElementExtremeValue
    variable = int7
    outputs = console
  [../]
  [./max_int8]
    type = ElementExtremeValue
    variable = int8
    outputs = console
  [../]
  [./max_iter]
    type = ElementExtremeValue
    variable = iter
    outputs = console
  [../]
  [./av_linesearch]
    type = ElementAverageValue
    variable = linesearch
    outputs = 'console csv'
  [../]
  [./av_ld]
    type = ElementAverageValue
    variable = ld
    outputs = 'console csv'
  [../]
  [./av_constr_added]
    type = ElementAverageValue
    variable = constr_added
    outputs = 'console csv'
  [../]
  [./av_iter]
    type = ElementAverageValue
    variable = iter
    outputs = 'console csv'
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 4E1
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1.0E-4  # Note larger value
    shift = 1.0E-4                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./ts]
    type = TensorMechanicsHardeningConstant
    value = 1E2
  [../]
  [./tensile]
    type = TensorMechanicsPlasticTensileMulti
    tensile_strength = ts
    yield_function_tolerance = 1.0E-4  # Note larger value
    shift = 1.0E-4                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '1.0E3 1.3E3'
  [../]
  [./strain]
    type = ComputeIncrementalSmallStrain
    displacements = 'disp_x disp_y disp_z'
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '100.1 0.1 -0.2  0.1 0.9 0  -0.2 0 1.1'
    eigenstrain_name = ini_stress
  [../]
  [./multi]
    type = ComputeMultiPlasticityStress
    ep_plastic_tolerance = 1E-7
    plastic_models = 'tensile mc'
    max_NR_iterations = 5
    specialIC = 'rock'
    deactivation_scheme = 'safe'
    min_stepsize = 1
    max_stepsize_for_dumb = 1
    tangent_operator = nonlinear
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it -snes_type'
    petsc_options_value = 'bcgs bjacobi 1E-15 1E-10 10000 test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  end_time = 1
[]
[Outputs]
  file_base = cto15
  exodus = false
  csv = true
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/random_planar.i)
# apply many random large deformations, checking that the algorithm returns correctly to
# the yield surface each time.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 100
  ny = 1250
  nz = 1
  xmin = 0
  xmax = 100
  ymin = 0
  ymax = 1250
  zmin = 0
  zmax = 1
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[ICs]
  [./x]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_x
  [../]
  [./y]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_y
  [../]
  [./z]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_z
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '0'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '0'
  [../]
[]
[AuxVariables]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
[]
[Postprocessors]
  [./yield_fcn_at_zero]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn
    outputs = 'console'
  [../]
  [./should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_fcn
  [../]
  [./av_iter]
    type = ElementAverageValue
    variable = iter
    outputs = 'console'
  [../]
[]
[Functions]
  [./should_be_zero_fcn]
    type = ParsedFunction
    value = 'if(a<1E-3,0,a)'
    vars = 'a'
    vals = 'yield_fcn_at_zero'
  [../]
[]
[UserObjects]
  [./coh]
    type = TensorMechanicsHardeningCubic
    value_0 = 1000
    value_residual = 100
    internal_limit = 4
  [../]
  [./phi]
    type = TensorMechanicsHardeningCubic
    value_0 = 0.8
    value_residual = 0.3
    internal_limit = 2
  [../]
  [./psi]
    type = TensorMechanicsHardeningConstant
    value = 15
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    yield_function_tolerance = 1E-3
    shift = 1E-10
    internal_constraint_tolerance = 1E-6
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0.7E7 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-10
    plastic_models = mc
    min_stepsize = 1
    max_stepsize_for_dumb = 1
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = random_planar
  exodus = false
  [./csv]
    type = CSV
    [../]
[]
(modules/tensor_mechanics/test/tests/notched_plastic_block/biaxial_planar.i)
# Uses non-smoothed Mohr-Coulomb (via ComputeMultiPlasticityStress and TensorMechanicsPlasticMohrCoulombMulti) to simulate the following problem.
# A cubical block is notched around its equator.
# All of its outer surfaces have roller BCs, but the notched region is free to move as needed
# The block is initialised with a high hydrostatic tensile stress
# Without the notch, the BCs do not allow contraction of the block, and this stress configuration is admissible
# With the notch, however, the interior parts of the block are free to move in order to relieve stress, and this causes plastic failure
# The top surface is then pulled upwards (the bottom is fixed because of the roller BCs)
# This causes more failure
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 9
    ny = 9
    nz = 9
    xmin = 0
    xmax = 0.1
    ymin = 0
    ymax = 0.1
    zmin = 0
    zmax = 0.1
  []
  [block_to_remove_xmin]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 -0.01 0.045'
    top_right = '0.01 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = generated_mesh
  []
  [block_to_remove_xmax]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '0.09 -0.01 0.045'
    top_right = '0.11 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_xmin
  []
  [block_to_remove_ymin]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 -0.01 0.045'
    top_right = '0.11 0.01 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_xmax
  []
  [block_to_remove_ymax]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 0.09 0.045'
    top_right = '0.11 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_ymin
  []
  [remove_block]
    type = BlockDeletionGenerator
    block = 1
    input = block_to_remove_ymax
  []
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Modules/TensorMechanics/Master]
  [./all]
    add_variables = true
    incremental = true
    generate_output = 'max_principal_stress mid_principal_stress min_principal_stress stress_zz'
    eigenstrain_names = ini_stress
  [../]
[]
[Postprocessors]
  [./uz]
    type = PointValue
    point = '0 0 0.1'
    use_displaced_mesh = false
    variable = disp_z
  [../]
  [./s_zz]
    type = ElementAverageValue
    use_displaced_mesh = false
    variable = stress_zz
  [../]
  [./num_res]
    type = NumResidualEvaluations
  [../]
  [./nr_its]
    type = ElementAverageValue
    variable = num_iters
  [../]
  [./max_nr_its]
    type = ElementExtremeValue
    variable = num_iters
  [../]
  [./runtime]
    type = PerfGraphData
    data_type = TOTAL
    section_name = 'Root'
  [../]
[]
[BCs]
  # back=zmin, front=zmax, bottom=ymin, top=ymax, left=xmin, right=xmax
  [./xmin_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0.0
  [../]
  [./xmax_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = right
    value = 0.0
  [../]
  [./ymin_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0.0
  [../]
  [./ymax_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = top
    value = 0.0
  [../]
  [./zmin_zzero]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = '0'
  [../]
  [./zmax_disp]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = '1E-6*max(t,0)'
  [../]
[]
[AuxVariables]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./plastic_strain]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./num_iters]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./plastic_strain_aux]
    type = MaterialRankTwoTensorAux
    i = 2
    j = 2
    property = plastic_strain
    variable = plastic_strain
  [../]
  [./num_iters_auxk] # cannot use plastic_NR_iterations directly as this is zero, since no NR iterations are actually used, since we use a custom algorithm to do the return
    type = ParsedAux
    args = plastic_strain
    function = 'if(plastic_strain>0,1,0)'
    variable = num_iters
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 5E6
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 10
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1E-5
    internal_constraint_tolerance = 1E-11
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeIsotropicElasticityTensor
    youngs_modulus = 16E9
    poissons_ratio = 0.25
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    ep_plastic_tolerance = 1E-11
    plastic_models = mc
    max_NR_iterations = 1000
    debug_fspb = crash
  [../]
  [./strain_from_initial_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '6E6 0 0  0 6E6 0  0 0 6E6'
    eigenstrain_name = ini_stress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  start_time = -1
  end_time = 10
  dt = 1
  solve_type = NEWTON
  type = Transient
  l_tol = 1E-2
  nl_abs_tol = 1E-5
  nl_rel_tol = 1E-7
  l_max_its = 200
  nl_max_its = 400
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
[]
[Outputs]
  file_base = biaxial_planar
  perf_graph = true
  exodus = false
  csv = true
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard4.i)
# apply repeated stretches in x direction, and smaller stretches along the y and z directions,
# so that sigma_II = sigma_III,
# which means that lode angle = -30deg.
# Both return to the edge (at lode_angle=-30deg, ie 000101) and tip are experienced.
#
# It is checked that the yield functions are less than their tolerance values
# It is checked that the cohesion hardens correctly
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '0.05E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0.05E-6*y*t'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z*t'
  [../]
[]
[Functions]
  [./should_be_zero_fcn]
    type = ParsedFunction
    value = 'if((a<1E-5)&(b<1E-5)&(c<1E-5)&(d<1E-5)&(g<1E-5)&(h<1E-5),0,abs(a)+abs(b)+abs(c)+abs(d)+abs(g)+abs(h))'
    vars = 'a b c d g h'
    vals = 'f0 f1 f2 f3 f4 f5'
  [../]
  [./coh_analytic]
    type = ParsedFunction
    value = '20-10*exp(-1E5*intnl)'
    vars = intnl
    vals = internal
  [../]
  [./coh_from_yieldfcns]
    type = ParsedFunction
    value = '(f0+f1-(sxx+syy)*sin(phi))/(-2)/cos(phi)'
    vars = 'f0 f1 sxx syy phi'
    vals = 'f0 f1 s_xx s_yy 0.8726646'
  [../]
  [./should_be_zero_coh]
    type = ParsedFunction
    value = 'if(abs(a-b)<1E-6,0,1E6*abs(a-b))'
    vars = 'a b'
    vals = 'Coh_analytic Coh_moose'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn0]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn3]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn4]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn5]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn0]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn0
  [../]
  [./yield_fcn1]
    type = MaterialStdVectorAux
    index = 1
    property = plastic_yield_function
    variable = yield_fcn1
  [../]
  [./yield_fcn2]
    type = MaterialStdVectorAux
    index = 2
    property = plastic_yield_function
    variable = yield_fcn2
  [../]
  [./yield_fcn3]
    type = MaterialStdVectorAux
    index = 3
    property = plastic_yield_function
    variable = yield_fcn3
  [../]
  [./yield_fcn4]
    type = MaterialStdVectorAux
    index = 4
    property = plastic_yield_function
    variable = yield_fcn4
  [../]
  [./yield_fcn5]
    type = MaterialStdVectorAux
    index = 5
    property = plastic_yield_function
    variable = yield_fcn5
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./internal]
    type = PointValue
    point = '0 0 0'
    variable = mc_int
  [../]
  [./f0]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn0
  [../]
  [./f1]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn1
  [../]
  [./f2]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn2
  [../]
  [./f3]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn3
  [../]
  [./f4]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn4
  [../]
  [./f5]
   type = PointValue
    point = '0 0 0'
    variable = yield_fcn5
  [../]
  [./yfcns_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_fcn
  [../]
  [./Coh_analytic]
    type = FunctionValuePostprocessor
    function = coh_analytic
  [../]
  [./Coh_moose]
    type = FunctionValuePostprocessor
    function = coh_from_yieldfcns
  [../]
  [./cohesion_difference_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_coh
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningExponential
    value_0 = 10
    value_residual = 20
    rate = 1E5
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 0.8726646
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 1 #0.8726646 # 50deg
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    use_custom_returnMap = true
    yield_function_tolerance = 1E-5
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-12
    plastic_models = mc
  [../]
[]
[Executioner]
  end_time = 10
  dt = 2
  type = Transient
[]
[Outputs]
  file_base = planar_hard4
  exodus = false
  [./csv]
    type = CSV
    hide = 'f0 f1 f2 f3 f4 f5 s_xy s_xz s_yz Coh_analytic Coh_moose'
    execute_on = 'timestep_end'
  [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar3.i)
# apply repeated stretches in x z directions, and smaller stretches along the y direction,
# so that sigma_I = sigma_II,
# which means that lode angle = 30deg.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '1E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0.25E-6*y*sin(t)'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1.1E-6*z*t'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./f]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = f
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./f]
    type = PointValue
    point = '0 0 0'
    variable = f
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
[]
[UserObjects]
  [./coh]
    type = TensorMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = TensorMechanicsHardeningConstant
    value = 0.9
  [../]
  [./psi]
    type = TensorMechanicsHardeningConstant
    value = 0.1
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    yield_function_tolerance = 1E-8
    shift = 1E-8
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-9
    plastic_models = mc
    deactivation_scheme = safe
    max_NR_iterations = 3
    min_stepsize = 1
    max_stepsize_for_dumb = 1
    debug_fspb = crash
    debug_jac_at_stress = '10 5 2 5 11 -1 2 -1 12'
    debug_jac_at_pm = '1 1 1 1 1 1'
    debug_jac_at_intnl = 1
    debug_stress_change = 1E-5
    debug_pm_change = '1E-6 1E-6 1E-6 1E-6 1E-6 1E-6'
    debug_intnl_change = 1E-6
  [../]
[]
[Executioner]
  end_time = 10
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar3
  exodus = false
  [./csv]
    type = CSV
    [../]
[]
(modules/tensor_mechanics/test/tests/multi/special_rock1.i)
# Plasticity models:
# Mohr-Coulomb with cohesion = 40MPa, friction angle = 35deg, dilation angle = 5deg
# Tensile with strength = 1MPa
#
# Lame lambda = 1GPa.  Lame mu = 1.3GPa
#
# A line of elements is perturbed randomly, and return to the yield surface at each quadpoint is checked
#
# NOTE: The yield function tolerances here are set at 100-times what i would usually use
# This is because otherwise the test fails on the 'pearcey' architecture.
# This is because identical stress tensors yield slightly different eigenvalues
# (and hence return-map residuals) on 'pearcey' than elsewhere, which results in
# a different number of NR iterations are needed to return to the yield surface.
# This is presumably because of compiler internals, or the BLAS routines being
# optimised differently or something similar.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1000
  ny = 125
  nz = 1
  xmin = 0
  xmax = 1000
  ymin = 0
  ymax = 125
  zmin = 0
  zmax = 1
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[GlobalParams]
  volumetric_locking_correction=true
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[ICs]
  [./x]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_x
  [../]
  [./y]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_y
  [../]
  [./z]
    type = RandomIC
    min = -0.1
    max = 0.1
    variable = disp_z
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '0'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '0'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./linesearch]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ld]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./constr_added]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./linesearch]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = linesearch
  [../]
  [./ld]
    type = MaterialRealAux
    property = plastic_linear_dependence_encountered
    variable = ld
  [../]
  [./constr_added]
    type = MaterialRealAux
    property = plastic_constraints_added
    variable = constr_added
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
[]
[Postprocessors]
  [./max_iter]
    type = ElementExtremeValue
    variable = iter
    outputs = console
  [../]
  [./av_linesearch]
    type = ElementAverageValue
    variable = linesearch
    outputs = 'console csv'
  [../]
  [./av_ld]
    type = ElementAverageValue
    variable = ld
    outputs = 'console csv'
  [../]
  [./av_constr_added]
    type = ElementAverageValue
    variable = constr_added
    outputs = 'console csv'
  [../]
  [./av_iter]
    type = ElementAverageValue
    variable = iter
    outputs = 'console csv'
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 4E7
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    use_custom_returnMap = false
    yield_function_tolerance = 1.0E+2  # Note larger value
    shift = 1.0E+2                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./mc_smooth]
    type = TensorMechanicsPlasticMohrCoulomb
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    mc_tip_smoother = 4E6
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./ts]
    type = TensorMechanicsHardeningConstant
    value = 1E6
  [../]
  [./tensile]
    type = TensorMechanicsPlasticTensileMulti
    tensile_strength = ts
    yield_function_tolerance = 1.0E+2  # Note larger value
    shift = 1.0E+2                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
    use_custom_returnMap = false
    use_custom_cto = false
  [../]
  [./tensile_smooth]
    type = TensorMechanicsPlasticTensile
    tensile_strength = ts
    tensile_tip_smoother = 1E5
    yield_function_tolerance = 1.0
    internal_constraint_tolerance = 1.0E-7
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '1.0E9 1.3E9'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./multi]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-5  # Note larger value, to match the larger yield_function_tolerances
    plastic_models = 'tensile mc'
    max_NR_iterations = 5
    specialIC = 'rock'
    deactivation_scheme = 'safe'
    min_stepsize = 1
    max_stepsize_for_dumb = 1
    debug_fspb = crash
    debug_jac_at_stress = '10 0 0 0 10 0 0 0 10'
    debug_jac_at_pm = '1 1 1 1'
    debug_jac_at_intnl = '1 1 1 1'
    debug_stress_change = 1E1
    debug_pm_change = '1E-6 1E-6 1E-6 1E-6'
    debug_intnl_change = '1E-6 1E-6 1E-6 1E-6'
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = special_rock1
  exodus = false
  csv = true
[]
(modules/tensor_mechanics/test/tests/jacobian/cto14.i)
# Jacobian check for nonlinear, multi-surface plasticity.
# Returns to an edge of the tensile yield surface
# This is a very nonlinear test and a delicate test because it perturbs around
# an edge of the yield function where some derivatives are not well defined
#
# Plasticity models:
# Mohr-Coulomb with cohesion = 40MPa, friction angle = 35deg, dilation angle = 5deg
# Tensile with strength = 1MPa
#
# Lame lambda = 1GPa.  Lame mu = 1.3GPa
#
# NOTE: The yield function tolerances here are set at 100-times what i would usually use
# This is because otherwise the test fails on the 'pearcey' architecture.
# This is because identical stress tensors yield slightly different eigenvalues
# (and hence return-map residuals) on 'pearcey' than elsewhere, which results in
# a different number of NR iterations are needed to return to the yield surface.
# This is presumably because of compiler internals, or the BLAS routines being
# optimised differently or something similar.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./linesearch]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ld]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./constr_added]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int3]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int4]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int5]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int6]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int7]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int8]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./int0]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./linesearch]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = linesearch
  [../]
  [./ld]
    type = MaterialRealAux
    property = plastic_linear_dependence_encountered
    variable = ld
  [../]
  [./constr_added]
    type = MaterialRealAux
    property = plastic_constraints_added
    variable = constr_added
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./int0]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int0
    index = 0
  [../]
  [./int1]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int1
    index = 1
  [../]
  [./int2]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int2
    index = 2
  [../]
  [./int3]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int3
    index = 3
  [../]
  [./int4]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int4
    index = 4
  [../]
  [./int5]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int5
    index = 5
  [../]
  [./int6]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int6
    index = 6
  [../]
  [./int7]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int7
    index = 7
  [../]
  [./int8]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    variable = int8
    index = 8
  [../]
[]
[Postprocessors]
  [./max_int0]
    type = ElementExtremeValue
    variable = int0
    outputs = console
  [../]
  [./max_int1]
    type = ElementExtremeValue
    variable = int1
    outputs = console
  [../]
  [./max_int2]
    type = ElementExtremeValue
    variable = int2
    outputs = console
  [../]
  [./max_int3]
    type = ElementExtremeValue
    variable = int3
    outputs = console
  [../]
  [./max_int4]
    type = ElementExtremeValue
    variable = int4
    outputs = console
  [../]
  [./max_int5]
    type = ElementExtremeValue
    variable = int5
    outputs = console
  [../]
  [./max_int6]
    type = ElementExtremeValue
    variable = int6
    outputs = console
  [../]
  [./max_int7]
    type = ElementExtremeValue
    variable = int7
    outputs = console
  [../]
  [./max_int8]
    type = ElementExtremeValue
    variable = int8
    outputs = console
  [../]
  [./max_iter]
    type = ElementExtremeValue
    variable = iter
    outputs = console
  [../]
  [./av_linesearch]
    type = ElementAverageValue
    variable = linesearch
    outputs = 'console csv'
  [../]
  [./av_ld]
    type = ElementAverageValue
    variable = ld
    outputs = 'console csv'
  [../]
  [./av_constr_added]
    type = ElementAverageValue
    variable = constr_added
    outputs = 'console csv'
  [../]
  [./av_iter]
    type = ElementAverageValue
    variable = iter
    outputs = 'console csv'
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 4E1
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1.0E-4  # Note larger value
    shift = 1.0E-4                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
  [../]
  [./ts]
    type = TensorMechanicsHardeningConstant
    value = 1E0
  [../]
  [./tensile]
    type = TensorMechanicsPlasticTensileMulti
    tensile_strength = ts
    yield_function_tolerance = 1.0E-4  # Note larger value
    shift = 1.0E-4                     # Note larger value
    internal_constraint_tolerance = 1.0E-7
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    fill_method = symmetric_isotropic
    C_ijkl = '1.0E3 1.3E3'
  [../]
  [./strain]
    type = ComputeIncrementalSmallStrain
    displacements = 'disp_x disp_y disp_z'
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '10 12 -14  12 5 20  -14 20 8'
    eigenstrain_name = ini_stress
  [../]
  [./multi]
    type = ComputeMultiPlasticityStress
    ep_plastic_tolerance = 1E-7
    plastic_models = 'tensile mc'
    max_NR_iterations = 5
    specialIC = 'rock'
    deactivation_scheme = 'safe'
    min_stepsize = 1
    tangent_operator = nonlinear
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it -snes_type'
    petsc_options_value = 'bcgs bjacobi 1E-15 1E-10 10000 test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
[Outputs]
  file_base = cto14
  exodus = false
  csv = true
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar1.i)
# apply uniform stretch in x, y and z directions.
# With cohesion = 10, friction_angle = 60deg, the
# algorithm should return to
# sigma_m = 10*Cos(60)/Sin(60) = 5.773503
# using planar surfaces (not smoothed)
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '1E-6*x'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '1.1E-6*y'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1.2E-6*z'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./f]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = f
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./f]
    type = PointValue
    point = '0 0 0'
    variable = f
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
[]
[UserObjects]
  [./coh]
    type = TensorMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = TensorMechanicsHardeningConstant
    value = 1.04719756
  [../]
  [./psi]
    type = TensorMechanicsHardeningConstant
    value = 0.1
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    yield_function_tolerance = 1E-3
    shift = 1E-12
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-10
    deactivation_scheme = safe
    plastic_models = mc
    debug_fspb = crash
    debug_jac_at_stress = '10 0 0 0 10 0 0 0 10'
    debug_jac_at_pm = 1
    debug_jac_at_intnl = 1
    debug_stress_change = 1E-5
    debug_pm_change = 1E-6
    debug_intnl_change = 1E-6
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar1
  exodus = false
  [./csv]
    type = CSV
    [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard2.i)
# apply uniform stretches in x, y and z directions.
# let friction_angle = 60deg, friction_angle_residual=10deg, friction_angle_rate = 0.5E4
# With cohesion = C, friction_angle = phi, the
# algorithm should return to
# sigma_m = C*Cos(phi)/Sin(phi)
# Or, when T=C,
# phi = arctan(C/sigma_m)
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '1E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '1E-6*y*t'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z*t'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./internal]
    type = PointValue
    point = '0 0 0'
    variable = mc_int
  [../]
  [./f]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 10
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningExponential
    value_0 = 1.04719755 # 60deg
    value_residual = 0.17453293 # 10deg
    rate = 0.5E4
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    shift = 1E-12
    use_custom_returnMap = true
    yield_function_tolerance = 1E-5
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0.0E7 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-12
    plastic_models = mc
  [../]
[]
[Executioner]
  end_time = 10
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar_hard2
  exodus = false
  [./csv]
    type = CSV
    execute_on = timestep_end
    [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard1.i)
# apply uniform stretches in x, y and z directions.
# let mc_cohesion = 10, mc_cohesion_residual = 2, mc_cohesion_rate =
# With cohesion = C, friction_angle = 60deg, tip_smoother = 4, the
# algorithm should return to
# sigma_m = C*Cos(60)/Sin(60)
# This allows checking of the relationship for C
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '1E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '1E-6*y*t'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z*t'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./internal]
    type = PointValue
    point = '0 0 0'
    variable = mc_int
  [../]
  [./f]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningExponential
    value_0 = 10
    value_residual = 2
    rate = 1E4
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 60
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1E-5
    use_custom_returnMap = true
    shift = 1E-12
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0.7E7 1E7'
  [../]
  [./strain]
    type = ComputeIncrementalSmallStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-12
    plastic_models = mc
  [../]
[]
[Executioner]
  end_time = 10
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar_hard1
  exodus = false
  [./csv]
    type = CSV
    execute_on = timestep_end
    [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/uni_axial3_planar.i)
# same as uni_axial2 but with planar mohr-coulomb
[Mesh]
  type = FileMesh
  file = quarter_hole.e
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./zmin_zzero]
    type = DirichletBC
    variable = disp_z
    boundary = 'zmin'
    value = '0'
  [../]
  [./xmin_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin'
    value = '0'
  [../]
  [./ymin_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin'
    value = '0'
  [../]
  [./ymax_disp]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'ymax'
    function = '-1E-4*t'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = stress_zz
  [../]
  [./f]
    type = PointValue
    point = '0.005 0.02 0.002'
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./coh]
    type = TensorMechanicsHardeningConstant
    value = 1E7
  [../]
  [./fric]
    type = TensorMechanicsHardeningConstant
    value = 40
    convert_to_radians = true
  [../]
  [./dil]
    type = TensorMechanicsHardeningConstant
    value = 40
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = coh
    friction_angle = fric
    dilation_angle = dil
    yield_function_tolerance = 1.0 # THIS IS HIGHER THAN THE SMOOTH CASE TO AVOID PRECISION-LOSS PROBLEMS!
    shift =  1.0
    use_custom_returnMap = false
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 1
    fill_method = symmetric_isotropic
    C_ijkl = '0 5E9' # young = 10Gpa, poisson = 0.0
  [../]
  [./strain]
    type = ComputeIncrementalSmallStrain
    block = 1
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 1
    ep_plastic_tolerance = 1E-9
    plastic_models = mc
    max_NR_iterations = 100
    deactivation_scheme = 'safe'
    min_stepsize = 1
    max_stepsize_for_dumb = 1
    debug_fspb = crash
  [../]
[]
# Preconditioning and Executioner options kindly provided by Andrea
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  end_time = 1.05
  dt = 0.1
  solve_type = NEWTON
  type = Transient
[]
[Outputs]
  file_base = uni_axial3_planar
  [./exodus]
    type = Exodus
    hide = 'stress_xx stress_xy stress_xz stress_yy stress_yz stress_zz yield_fcn s_xx s_xy s_xz s_yy s_yz s_zz f'
  [../]
  [./csv]
    type = CSV
    interval = 1
  [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard5.i)
# apply repeated stretches in z direction, and smaller stretches along the y direction, and compression along x direction
# Both return to the plane and edge (lode angle = 30deg, ie 010100) are experienced.
#
# It is checked that the yield functions are less than their tolerance values
# It is checked that the cohesion hardens correctly
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '-1E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0.05E-6*y*t'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z*t'
  [../]
[]
[Functions]
  [./should_be_zero_fcn]
    type = ParsedFunction
    value = 'if((a<1E-5)&(b<1E-5)&(c<1E-5)&(d<1E-5)&(g<1E-5)&(h<1E-5),0,abs(a)+abs(b)+abs(c)+abs(d)+abs(g)+abs(h))'
    vars = 'a b c d g h'
    vals = 'f0 f1 f2 f3 f4 f5'
  [../]
  [./coh_analytic]
    type = ParsedFunction
    value = '20-10*exp(-1E6*intnl)'
    vars = intnl
    vals = internal
  [../]
  [./coh_from_yieldfcns]
    type = ParsedFunction
    value = '(f0+f1-(sxx+syy)*sin(phi))/(-2)/cos(phi)'
    vars = 'f0 f1 sxx syy phi'
    vals = 'f0 f1 s_xx s_yy 0.8726646'
  [../]
  [./should_be_zero_coh]
    type = ParsedFunction
    value = 'if(abs(a-b)<1E-6,0,1E6*abs(a-b))'
    vars = 'a b'
    vals = 'Coh_analytic Coh_moose'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn0]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn3]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn4]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn5]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn0]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn0
  [../]
  [./yield_fcn1]
    type = MaterialStdVectorAux
    index = 1
    property = plastic_yield_function
    variable = yield_fcn1
  [../]
  [./yield_fcn2]
    type = MaterialStdVectorAux
    index = 2
    property = plastic_yield_function
    variable = yield_fcn2
  [../]
  [./yield_fcn3]
    type = MaterialStdVectorAux
    index = 3
    property = plastic_yield_function
    variable = yield_fcn3
  [../]
  [./yield_fcn4]
    type = MaterialStdVectorAux
    index = 4
    property = plastic_yield_function
    variable = yield_fcn4
  [../]
  [./yield_fcn5]
    type = MaterialStdVectorAux
    index = 5
    property = plastic_yield_function
    variable = yield_fcn5
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./internal]
    type = PointValue
    point = '0 0 0'
    variable = mc_int
  [../]
  [./f0]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn0
  [../]
  [./f1]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn1
  [../]
  [./f2]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn2
  [../]
  [./f3]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn3
  [../]
  [./f4]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn4
  [../]
  [./f5]
   type = PointValue
    point = '0 0 0'
    variable = yield_fcn5
  [../]
  [./yfcns_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_fcn
  [../]
  [./Coh_analytic]
    type = FunctionValuePostprocessor
    function = coh_analytic
  [../]
  [./Coh_moose]
    type = FunctionValuePostprocessor
    function = coh_from_yieldfcns
  [../]
  [./cohesion_difference_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_coh
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningExponential
    value_0 = 10
    value_residual = 20
    rate = 1E6
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 0.8726646
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 1 #0.8726646 # 50deg
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    use_custom_returnMap = true
    yield_function_tolerance = 1E-5
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-12
    plastic_models = mc
  [../]
[]
[Executioner]
  end_time = 5
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar_hard5
  exodus = false
  [./csv]
    type = CSV
    hide = 'f0 f1 f2 f3 f4 f5 s_xy s_xz s_yz Coh_analytic Coh_moose'
    execute_on = 'timestep_end'
  [../]
[]
(modules/tensor_mechanics/test/tests/mohr_coulomb/planar_hard3.i)
# apply repeated stretches in x z directions, and smaller stretches along the y direction,
# so that sigma_I = sigma_II,
# which means that lode angle = 30deg.
# Both return to the edge (lode angle = 30deg, ie 010100) and tip are experienced.
#
# It is checked that the yield functions are less than their tolerance values
# It is checked that the cohesion hardens correctly
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '1E-6*x*t'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0.05E-6*y*t'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z*t'
  [../]
[]
[Functions]
  [./should_be_zero_fcn]
    type = ParsedFunction
    value = 'if((a<1E-5)&(b<1E-5)&(c<1E-5)&(d<1E-5)&(g<1E-5)&(h<1E-5),0,abs(a)+abs(b)+abs(c)+abs(d)+abs(g)+abs(h))'
    vars = 'a b c d g h'
    vals = 'f0 f1 f2 f3 f4 f5'
  [../]
  [./coh_analytic]
    type = ParsedFunction
    value = '20-10*exp(-1E5*intnl)'
    vars = intnl
    vals = internal
  [../]
  [./coh_from_yieldfcns]
    type = ParsedFunction
    value = '(f0+f1-(sxx+syy)*sin(phi))/(-2)/cos(phi)'
    vars = 'f0 f1 sxx syy phi'
    vals = 'f0 f1 s_xx s_yy 0.8726646'
  [../]
  [./should_be_zero_coh]
    type = ParsedFunction
    value = 'if(abs(a-b)<1E-6,0,1E6*abs(a-b))'
    vars = 'a b'
    vals = 'Coh_analytic Coh_moose'
  [../]
[]
[AuxVariables]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn0]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn3]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn4]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn5]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./yield_fcn0]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn0
  [../]
  [./yield_fcn1]
    type = MaterialStdVectorAux
    index = 1
    property = plastic_yield_function
    variable = yield_fcn1
  [../]
  [./yield_fcn2]
    type = MaterialStdVectorAux
    index = 2
    property = plastic_yield_function
    variable = yield_fcn2
  [../]
  [./yield_fcn3]
    type = MaterialStdVectorAux
    index = 3
    property = plastic_yield_function
    variable = yield_fcn3
  [../]
  [./yield_fcn4]
    type = MaterialStdVectorAux
    index = 4
    property = plastic_yield_function
    variable = yield_fcn4
  [../]
  [./yield_fcn5]
    type = MaterialStdVectorAux
    index = 5
    property = plastic_yield_function
    variable = yield_fcn5
  [../]
[]
[Postprocessors]
  [./s_xx]
    type = PointValue
    point = '0 0 0'
    variable = stress_xx
  [../]
  [./s_xy]
    type = PointValue
    point = '0 0 0'
    variable = stress_xy
  [../]
  [./s_xz]
    type = PointValue
    point = '0 0 0'
    variable = stress_xz
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./internal]
    type = PointValue
    point = '0 0 0'
    variable = mc_int
  [../]
  [./f0]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn0
  [../]
  [./f1]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn1
  [../]
  [./f2]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn2
  [../]
  [./f3]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn3
  [../]
  [./f4]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn4
  [../]
  [./f5]
   type = PointValue
    point = '0 0 0'
    variable = yield_fcn5
  [../]
  [./yfcns_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_fcn
  [../]
  [./Coh_analytic]
    type = FunctionValuePostprocessor
    function = coh_analytic
  [../]
  [./Coh_moose]
    type = FunctionValuePostprocessor
    function = coh_from_yieldfcns
  [../]
  [./cohesion_difference_should_be_zero]
    type = FunctionValuePostprocessor
    function = should_be_zero_coh
  [../]
[]
[UserObjects]
  [./mc_coh]
    type = TensorMechanicsHardeningExponential
    value_0 = 10
    value_residual = 20
    rate = 1E5
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 0.8726646
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 1 #0.8726646 # 50deg
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1E-5
    use_custom_returnMap = true
    internal_constraint_tolerance = 1E-9
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    block = 0
    fill_method = symmetric_isotropic
    C_ijkl = '0 1E7'
  [../]
  [./strain]
    type = ComputeFiniteStrain
    block = 0
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    block = 0
    ep_plastic_tolerance = 1E-12
    plastic_models = mc
  [../]
[]
[Executioner]
  end_time = 5
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = planar_hard3
  exodus = false
  [./csv]
    type = CSV
    hide = 'f0 f1 f2 f3 f4 f5 s_xy s_xz s_yz Coh_analytic Coh_moose'
    execute_on = 'timestep_end'
  [../]
[]
(modules/tensor_mechanics/test/tests/notched_plastic_block/cmc_planar.i)
# Uses an unsmoothed version of capped-Mohr-Coulomb (via ComputeMultiPlasticityStress with TensorMechanicsPlasticTensileMulti and TensorMechanicsPlasticMohrCoulombMulti) to simulate the following problem.
# A cubical block is notched around its equator.
# All of its outer surfaces have roller BCs, but the notched region is free to move as needed
# The block is initialised with a high hydrostatic tensile stress
# Without the notch, the BCs do not allow contraction of the block, and this stress configuration is admissible
# With the notch, however, the interior parts of the block are free to move in order to relieve stress, and this causes plastic failure
# The top surface is then pulled upwards (the bottom is fixed because of the roller BCs)
# This causes more failure
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 9
    ny = 9
    nz = 9
    xmin = 0
    xmax = 0.1
    ymin = 0
    ymax = 0.1
    zmin = 0
    zmax = 0.1
  []
  [block_to_remove_xmin]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 -0.01 0.045'
    top_right = '0.01 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = generated_mesh
  []
  [block_to_remove_xmax]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '0.09 -0.01 0.045'
    top_right = '0.11 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_xmin
  []
  [block_to_remove_ymin]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 -0.01 0.045'
    top_right = '0.11 0.01 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_xmax
  []
  [block_to_remove_ymax]
    type = SubdomainBoundingBoxGenerator
    bottom_left = '-0.01 0.09 0.045'
    top_right = '0.11 0.11 0.055'
    location = INSIDE
    block_id = 1
    input = block_to_remove_ymin
  []
  [remove_block]
    type = BlockDeletionGenerator
    block = 1
    input = block_to_remove_ymax
  []
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Modules/TensorMechanics/Master]
  [./all]
    add_variables = true
    incremental = true
    generate_output = 'max_principal_stress mid_principal_stress min_principal_stress stress_zz'
    eigenstrain_names = ini_stress
  [../]
[]
[Postprocessors]
  [./uz]
    type = PointValue
    point = '0 0 0.1'
    use_displaced_mesh = false
    variable = disp_z
  [../]
  [./s_zz]
    type = ElementAverageValue
    use_displaced_mesh = false
    variable = stress_zz
  [../]
  [./num_res]
    type = NumResidualEvaluations
  [../]
  [./nr_its]
    type = ElementAverageValue
    variable = num_iters
  [../]
  [./max_nr_its]
    type = ElementExtremeValue
    variable = num_iters
  [../]
  [./runtime]
    type = PerfGraphData
    data_type = TOTAL
    section_name = 'Root'
  [../]
[]
[BCs]
  # back=zmin, front=zmax, bottom=ymin, top=ymax, left=xmin, right=xmax
  [./xmin_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0.0
  [../]
  [./xmax_xzero]
    type = DirichletBC
    variable = disp_x
    boundary = right
    value = 0.0
  [../]
  [./ymin_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0.0
  [../]
  [./ymax_yzero]
    type = DirichletBC
    variable = disp_y
    boundary = top
    value = 0.0
  [../]
  [./zmin_zzero]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = '0'
  [../]
  [./zmax_disp]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = '1E-6*max(t,0)'
  [../]
[]
[AuxVariables]
  [./mc_int]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./plastic_strain]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./num_iters]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./yield_fcn]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./mc_int_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_internal_parameter
    variable = mc_int
  [../]
  [./plastic_strain_aux]
    type = MaterialRankTwoTensorAux
    i = 2
    j = 2
    property = plastic_strain
    variable = plastic_strain
  [../]
  [./num_iters_auxk] # cannot use plastic_NR_iterations directly as this is zero, since no NR iterations are actually used, since we use a custom algorithm to do the return
    type = ParsedAux
    args = plastic_strain
    function = 'if(plastic_strain>0,1,0)'
    variable = num_iters
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    index = 0
    property = plastic_yield_function
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./ts]
    type = TensorMechanicsHardeningConstant
    value = 3E6
  [../]
  [./tensile]
    type = TensorMechanicsPlasticTensileMulti
    tensile_strength = ts
    yield_function_tolerance = 1
    internal_constraint_tolerance = 1.0E-6
    #shift = 1
    use_custom_returnMap = false
    use_custom_cto = false
  [../]
  [./mc_coh]
    type = TensorMechanicsHardeningConstant
    value = 5E6
  [../]
  [./mc_phi]
    type = TensorMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./mc_psi]
    type = TensorMechanicsHardeningConstant
    value = 10
    convert_to_radians = true
  [../]
  [./mc]
    type = TensorMechanicsPlasticMohrCoulombMulti
    cohesion = mc_coh
    friction_angle = mc_phi
    dilation_angle = mc_psi
    yield_function_tolerance = 1E-5
    internal_constraint_tolerance = 1E-11
    use_custom_returnMap = false
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeIsotropicElasticityTensor
    youngs_modulus = 16E9
    poissons_ratio = 0.25
  [../]
  [./mc]
    type = ComputeMultiPlasticityStress
    ep_plastic_tolerance = 1E-6
    plastic_models = 'tensile mc'
    max_NR_iterations = 50
    specialIC = rock
    deactivation_scheme = safe_to_dumb
    debug_fspb = crash
  [../]
  [./strain_from_initial_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '2.5E6 0 0  0 2.5E6 0  0 0 2.5E6'
    eigenstrain_name = ini_stress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  start_time = -1
  end_time = 10
  dt = 1
  solve_type = NEWTON
  type = Transient
  l_tol = 1E-2
  nl_abs_tol = 1E-5
  nl_rel_tol = 1E-7
  l_max_its = 200
  nl_max_its = 400
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
[]
[Outputs]
  file_base = cmc_planar
  perf_graph = true
  exodus = false
  csv = true
[]