- Cosserat_rotationsThe 3 Cosserat rotation variablesC++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:The 3 Cosserat rotation variables 
- componentAn integer corresponding to the direction the variable this kernel acts in. (0 for x, 1 for y, 2 for z)C++ Type:unsigned int Controllable:No Description:An integer corresponding to the direction the variable this kernel acts in. (0 for x, 1 for y, 2 for z) 
- displacementsThe string of displacements suitable for the problem statementC++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:The string of displacements suitable for the problem statement 
- variableThe name of the variable that this residual object operates onC++ Type:NonlinearVariableName Unit:(no unit assumed) Controllable:No Description:The name of the variable that this residual object operates on 
CosseratStressDivergenceTensors
Stress divergence tensor with the additional Jacobian terms for the Cosserat rotation variables.
This kernel is used to model Cosserat media, notably in a Cosserat layered elasticity model.
This kernel should be specified for each component of the displacements variable. All Cosserat rotation variables should also be specified to each instance of this kernel.
Input Parameters
- base_nameMaterial property base nameC++ Type:std::string Controllable:No Description:Material property base name 
- blockThe list of blocks (ids or names) that this object will be appliedC++ Type:std::vector<SubdomainName> Controllable:No Description:The list of blocks (ids or names) that this object will be applied 
- coupled_variablesVector of nonlinear variable arguments this object depends onC++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:Vector of nonlinear variable arguments this object depends on 
- eigenstrain_namesList of eigenstrains used in the strain calculation. Used for computing their derivatives for off-diagonal Jacobian terms.C++ Type:std::vector<MaterialPropertyName> Unit:(no unit assumed) Controllable:No Description:List of eigenstrains used in the strain calculation. Used for computing their derivatives for off-diagonal Jacobian terms. 
- matrix_onlyFalseWhether this object is only doing assembly to matrices (no vectors)Default:False C++ Type:bool Controllable:No Description:Whether this object is only doing assembly to matrices (no vectors) 
- out_of_plane_directionzThe direction of the out_of_plane_strain variable used in the WeakPlaneStress kernel.Default:z C++ Type:MooseEnum Options:x, y, z Controllable:No Description:The direction of the out_of_plane_strain variable used in the WeakPlaneStress kernel. 
- out_of_plane_strainThe name of the out_of_plane_strain variable used in the WeakPlaneStress kernel.C++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:The name of the out_of_plane_strain variable used in the WeakPlaneStress kernel. 
- temperatureThe name of the temperature variable used in the ComputeThermalExpansionEigenstrain. (Not required for simulations without temperature coupling.)C++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:The name of the temperature variable used in the ComputeThermalExpansionEigenstrain. (Not required for simulations without temperature coupling.) 
- use_finite_deform_jacobianFalseJacobian for corotational finite strainDefault:False C++ Type:bool Controllable:No Description:Jacobian for corotational finite strain 
- volumetric_locking_correctionFalseSet to false to turn off volumetric locking correctionDefault:False C++ Type:bool Controllable:No Description:Set to false to turn off volumetric locking correction 
Optional Parameters
- absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contributionC++ Type:std::vector<TagName> Controllable:No Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution 
- extra_matrix_tagsThe extra tags for the matrices this Kernel should fillC++ Type:std::vector<TagName> Controllable:No Description:The extra tags for the matrices this Kernel should fill 
- extra_vector_tagsThe extra tags for the vectors this Kernel should fillC++ Type:std::vector<TagName> Controllable:No Description:The extra tags for the vectors this Kernel should fill 
- matrix_tagssystemThe tag for the matrices this Kernel should fillDefault:system C++ Type:MultiMooseEnum Options:nontime, system Controllable:No Description:The tag for the matrices this Kernel should fill 
- vector_tagsnontimeThe tag for the vectors this Kernel should fillDefault:nontime C++ Type:MultiMooseEnum Options:nontime, time Controllable:No Description:The tag for the vectors this Kernel should fill 
Contribution To Tagged Field Data Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.C++ Type:std::vector<std::string> Controllable:No Description:Adds user-defined labels for accessing object parameters via control logic. 
- diag_save_inThe name of auxiliary variables to save this Kernel's diagonal Jacobian contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)C++ Type:std::vector<AuxVariableName> Unit:(no unit assumed) Controllable:No Description:The name of auxiliary variables to save this Kernel's diagonal Jacobian contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.) 
- enableTrueSet the enabled status of the MooseObject.Default:True C++ Type:bool Controllable:Yes Description:Set the enabled status of the MooseObject. 
- implicitTrueDetermines whether this object is calculated using an implicit or explicit formDefault:True C++ Type:bool Controllable:No Description:Determines whether this object is calculated using an implicit or explicit form 
- save_inThe name of auxiliary variables to save this Kernel's residual contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.)C++ Type:std::vector<AuxVariableName> Unit:(no unit assumed) Controllable:No Description:The name of auxiliary variables to save this Kernel's residual contributions to. Everything about that variable must match everything about this variable (the type, what blocks it's on, etc.) 
- search_methodnearest_node_connected_sidesChoice of search algorithm. All options begin by finding the nearest node in the primary boundary to a query point in the secondary boundary. In the default nearest_node_connected_sides algorithm, primary boundary elements are searched iff that nearest node is one of their nodes. This is fast to determine via a pregenerated node-to-elem map and is robust on conforming meshes. In the optional all_proximate_sides algorithm, primary boundary elements are searched iff they touch that nearest node, even if they are not topologically connected to it. This is more CPU-intensive but is necessary for robustness on any boundary surfaces which has disconnections (such as Flex IGA meshes) or non-conformity (such as hanging nodes in adaptively h-refined meshes).Default:nearest_node_connected_sides C++ Type:MooseEnum Options:nearest_node_connected_sides, all_proximate_sides Controllable:No Description:Choice of search algorithm. All options begin by finding the nearest node in the primary boundary to a query point in the secondary boundary. In the default nearest_node_connected_sides algorithm, primary boundary elements are searched iff that nearest node is one of their nodes. This is fast to determine via a pregenerated node-to-elem map and is robust on conforming meshes. In the optional all_proximate_sides algorithm, primary boundary elements are searched iff they touch that nearest node, even if they are not topologically connected to it. This is more CPU-intensive but is necessary for robustness on any boundary surfaces which has disconnections (such as Flex IGA meshes) or non-conformity (such as hanging nodes in adaptively h-refined meshes). 
- seed0The seed for the master random number generatorDefault:0 C++ Type:unsigned int Controllable:No Description:The seed for the master random number generator 
- 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 Controllable:No 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
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.C++ Type:MaterialPropertyName Unit:(no unit assumed) Controllable:No Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character. 
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.Default:False C++ Type:bool Controllable:No Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction. 
Material Property Retrieval Parameters
Input Files
- (modules/solid_mechanics/test/tests/jacobian/cdp_cwp_coss01.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update8_cosserat.i)
- (modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_01_slippery.i)
- (modules/solid_mechanics/examples/coal_mining/fine.i)
- (modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat2.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp_sticky.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp.i)
- (modules/solid_mechanics/test/tests/static_deformations/cosserat_tension.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update1_cosserat.i)
- (modules/porous_flow/examples/coal_mining/coarse_with_fluid.i)
- (modules/solid_mechanics/test/tests/static_deformations/cosserat_shear.i)
- (modules/solid_mechanics/test/tests/static_deformations/cosserat_glide.i)
- (modules/solid_mechanics/test/tests/jacobian/cwpc02.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update24_cosserat.i)
- (modules/solid_mechanics/examples/coal_mining/coarse.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update34_cosserat.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update33_cosserat.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_mc_only.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat06.i)
- (modules/solid_mechanics/test/tests/static_deformations/cosserat_glide_fake_plastic.i)
- (modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_02.i)
- (modules/solid_mechanics/test/tests/capped_mohr_coulomb/small_deform1_cosserat.i)
- (modules/porous_flow/examples/coal_mining/fine_with_fluid.i)
- (modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat3.i)
- (modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_03.i)
- (modules/solid_mechanics/test/tests/initial_stress/gravity_cosserat.i)
- (modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_02_apply_disps.i)
- (modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_01.i)
- (modules/solid_mechanics/test/tests/capped_mohr_coulomb/small_deform9_cosserat.i)
- (modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat4.i)
- (modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_01.i)
- (modules/solid_mechanics/test/tests/jacobian/cto29.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat05.i)
- (modules/solid_mechanics/test/tests/jacobian/cdp_cwp_coss02.i)
- (modules/solid_mechanics/test/tests/jacobian/cdpc02.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_wp_only.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update23_cosserat.i)
- (modules/solid_mechanics/test/tests/jacobian/cwpc01.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat02.i)
- (modules/solid_mechanics/test/tests/jacobian/cdpc01.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_elastic.i)
- (modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat1.i)
- (modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp_sticky_longitudinal.i)
- (modules/solid_mechanics/test/tests/jacobian/coss_elastic.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat03.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat01.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update18_cosserat.i)
- (modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_02_apply_stress.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update22_cosserat.i)
- (modules/solid_mechanics/test/tests/jacobian/mc_update21_cosserat.i)
- (modules/solid_mechanics/test/tests/jacobian/cosserat04.i)
(modules/solid_mechanics/test/tests/jacobian/cdp_cwp_coss01.i)
#Cosserat capped weak plane and capped drucker prager
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./mc_coh]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 0.8
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 0.4
  [../]
  [./dp]
    type = SolidMechanicsPlasticDruckerPragerHyperbolic
    mc_cohesion = mc_coh
    mc_friction_angle = phi
    mc_dilation_angle = psi
    yield_function_tolerance = 1E-11     # irrelevant here
    internal_constraint_tolerance = 1E-9 # irrelevant here
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 2
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '10 0 0  0 10 0  0 0 10'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = 'dp wp'
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    host_youngs_modulus = 10.0
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = dp
    tensile_strength = ts
    compressive_strength = cs
    yield_function_tol = 1E-11
    tip_smoother = 1
    smoothing_tol = 1
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    base_name = wp
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0.1
    smoothing_tol = 0.1
    yield_function_tol = 1E-11
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    #petsc_options = '-snes_test_display'
    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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update8_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Tensile failure only, starting from a non-symmetric stress state, and
# using softening
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningCubic
    value_0 = 1
    value_residual = 0
    internal_limit = 2E-3
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./ang]
    type = SolidMechanicsHardeningConstant
    value = 30
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 3E3
    poisson = 0.2
    layer_thickness = 1.0
    joint_normal_stiffness = 1.0E3
    joint_shear_stiffness = 2.0E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '2 -1 0.5  1 1.9 0  0.5 0 3'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 3E3
    host_poissons_ratio = 0.2
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = ang
    dilation_angle = ang
    smoothing_tol = 0.1
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_01_slippery.i)
# Beam bending.  One end is clamped and the other end is subjected to
# a constant surface traction.
# The beam thickness is 1, and the Cosserat layer thickness is 0.5,
# so the beam contains 2 Cosserat layers.
# The joint normal stiffness is set very large and the shear stiffness very small
# so that the situation should be very close to a single beam of thickness
# 0.5.
# The deflection should be described by
# u_z = 2sx/G + 2s(1-nu^2)x^2(3L-x)/(Eh^2)
# wc_y = sx(x-2L)/(2B)
# Here
# s = applied shear stress = -2E-4
# x = coordinate along bar (0<=x<=10)
# G = shear modulus = E/2/(1+nu) = 0.4615
# nu = Poisson = 0.3
# L = length of bar = 10
# E = Young = 1.2
# h = Cosserat layer thickness = 0.5
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 80
  xmax = 10
  ny = 1
  nz = 1
  zmin = -0.5
  zmax = 0.5
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./no_dispy]
    type = DirichletBC
    variable = disp_y
    boundary = 'bottom top'
    value = 0.0
  [../]
  [./no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'left'
    value = 0.0
  [../]
  [./clamp_z]
    type = DirichletBC
    variable = disp_z
    boundary = left
    value = 0.0
  [../]
  [./clamp_x]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0.0
  [../]
  [./end_traction]
    type = VectorNeumannBC
    variable = disp_z
    vector_value = '-2E-4 0 0'
    boundary = right
  [../]
[]
[AuxVariables]
  [./wc_x]
  [../]
  [./wc_z]
  [../]
  [./strain_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[AuxKernels]
  [./strain_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xx
    index_i = 0
    index_j = 0
  [../]
  [./strain_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xy
    index_i = 0
    index_j = 1
  [../]
  [./strain_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xz
    index_i = 0
    index_j = 2
  [../]
  [./strain_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yx
    index_i = 1
    index_j = 0
  [../]
  [./strain_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yy
    index_i = 1
    index_j = 1
  [../]
  [./strain_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yz
    index_i = 1
    index_j = 2
  [../]
  [./strain_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zx
    index_i = 2
    index_j = 0
  [../]
  [./strain_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zy
    index_i = 2
    index_j = 1
  [../]
  [./strain_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zz
    index_i = 2
    index_j = 2
  [../]
  [./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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[VectorPostprocessors]
  [./soln]
    type = LineValueSampler
    warn_discontinuous_face_values = false
    sort_by = x
    variable = 'disp_x disp_z stress_xx stress_xz stress_zx stress_zz wc_y couple_stress_xx couple_stress_xz couple_stress_zx couple_stress_zz'
    start_point = '0 0 0'
    end_point = '10 0 0'
    num_points = 11
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.2
    poisson = 0.3
    layer_thickness = 0.5
    joint_normal_stiffness = 1E16
    joint_shear_stiffness = 1E-6
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol -sub_pc_factor_shift_type'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10 NONZERO'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = beam_cosserat_01_slippery
  csv = true
  exodus = true
[]
(modules/solid_mechanics/examples/coal_mining/fine.i)
# Strata deformation and fracturing around a coal mine - 3D model
#
# A "half model" is used.  The mine is 400m deep and
# just the roof is studied (-400<=z<=0).  The mining panel
# sits between 0<=x<=150, and 0<=y<=1000, so this simulates
# a coal panel that is 300m wide and 1000m long.  The outer boundaries
# are 1km from the excavation boundaries.
#
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions for this simulation are:
#  - disp_x = 0 at x=0 and x=1150
#  - disp_y = 0 at y=-1000 and y=1000
#  - disp_z = 0 at z=-400, but there is a time-dependent
#               Young's modulus that simulates excavation
#  - wc_x = 0 at y=-1000 and y=1000
#  - wc_y = 0 at x=0 and x=1150
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = 0.025*z MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
#
[Mesh]
  [file]
    type = FileMeshGenerator
    file = mesh/fine.e
  []
  [./xmin]
    input = file
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = xmin
    normal = '-1 0 0'
  [../]
  [./xmax]
    input = xmin
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = xmax
    normal = '1 0 0'
  [../]
  [./ymin]
    input = xmax
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = ymin
    normal = '0 -1 0'
  [../]
  [./ymax]
    input = ymin
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = ymax
    normal = '0 1 0'
  [../]
  [./zmax]
    input = ymax
    type = SideSetsAroundSubdomainGenerator
    block = 30
    new_boundary = zmax
    normal = '0 0 1'
  [../]
  [./zmin]
    input = zmax
    type = SideSetsAroundSubdomainGenerator
    block = 2
    new_boundary = zmin
    normal = '0 0 -1'
  [../]
  [./excav]
    type = SubdomainBoundingBoxGenerator
    input = zmin
    block_id = 1
    bottom_left = '0 0 -400'
    top_right = '150 1000 -397'
  [../]
  [./roof]
    type = SideSetsAroundSubdomainGenerator
    block = 1
    input = excav
    new_boundary = roof
    normal = '0 0 1'
  [../]
[]
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_y
    component = 1
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin xmax'
    value = 0.0
  [../]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin ymax'
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = zmin
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'ymin ymax'
    value = 0.0
  [../]
  [./no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'xmin xmax'
    value = 0.0
  [../]
  [./roof]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = roof
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '0.8*2500*10E-6*z'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '2500*10E-6*z'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '100.0   0    1000.0 1E-9 1 10'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  [../]
  [./density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '100.0   0    1000.0 0 2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  [../]
  [./elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  [../]
  [./stress_0]
    type = ComputeMultipleInelasticCosseratStress
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./stress_1]
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density_0]
    type = GenericConstantMaterial
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    prop_names = density
    prop_values = 2500
  [../]
  [./density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Postprocessors]
  [./min_roof_disp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = disp_z
  [../]
  [./min_surface_disp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = disp_z
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' bjacobi  gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.5
  end_time = 100.0
[]
[Outputs]
  time_step_interval = 1
  print_linear_residuals = false
  exodus = true
  csv = true
  console = true
[]
(modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat2.i)
# Plastic deformation.  Layered Cosserat with parameters:
# Young = 1.0
# Poisson = 0.2
# layer_thickness = 0.1
# joint_normal_stiffness = 0.25
# joint_shear_stiffness = 0.2
# These give the following nonzero components of the elasticity tensor:
# E_0000 = E_1111 = 1.043195
# E_0011 = E_1100 = 0.260799
# E_2222 = 0.02445
# E_0022 = E_1122 = E_2200 = E_2211 = 0.006112
# G = E_0101 = E_0110 = E_1001 = E_1010 = 0.416667
# Gt = E_0202 = E_0220 = E_2002 = E_1212 = E_1221 = E_2112 = 0.019084
# E_2020 = E_2121 = 0.217875
# They give the following nonzero components of the bending rigidity tensor:
# D = 8.68056E-5
# B_0101 = B_1010 = 7.92021E-4
# B_0110 = B_1001 = -1.584E-4
#
# Applying the following deformation to the zmax surface of a unit cube:
# disp_x = 8*t
# disp_y = 6*t
# disp_z = -t
# omega_x = omega_y = omega_z = 0
# yields the following strains:
# strain_xz = 8*t
# strain_yz = 6*t
# strain_zz = -t
# and all other components, and the curvature, are zero.
# The nonzero components of stress are therefore:
# stress_xx = stress_yy = -0.006112*t
# stress_xz = stress_zx = 0.152671*t
# stress_yz = stress_zy = 0.114504*t
# stress_zz = -0.0244499*t
# The moment stress is zero.
# So q = 0.19084*t and p = -0.0244*t.
#
# With large cohesion, but compressive strength = 0.0244499, the
# system is elastic up to t=1.  After that time
# stress_zz = -0.0244499 (for t>=1)
# and
# stress_xx = stress_yy = -0.006112 (for t>=1), since the
# elastic trial increment is exactly canelled by the Poisson's
# contribution from the return to the yield surface.
# The plastic strains are zero for t<=1, but for larger times:
# plastic_strain_zz = - (t - 1)  (for t>=1)
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./bottomx]
    type = DirichletBC
    variable = disp_x
    boundary = back
    value = 0.0
  [../]
  [./bottomy]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0.0
  [../]
  [./bottomz]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0.0
  [../]
  [./topx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = front
    function = 8*t
  [../]
  [./topy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = front
    function = 6*t
  [../]
  [./topz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = -t
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strainp_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_compressive]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ls]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./strainp_xx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xx
    index_i = 0
    index_j = 0
  [../]
  [./strainp_xy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xy
    index_i = 0
    index_j = 1
  [../]
  [./strainp_xz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xz
    index_i = 0
    index_j = 2
  [../]
  [./strainp_yx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yx
    index_i = 1
    index_j = 0
  [../]
  [./strainp_yy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yy
    index_i = 1
    index_j = 1
  [../]
  [./strainp_yz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yz
    index_i = 1
    index_j = 2
  [../]
  [./strainp_zx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zx
    index_i = 2
    index_j = 0
  [../]
  [./strainp_zy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zy
    index_i = 2
    index_j = 1
  [../]
  [./strainp_zz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zz
    index_i = 2
    index_j = 2
  [../]
  [./straint_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xx
    index_i = 0
    index_j = 0
  [../]
  [./straint_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xy
    index_i = 0
    index_j = 1
  [../]
  [./straint_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xz
    index_i = 0
    index_j = 2
  [../]
  [./straint_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yx
    index_i = 1
    index_j = 0
  [../]
  [./straint_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yy
    index_i = 1
    index_j = 1
  [../]
  [./straint_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yz
    index_i = 1
    index_j = 2
  [../]
  [./straint_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zx
    index_i = 2
    index_j = 0
  [../]
  [./straint_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zy
    index_i = 2
    index_j = 1
  [../]
  [./straint_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zz
    index_i = 2
    index_j = 2
  [../]
  [./f_shear]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    variable = f_shear
  [../]
  [./f_tensile]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 1
    variable = f_tensile
  [../]
  [./f_compressive]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 2
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 0
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 1
    variable = intnl_tensile
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./ls]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = ls
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
  [./strainp_xx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xx
  [../]
  [./strainp_xy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xy
  [../]
  [./strainp_xz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xz
  [../]
  [./strainp_yx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yx
  [../]
  [./strainp_yy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yy
  [../]
  [./strainp_yz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yz
  [../]
  [./strainp_zx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zx
  [../]
  [./strainp_zy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zy
  [../]
  [./strainp_zz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zz
  [../]
  [./straint_xx]
    type = PointValue
    point = '0 0 0'
    variable = straint_xx
  [../]
  [./straint_xy]
    type = PointValue
    point = '0 0 0'
    variable = straint_xy
  [../]
  [./straint_xz]
    type = PointValue
    point = '0 0 0'
    variable = straint_xz
  [../]
  [./straint_yx]
    type = PointValue
    point = '0 0 0'
    variable = straint_yx
  [../]
  [./straint_yy]
    type = PointValue
    point = '0 0 0'
    variable = straint_yy
  [../]
  [./straint_yz]
    type = PointValue
    point = '0 0 0'
    variable = straint_yz
  [../]
  [./straint_zx]
    type = PointValue
    point = '0 0 0'
    variable = straint_zx
  [../]
  [./straint_zy]
    type = PointValue
    point = '0 0 0'
    variable = straint_zy
  [../]
  [./straint_zz]
    type = PointValue
    point = '0 0 0'
    variable = straint_zz
  [../]
  [./f_shear]
    type = PointValue
    point = '0 0 0'
    variable = f_shear
  [../]
  [./f_tensile]
    type = PointValue
    point = '0 0 0'
    variable = f_tensile
  [../]
  [./f_compressive]
    type = PointValue
    point = '0 0 0'
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = PointValue
    point = '0 0 0'
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = PointValue
    point = '0 0 0'
    variable = intnl_tensile
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
  [./ls]
    type = PointValue
    point = '0 0 0'
    variable = ls
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 30
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 0.1111077
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 40
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 0.024449878
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.0
    poisson = 0.2
    layer_thickness = 0.1
    joint_normal_stiffness = 0.25
    joint_shear_stiffness = 0.2
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
    perform_finite_strain_rotations = false
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0
    smoothing_tol = 1
    yield_function_tol = 1E-5
  [../]
[]
[Executioner]
  nl_abs_tol = 1E-14
  end_time = 3
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = small_deform_cosserat2
  csv = true
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp_sticky.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a transverse section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 400m deep
# and just the roof is studied (0<=z<=400).  The model sits
# between 0<=y<=450.  The excavation sits in 0<=y<=150.  This
# is a "half model": the boundary conditions are such that
# the model simulates an excavation sitting in -150<=y<=150
# inside a model of the region -450<=y<=450.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).
#
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions for this elastic simulation are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=0 and y=450
#  - disp_z = 0 at z=0, but there is a time-dependent
#               Young's modulus that simulates excavation
#  - wc_x = 0 at y=0 and y=450.
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa, varying down to 1 MPa when tensile strain = 1
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
#
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 403.003
    bias_z = 1.1
    ny = 30 # make this a multiple of 3, so y=150 is at a node
    ymin = 0
    ymax = 450
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 150 3'
    input = bottom
  []
  [roof]
    type = SideSetsAroundSubdomainGenerator
    block = 1
    new_boundary = 18
    normal = '0 0 1'
    input = excav
  []
[]
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12'
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
  [./roof]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = '18'
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(403.003-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(403.003-z)'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '1.0   0    150.0 1E-9 1 15'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  [../]
  [./density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '1.0   0    150.0 0 2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
    block = 0
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  [../]
  [./elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  [../]
  [./stress_0]
    # this is needed so as to correctly apply the initial stress
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./stress_1]
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density_0]
    type = GenericConstantMaterial
    block = 0
    prop_names = density
    prop_values = 2500
  [../]
  [./density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  [../]
[]
[Postprocessors]
  [./subs_max]
    type = PointValue
    point = '0 0 403.003'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-8
  nl_rel_tol = 1e-8
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.01
  end_time = 1.0
[]
[Outputs]
  file_base = cosserat_mc_wp_sticky
  time_step_interval = 1
  print_linear_residuals = false
  exodus = true
  csv = true
  console = true
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a transverse section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 300m deep
# and just the roof is studied (0<=z<=300).  The model sits
# between 0<=y<=450.  The excavation sits in 0<=y<=150.  This
# is a "half model": the boundary conditions are such that
# the model simulates an excavation sitting in -150<=y<=150
# inside a model of the region -450<=y<=450.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).  Mining is simulated by moving the excavation's
# roof down, until disp_z=-3 at t=1.
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=0 and y=450
#  - disp_z = 0 for y>150
#  - disp_z = -3 at maximum, for 0<=y<=150.  See excav function.
# That is, rollers on the sides, free at top, and prescribed at bottom.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa, varying down to 1 MPa when tensile strain = 1
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
#
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 400.0
    bias_z = 1.1
    ny = 30 # make this a multiple of 3, so y=150 is at a node
    ymin = 0
    ymax = 450
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 150 3'
    input = bottom
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    new_boundary = 21
    primary_block = 0
    paired_block = 1
    input = excav
  []
  [hole]
    type = BlockDeletionGenerator
    block = 1
    input = roof
  []
[]
[GlobalParams]
  block = 0
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12 16 21' # note addition of 16 and 21
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
  [./roof]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 21
    function = excav_sideways
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(400-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(400-z)'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*max(min((min(t/end_t,1)*(ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
  [./excav_downwards]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*min(t/end_t,1)*max(min(((ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
    eigenstrain_name = ini_stress
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 10000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./density]
    type = GenericConstantMaterial
    prop_names = density
    prop_values = 2500
  [../]
[]
[Postprocessors]
  [./subsidence]
    type = PointValue
    point = '0 0 400'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.2
  end_time = 0.2
[]
[Outputs]
  file_base = cosserat_mc_wp
  time_step_interval = 1
  print_linear_residuals = false
  csv = true
  exodus = true
  [./console]
    type = Console
    output_linear = false
  [../]
[]
(modules/solid_mechanics/test/tests/static_deformations/cosserat_tension.i)
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 2
    ny = 2
    nz = 2
    zmax = 0.2
  []
  [bottom_xline1]
    type = ExtraNodesetGenerator
    new_boundary = 101
    coord = '0 0 0'
    input = generated_mesh
  []
  [bottom_xline2]
    type = ExtraNodesetGenerator
    new_boundary = 101
    coord = '0.5 0 0'
    input = bottom_xline1
  []
  [bottom_xline3]
    type = ExtraNodesetGenerator
    new_boundary = 101
    coord = '1 0 0'
    input = bottom_xline2
  []
  [bottom_zline1]
    type = ExtraNodesetGenerator
    new_boundary = 102
    coord = '0 0 0.0'
    input = bottom_xline3
  []
  [bottom_zline2]
    type = ExtraNodesetGenerator
    new_boundary = 102
    coord = '0 0 0.1'
    input = bottom_zline1
  []
  [bottom_zline3]
    type = ExtraNodesetGenerator
    new_boundary = 102
    coord = '0 0 0.2'
    input = bottom_zline2
  []
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Postprocessors]
  [./disp_y_top]
    type = PointValue
    point = '0.5 1 0.1'
    variable = disp_y
  [../]
  [./wc_z_top]
    type = PointValue
    point = '0.5 1 0.1'
    variable = wc_z
  [../]
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[BCs]
  [./y_bottom]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  [../]
  [./x_line]
    type = DirichletBC
    variable = disp_z
    boundary = 101
    value = 0
  [../]
  [./z_line]
    type = DirichletBC
    variable = disp_x
    boundary = 102
    value = 0
  [../]
  [./wc_x_bottom]
    type = DirichletBC
    variable = wc_x
    boundary = bottom
    value = 0
  [../]
  [./wc_y_bottom]
    type = DirichletBC
    variable = wc_y
    boundary = bottom
    value = 0
  [../]
  [./wc_z_bottom]
    type = DirichletBC
    variable = wc_z
    boundary = bottom
    value = 0
  [../]
  [./top_force]
    type = NeumannBC
    variable = disp_y
    boundary = top
    value = 1
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = 0.5
    E_ijkl = '1 2 1.3333'
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres bjacobi 1E-10 1E-10 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = cosserat_tension_out
  exodus = true
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update1_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Tensile failure only, starting from a symmetric stress state
# and returning to the plane
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./ang]
    type = SolidMechanicsHardeningConstant
    value = 30
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 3E3
    poisson = 0.2
    layer_thickness = 1.0
    joint_normal_stiffness = 1.0E3
    joint_shear_stiffness = 2.0E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '2 0 0  0 0 0  0 0 -2'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 3E3
    host_poissons_ratio = 0.2
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = ang
    dilation_angle = ang
    smoothing_tol = 0.1
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/porous_flow/examples/coal_mining/coarse_with_fluid.i)
# Strata deformation and fluid flow aaround a coal mine - 3D model
#
# A "half model" is used.  The mine is 400m deep and
# just the roof is studied (-400<=z<=0).  The mining panel
# sits between 0<=x<=150, and 0<=y<=1000, so this simulates
# a coal panel that is 300m wide and 1000m long.  The outer boundaries
# are 1km from the excavation boundaries.
#
# The excavation takes 0.5 years.
#
# The boundary conditions for this simulation are:
#  - disp_x = 0 at x=0 and x=1150
#  - disp_y = 0 at y=-1000 and y=1000
#  - disp_z = 0 at z=-400, but there is a time-dependent
#               Young modulus that simulates excavation
#  - wc_x = 0 at y=-1000 and y=1000
#  - wc_y = 0 at x=0 and x=1150
#  - no flow at x=0, z=-400 and z=0
#  - fixed porepressure at y=-1000, y=1000 and x=1150
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# A single-phase unsaturated fluid is used.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa, and time units are measured in years.
#
# The initial porepressure is hydrostatic with P=0 at z=0, so
# Porepressure ~ - 0.01*z MPa, where the fluid has density 1E3 kg/m^3 and
# gravity = = 10 m.s^-2 = 1E-5 MPa m^2/kg.
# To be more accurate, i use
# Porepressure = -bulk * log(1 + g*rho0*z/bulk)
# where bulk=2E3 MPa and rho0=1Ee kg/m^3.
# The initial stress is consistent with the weight force from undrained
# density 2500 kg/m^3, and fluid porepressure, and a Biot coefficient of 0.7, ie,
# stress_zz^effective = 0.025*z + 0.7 * initial_porepressure
# The maximum and minimum principal horizontal effective stresses are
# assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 2 MPa
# MC friction angle = 35 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
# Fluid density at zero porepressure = 1E3 kg/m^3
# Fluid bulk modulus = 2E3 MPa
# Fluid viscosity = 1.1E-3 Pa.s = 1.1E-9 MPa.s = 3.5E-17 MPa.year
#
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
  PorousFlowDictator = dictator
  biot_coefficient = 0.7
[]
[Mesh]
  [file]
    type = FileMeshGenerator
    file = mesh/coarse.e
  []
  [xmin]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = xmin
    normal = '-1 0 0'
    input = file
  []
  [xmax]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = xmax
    normal = '1 0 0'
    input = xmin
  []
  [ymin]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = ymin
    normal = '0 -1 0'
    input = xmax
  []
  [ymax]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = ymax
    normal = '0 1 0'
    input = ymin
  []
  [zmax]
    type = SideSetsAroundSubdomainGenerator
    block = 16
    new_boundary = zmax
    normal = '0 0 1'
    input = ymax
  []
  [zmin]
    type = SideSetsAroundSubdomainGenerator
    block = 2
    new_boundary = zmin
    normal = '0 0 -1'
    input = zmax
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    input = zmin
    block_id = 1
    bottom_left = '0 0 -400'
    top_right = '150 1000 -397'
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    primary_block = 3
    paired_block = 1
    input = excav
    new_boundary = roof
  []
[]
[Variables]
  [disp_x]
  []
  [disp_y]
  []
  [disp_z]
  []
  [wc_x]
  []
  [wc_y]
  []
  [porepressure]
    scaling = 1E-5
  []
[]
[ICs]
  [porepressure]
    type = FunctionIC
    variable = porepressure
    function = ini_pp
  []
[]
[Kernels]
  [cx_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  []
  [cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  []
  [cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  []
  [x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  []
  [y_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  []
  [x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  []
  [y_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_y
    component = 1
  []
  [gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  []
  [poro_x]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  []
  [poro_y]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  []
  [poro_z]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    component = 2
    variable = disp_z
  []
  [mass0]
    type = PorousFlowMassTimeDerivative
    fluid_component = 0
    variable = porepressure
  []
  [flux]
    type = PorousFlowAdvectiveFlux
    use_displaced_mesh = false
    variable = porepressure
    gravity = '0 0 -10E-6'
    fluid_component = 0
  []
  [poro_vol_exp]
    type = PorousFlowMassVolumetricExpansion
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    variable = porepressure
    fluid_component = 0
  []
[]
[AuxVariables]
  [saturation]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_x]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_y]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_z]
    order = CONSTANT
    family = MONOMIAL
  []
  [porosity]
    order = CONSTANT
    family = MONOMIAL
  []
  [wc_z]
  []
  [stress_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_xy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_xz]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yz]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_shear]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_shear]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[AuxKernels]
  [saturation_water]
    type = PorousFlowPropertyAux
    variable = saturation
    property = saturation
    phase = 0
    execute_on = timestep_end
  []
  [darcy_x]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_x
    gravity = '0 0 -10E-6'
    component = x
  []
  [darcy_y]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_y
    gravity = '0 0 -10E-6'
    component = y
  []
  [darcy_z]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_z
    gravity = '0 0 -10E-6'
    component = z
  []
  [porosity]
    type = PorousFlowPropertyAux
    property = porosity
    variable = porosity
    execute_on = timestep_end
  []
  [stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
    execute_on = timestep_end
  []
  [stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
    execute_on = timestep_end
  []
  [stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
    execute_on = timestep_end
  []
  [stress_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
    execute_on = timestep_end
  []
  [stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
    execute_on = timestep_end
  []
  [stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
    execute_on = timestep_end
  []
  [stress_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
    execute_on = timestep_end
  []
  [stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
    execute_on = timestep_end
  []
  [stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xx
    index_i = 0
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xy
    index_i = 0
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xz
    index_i = 0
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yx
    index_i = 1
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yy
    index_i = 1
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yz
    index_i = 1
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zx
    index_i = 2
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zy
    index_i = 2
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zz
    index_i = 2
    index_j = 2
    execute_on = timestep_end
  []
  [perm_xx]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_xx
    row = 0
    column = 0
    execute_on = timestep_end
  []
  [perm_yy]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_yy
    row = 1
    column = 1
    execute_on = timestep_end
  []
  [perm_zz]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_zz
    row = 2
    column = 2
    execute_on = timestep_end
  []
  [mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
    execute_on = timestep_end
  []
  [mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
    execute_on = timestep_end
  []
  [wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
    execute_on = timestep_end
  []
  [wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
    execute_on = timestep_end
  []
  [mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
    execute_on = timestep_end
  []
  [mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
    execute_on = timestep_end
  []
  [wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
    execute_on = timestep_end
  []
  [wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
    execute_on = timestep_end
  []
[]
[BCs]
  [no_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin xmax'
    value = 0.0
  []
  [no_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin ymax'
    value = 0.0
  []
  [no_z]
    type = DirichletBC
    variable = disp_z
    boundary = zmin
    value = 0.0
  []
  [no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'ymin ymax'
    value = 0.0
  []
  [no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'xmin xmax'
    value = 0.0
  []
  [fix_porepressure]
    type = FunctionDirichletBC
    variable = porepressure
    boundary = 'ymin ymax xmax'
    function = ini_pp
  []
  [roof_porepressure]
    type = PorousFlowPiecewiseLinearSink
    variable = porepressure
    pt_vals = '-1E3 1E3'
    multipliers = '-1 1'
    fluid_phase = 0
    flux_function = roof_conductance
    boundary = roof
  []
  [roof_bcs]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = roof
  []
[]
[Functions]
  [ini_pp]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0'
    symbol_values = '2E3 0.0 1E-5 1E3'
    expression = '-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk)'
  []
  [ini_xx]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0 biot'
    symbol_values = '2E3 0.0 1E-5 1E3  0.7'
    expression = '0.8*(2500*10E-6*z+biot*(-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk)))'
  []
  [ini_zz]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0 biot'
    symbol_values = '2E3 0.0 1E-5 1E3  0.7'
    expression = '2500*10E-6*z+biot*(-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk))'
  []
  [excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '0.5   0    1000.0 1E-9 1 60'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  []
  [density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '0.5   0    1000.0 0 2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  []
  [roof_conductance]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax   maxval minval'
    symbol_values = '0.5   0    1000.0 1E7      0'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),maxval,minval)'
  []
[]
[UserObjects]
  [dictator]
    type = PorousFlowDictator
    porous_flow_vars = 'porepressure disp_x disp_y disp_z'
    number_fluid_phases = 1
    number_fluid_components = 1
  []
  [pc]
    type = PorousFlowCapillaryPressureVG
    m = 0.5
    alpha = 1 # MPa^-1
  []
  [mc_coh_strong_harden]
    type = TensorMechanicsHardeningExponential
    value_0 = 1.99 # MPa
    value_residual = 2.01 # MPa
    rate = 1.0
  []
  [mc_fric]
    type = TensorMechanicsHardeningConstant
    value = 0.61 # 35deg
  []
  [mc_dil]
    type = TensorMechanicsHardeningConstant
    value = 0.15 # 8deg
  []
  [mc_tensile_str_strong_harden]
    type = TensorMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  []
  [mc_compressive_str]
    type = TensorMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  []
  [wp_coh_harden]
    type = TensorMechanicsHardeningCubic
    value_0 = 0.05
    value_residual = 0.05
    internal_limit = 10
  []
  [wp_tan_fric]
    type = TensorMechanicsHardeningConstant
    value = 0.26 # 15deg
  []
  [wp_tan_dil]
    type = TensorMechanicsHardeningConstant
    value = 0.18 # 10deg
  []
  [wp_tensile_str_harden]
    type = TensorMechanicsHardeningCubic
    value_0 = 0.05
    value_residual = 0.05
    internal_limit = 10
  []
  [wp_compressive_str_soften]
    type = TensorMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  []
[]
[FluidProperties]
  [simple_fluid]
    type = SimpleFluidProperties
    bulk_modulus = 2E3
    density0 = 1000
    thermal_expansion = 0
    viscosity = 3.5E-17
  []
[]
[Materials]
  [temperature]
    type = PorousFlowTemperature
  []
  [eff_fluid_pressure]
    type = PorousFlowEffectiveFluidPressure
  []
  [vol_strain]
    type = PorousFlowVolumetricStrain
  []
  [ppss]
    type = PorousFlow1PhaseP
    porepressure = porepressure
    capillary_pressure = pc
  []
  [massfrac]
    type = PorousFlowMassFraction
  []
  [simple_fluid]
    type = PorousFlowSingleComponentFluid
    fp = simple_fluid
    phase = 0
  []
  [porosity_bulk]
    type = PorousFlowPorosity
    fluid = true
    mechanical = true
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    ensure_positive = true
    porosity_zero = 0.02
    solid_bulk = 5.3333E3
  []
  [porosity_excav]
    type = PorousFlowPorosityConst
    block = 1
    porosity = 1.0
  []
  [permeability_bulk]
    type = PorousFlowPermeabilityKozenyCarman
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    poroperm_function = kozeny_carman_phi0
    k0 = 1E-15
    phi0 = 0.02
    n = 2
    m = 2
  []
  [permeability_excav]
    type = PorousFlowPermeabilityConst
    block = 1
    permeability = '0 0 0   0 0 0   0 0 0'
  []
  [relperm]
    type = PorousFlowRelativePermeabilityCorey
    n = 4
    s_res = 0.4
    sum_s_res = 0.4
    phase = 0
  []
  [elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  []
  [elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  []
  [strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  []
  [ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  []
  [stress_0]
    type = ComputeMultipleInelasticCosseratStress
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  []
  [stress_1]
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  []
  [mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  []
  [wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.05
    smoothing_tol = 0.05 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  []
  [undrained_density_0]
    type = GenericConstantMaterial
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    prop_names = density
    prop_values = 2500
  []
  [undrained_density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  []
[]
[Preconditioning]
  [SMP]
    type = SMP
    full = true
  []
[]
[Postprocessors]
  [min_roof_disp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = disp_z
  []
  [min_roof_pp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = porepressure
  []
  [min_surface_disp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = disp_z
  []
  [min_surface_pp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = porepressure
  []
  [max_perm_zz]
    type = ElementExtremeValue
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    variable = perm_zz
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  # best overall
  # petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
  # petsc_options_value = ' lu       mumps'
  # best if you do not have mumps:
  petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
  petsc_options_value = ' lu       superlu_dist'
  # best if you do not have mumps or superlu_dist:
  #petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  #petsc_options_value = ' asm      2              lu            gmres     200'
  # very basic:
  #petsc_options_iname = '-pc_type -ksp_type -ksp_gmres_restart'
  #petsc_options_value = ' bjacobi  gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 200
  nl_max_its = 30
  start_time = 0.0
  dt = 0.014706
  end_time = 0.014706 #0.5
[]
[Outputs]
  time_step_interval = 1
  print_linear_residuals = true
  exodus = true
  csv = true
  console = true
[]
(modules/solid_mechanics/test/tests/static_deformations/cosserat_shear.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 6
  ny = 6
  ymin = 0
  ymax = 10
  nz = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Postprocessors]
  [./disp_y_top]
    type = PointValue
    point = '0.5 1 0.1'
    variable = disp_y
  [../]
  [./disp_x_top]
    type = PointValue
    point = '0.5 1 0.1'
    variable = disp_x
  [../]
  [./wc_z_top]
    type = PointValue
    point = '0.5 1 0.1'
    variable = wc_z
  [../]
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
    displacements = 'disp_x disp_y disp_z'
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    component = 1
    displacements = 'wc_x wc_y wc_z'
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    component = 2
    displacements = 'wc_x wc_y wc_z'
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[BCs]
  [./Periodic]
    [./xperiodic]
      auto_direction = x
      variable = 'disp_x disp_y disp_z wc_x wc_y wc_z'
    [../]
    [./zperiodic]
      auto_direction = z
      variable = 'disp_x disp_y disp_z wc_x wc_y wc_z'
    [../]
  [../]
  [./ux_equals_zero_on_top]
    type = DirichletBC
    variable = disp_x
    boundary = top
    value = 0
  [../]
  [./wcx_equals_zero_on_top]
    type = DirichletBC
    variable = wc_x
    boundary = top
    value = 0
  [../]
  [./wcy_equals_zero_on_top]
    type = DirichletBC
    variable = wc_y
    boundary = top
    value = 0
  [../]
  [./wcz_equals_zero_on_top]
    type = DirichletBC
    variable = wc_z
    boundary = top
    value = 0
  [../]
  # following is natural BC
  [./top_cauchy_zero]
    type = NeumannBC
    variable = disp_x
    boundary = top
    value = 0
  [../]
  [./ux_bottom]
    type = DirichletBC
    variable = disp_x
    boundary = bottom
    value = 1.0
  [../]
  [./uy_bottom]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0.0
  [../]
  [./uz_bottom]
    type = DirichletBC
    variable = disp_z
    boundary = bottom
    value = 0.0
  [../]
  [./wc_x_bottom]
    type = DirichletBC
    variable = wc_x
    boundary = bottom
    value = 0.0
  [../]
  [./wc_y_bottom]
    type = DirichletBC
    variable = wc_y
    boundary = bottom
    value = 0.0
  [../]
  [./wc_z_bottom]
    type = DirichletBC
    variable = wc_z
    boundary = bottom
    value = 0.17
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = 40
    E_ijkl = '5 10 5'
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres bjacobi 1E-10 1E-10 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/solid_mechanics/test/tests/static_deformations/cosserat_glide.i)
# Example taken from Appendix A of
# S Forest "Mechanics of Cosserat media An introduction".  Available from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.154.4476&rep=rep1&type=pdf
#
# Analytically, the displacements are
# wc_z = B sinh(w_e y)
# disp_x = (2 mu_c B / w_e / (mu + mu_c)) (1 - cosh(w_e y))
# with w_e^2 = 2 mu mu_c / be / (mu + mu_c)
# and B = arbitrary integration constant
#
# Also, the only nonzero stresses are
# m_zy = 2 B be w_e cosh(w_e y)
# si_yx = -4 mu mu_c/(mu + mu_c) B sinh(w_e y)
#
# MOOSE gives these stress components correctly.
# However, it also gives a seemingly non-zero si_xy
# component.  Upon increasing the resolution of the
# mesh (ny=10000, for example), the stress components
# are seen to limit correctly to the above forumlae
#
# I use mu = 2, mu_c = 3, be = 0.6, so w_e = 2
# Also i use B = 1, so at y = 1
# wc_z = 3.626860407847
# disp_x = -1.65731741465
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 100
  ymax = 1
  nz = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./disp_x_zero_at_y_zero]
    type = DirichletBC
    variable = disp_x
    boundary = bottom
    value = 0
  [../]
  [./disp_x_fixed_at_y_max]
    type = DirichletBC
    variable = disp_x
    boundary = top
    value = -1.65731741465
  [../]
  [./no_dispy]
    type = DirichletBC
    variable = disp_y
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_dispz]
    type = DirichletBC
    variable = disp_z
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./wc_z_zero_at_y_zero]
    type = DirichletBC
    variable = wc_z
    boundary = bottom
    value = 0
  [../]
  [./wc_z_fixed_at_y_max]
    type = DirichletBC
    variable = wc_z
    boundary = top
    value = 3.626860407847
  [../]
[]
[AuxVariables]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1.1 0.6 0.6' # In Forest notation this is alpha=1.1 (this is unimportant), beta=gamma=0.6.
    fill_method_bending = 'general_isotropic'
    E_ijkl = '1 2 3' # In Forest notation this is lambda=1 (this is unimportant), mu=2, mu_c=3
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[VectorPostprocessors]
  [./soln]
    type = LineValueSampler
    warn_discontinuous_face_values = false
    sort_by = y
    variable = 'disp_x wc_z stress_yx couple_stress_zy'
    start_point = '0 0 0'
    end_point = '0 1 0'
    num_points = 11
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = cosserat_glide_out
  exodus = true
  csv = true
[]
(modules/solid_mechanics/test/tests/jacobian/cwpc02.i)
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '1 0.1 0.2  0.1 1 0.3  0 0 2' # not symmetric
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0.1
    smoothing_tol = 0.1
    yield_function_tol = 1E-5
  [../]
[]
[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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update24_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Tensile + shear failure, starting from a non-symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E2
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E8
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 4E1
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1E3
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0E3
    joint_shear_stiffness = 1.0E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    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
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1E3
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 0.5
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/examples/coal_mining/coarse.i)
# Strata deformation and fracturing around a coal mine - 3D model
#
# A "half model" is used.  The mine is 400m deep and
# just the roof is studied (-400<=z<=0).  The mining panel
# sits between 0<=x<=150, and 0<=y<=1000, so this simulates
# a coal panel that is 300m wide and 1000m long.  The outer boundaries
# are 1km from the excavation boundaries.
#
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions for this simulation are:
#  - disp_x = 0 at x=0 and x=1150
#  - disp_y = 0 at y=-1000 and y=1000
#  - disp_z = 0 at z=-400, but there is a time-dependent
#               Young's modulus that simulates excavation
#  - wc_x = 0 at y=-1000 and y=1000
#  - wc_y = 0 at x=0 and x=1150
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = 0.025*z MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
#
[Mesh]
  [file]
    type = FileMeshGenerator
    file = mesh/coarse.e
  []
  [./xmin]
    input = file
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = xmin
    normal = '-1 0 0'
  [../]
  [./xmax]
    input = xmin
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = xmax
    normal = '1 0 0'
  [../]
  [./ymin]
    input = xmax
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = ymin
    normal = '0 -1 0'
  [../]
  [./ymax]
    input = ymin
    type = SideSetsAroundSubdomainGenerator
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    new_boundary = ymax
    normal = '0 1 0'
  [../]
  [./zmax]
    input = ymax
    type = SideSetsAroundSubdomainGenerator
    block = 16
    new_boundary = zmax
    normal = '0 0 1'
  [../]
  [./zmin]
    input = zmax
    type = SideSetsAroundSubdomainGenerator
    block = 2
    new_boundary = zmin
    normal = '0 0 -1'
  [../]
  [./excav]
    type = SubdomainBoundingBoxGenerator
    input = zmin
    block_id = 1
    bottom_left = '0 0 -400'
    top_right = '150 1000 -397'
  [../]
  [./roof]
    type = SideSetsAroundSubdomainGenerator
    block = 1
    input = excav
    new_boundary = roof
    normal = '0 0 1'
  [../]
[]
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_y
    component = 1
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin xmax'
    value = 0.0
  [../]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin ymax'
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = zmin
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'ymin ymax'
    value = 0.0
  [../]
  [./no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'xmin xmax'
    value = 0.0
  [../]
  [./roof]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = roof
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '0.8*2500*10E-6*z'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '2500*10E-6*z'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '17.0   0    1000.0 1E-9 1 60'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  [../]
  [./density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '17.0   0    1000.0 0 2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  [../]
  [./elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  [../]
  [./stress_0]
    type = ComputeMultipleInelasticCosseratStress
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./stress_1]
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density_0]
    type = GenericConstantMaterial
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
    prop_names = density
    prop_values = 2500
  [../]
  [./density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Postprocessors]
  [./min_roof_disp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = disp_z
  [../]
  [./min_surface_disp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = disp_z
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' bjacobi  gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.5 # this gives min(disp_z)=-4.3, use dt=0.0625 if you want to restrict disp_z>=-3.2
  end_time = 17.0
[]
[Outputs]
  time_step_interval = 1
  print_linear_residuals = false
  exodus = true
  csv = true
  console = true
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update34_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Compressive + shear failure, starting from a non-symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E2
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 4E1
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1E3
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0
    joint_shear_stiffness = 1.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    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.1'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1E3
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 0.5
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update33_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Compressive + shear failure, starting from a symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 4E1
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0
    joint_shear_stiffness = 1.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '-10 -12 14  -12 -5 -20  14 -20 -8'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 0.5
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_mc_only.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a transverse section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 300m deep
# and just the roof is studied (0<=z<=300).  The model sits
# between 0<=y<=450.  The excavation sits in 0<=y<=150.  This
# is a "half model": the boundary conditions are such that
# the model simulates an excavation sitting in -150<=y<=150
# inside a model of the region -450<=y<=450.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).  Mining is simulated by moving the excavation's
# roof down, until disp_z=-3 at t=1.
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=0 and y=450
#  - disp_z = 0 for y>150
#  - disp_z = -3 at maximum, for 0<=y<=150.  See excav function.
# That is, rollers on the sides, free at top, and prescribed at bottom.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Below you will see weak-plane parameters and AuxVariables, etc.
# These are not actally used in this example.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa, varying down to 1 MPa when tensile strain = 1
#
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 400.0
    bias_z = 1.1
    ny = 30 # make this a multiple of 3, so y=150 is at a node
    ymin = 0
    ymax = 450
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 150 3'
    input = bottom
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    new_boundary = 21
    primary_block = 0
    paired_block = 1
    input = excav
  []
  [hole]
    type = BlockDeletionGenerator
    block = 1
    input = roof
  []
[]
[GlobalParams]
  block = 0
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12 16 21' # note addition of 16 and 21
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
  [./roof]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 21
    function = excav_sideways
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(400-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(400-z)'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*max(min((t/end_t*(ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
  [./excav_downwards]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*t/end_t*max(min(((ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1.0
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
    eigenstrain_name = ini_stress
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = mc
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density]
    type = GenericConstantMaterial
    prop_names = density
    prop_values = 2500
  [../]
[]
[Postprocessors]
  [./subsidence]
    type = PointValue
    point = '0 0 400'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.2
  end_time = 0.2
[]
[Outputs]
  file_base = cosserat_mc_only
  time_step_interval = 1
  print_linear_residuals = false
  csv = true
  exodus = true
  [./console]
    type = Console
    output_linear = false
  [../]
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat06.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_couple y_couple z_couple x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1111 1112 1113 1121 1122 1123 1131 1132 1133   1112 1212 1213 1221 1222 1223 1231 1232 1233    1113 1213 1313 1321 1322 1323 1331 1332 1333     1121 1221 1321 2121 2122 2123 2131 2132 2133     1122 1222 1322 2122 2222 2223 2231 2232 2233     1123 1223 1323 2123 2223 2323 2331 2332 2333     1131 1231 1331 2131 2231 2331 3131 3132 3133     1132 1232 1332 2132 2232 2332 3132 3232 3233     1133 1233 1333 2133 2233 2333 3133 3233 3333'
    fill_method_bending = 'general'
    E_ijkl = '1111 1112 1113 1121 1122 1123 1131 1132 1133   1112 1212 1213 1221 1222 1223 1231 1232 1233    1113 1213 1313 1321 1322 1323 1331 1332 1333     1121 1221 1321 2121 2122 2123 2131 2132 2133     1122 1222 1322 2122 2222 2223 2231 2232 2233     1123 1223 1323 2123 2223 2323 2331 2332 2333     1131 1231 1331 2131 2231 2331 3131 3132 3133     1132 1232 1332 2132 2232 2332 3132 3232 3233     1133 1233 1333 2133 2233 2333 3133 3233 3333'
    fill_method = 'general'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/static_deformations/cosserat_glide_fake_plastic.i)
# Example taken from Appendix A of
# S Forest "Mechanics of Cosserat media An introduction".  Available from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.154.4476&rep=rep1&type=pdf
#
# This example uses plasticity, but with inifinitely large yield strength, so it is really elasticity
#
# Analytically, the displacements are
# wc_z = B sinh(w_e y)
# disp_x = (2 mu_c B / w_e / (mu + mu_c)) (1 - cosh(w_e y))
# with w_e^2 = 2 mu mu_c / be / (mu + mu_c)
# and B = arbitrary integration constant
#
# Also, the only nonzero stresses are
# m_zy = 2 B be w_e cosh(w_e y)
# si_yx = -4 mu mu_c/(mu + mu_c) B sinh(w_e y)
#
# MOOSE gives these stress components correctly.
# However, it also gives a seemingly non-zero si_xy
# component.  Upon increasing the resolution of the
# mesh (ny=10000, for example), the stress components
# are seen to limit correctly to the above forumlae
#
# I use mu = 2, mu_c = 3, be = 0.6, so w_e = 2
# Also i use B = 1, so at y = 1
# wc_z = 3.626860407847
# disp_x = -1.65731741465
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 100
  ymax = 1
  nz = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./disp_x_zero_at_y_zero]
    type = DirichletBC
    variable = disp_x
    boundary = bottom
    value = 0
  [../]
  [./disp_x_fixed_at_y_max]
    type = DirichletBC
    variable = disp_x
    boundary = top
    value = -1.65731741465
  [../]
  [./no_dispy]
    type = DirichletBC
    variable = disp_y
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_dispz]
    type = DirichletBC
    variable = disp_z
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'back front bottom top left right'
    value = 0
  [../]
  [./wc_z_zero_at_y_zero]
    type = DirichletBC
    variable = wc_z
    boundary = bottom
    value = 0
  [../]
  [./wc_z_fixed_at_y_max]
    type = DirichletBC
    variable = wc_z
    boundary = top
    value = 3.626860407847
  [../]
[]
[AuxVariables]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1.1 0.6 0.6' # In Forest notation this is alpha=1.1 (this is unimportant), beta=gamma=0.6.
    fill_method_bending = 'general_isotropic'
    E_ijkl = '1 2 3' # In Forest notation this is lambda=1 (this is unimportant), mu=2, mu_c=3
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./stress_fake_plasticity]
    type = ComputeMultiPlasticityStress
    ep_plastic_tolerance = 1E-12
  [../]
[]
[VectorPostprocessors]
  [./soln]
    type = LineValueSampler
    warn_discontinuous_face_values = false
    sort_by = y
    variable = 'disp_x wc_z stress_yx couple_stress_zy'
    start_point = '0 0 0'
    end_point = '0 1 0'
    num_points = 11
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = cosserat_glide_fake_plastic_out
  exodus = false
  csv = true
[]
(modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_02.i)
# apply shears and Cosserat rotations and observe the stresses and moment-stresses
# with
# young = 0.7
# poisson = 0.2
# layer_thickness = 0.1
# joint_normal_stiffness = 0.25
# joint_shear_stiffness = 0.2
# then
# a0000 = 0.730681
# a0011 = 0.18267
# a2222 = 0.0244221
# a0022 = 0.006055
# a0101 = 0.291667
# a66 = 0.018717
# a77 = 0.155192
# b0110 = 0.000534
# b0101 = 0.000107
# and with
# u_x = y + 2*z
# u_y = x -1.5*z
# u_z = 1.1*x - 2.2*y
# wc_x = 0.5
# wc_y = 0.8
# then
# strain_xx = 0
# strain_xy = 1
# strain_xz = 2 - 0.8 = 1.2
# strain_yx = 1
# strain_yy = 0
# strain_yz = -1.5 + 0.5 = -1
# strain_zx = 1.1 + 0.8 = 1.9
# strain_zy = -2.2 - 0.5 = -2.7
# strain_zz = 0
# so that
# stress_xy = a0101*(1+1) = 0.583333
# stress_xz = a66*1.2 + a66*1.9 = 0.058021
# stress_yx = a0101*(1+1) = 0.583333
# stress_yz = a66*(-1) + a66*(-2.7) = -0.06925
# old stress_zx = a77*1.2 + a66*1.9 = 0.221793
# old stress_zy = a77*(-1) + a66*(-2.7) = -0.205728
# stress_zx = a66*1.2 + a77*1.9 = 0.317325
# stress_zy = a66*(-1) + a77*(-2.7) = -0.437735
# and all others zero
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  ymax = 1
  nz = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./strain_xx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'left right'
    function = 'y+2*z'
  [../]
  [./strain_yy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'bottom top'
    function = 'x-1.5*z'
  [../]
  [./strain_zz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'back front'
    function = '1.1*x-2.2*y'
  [../]
  [./wc_x]
    type = FunctionDirichletBC
    variable = wc_x
    boundary = 'left right'
    function = 0.5
  [../]
  [./wc_y]
    type = FunctionDirichletBC
    variable = wc_y
    boundary = 'left right'
    function = 0.8
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 0.7
    poisson = 0.2
    layer_thickness = 0.1
    joint_normal_stiffness = 0.25
    joint_shear_stiffness = 0.2
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = layered_cosserat_02
  csv = true
[]
(modules/solid_mechanics/test/tests/capped_mohr_coulomb/small_deform1_cosserat.i)
# Using Cosserat with large layer thickness, so this should reduce to standard
# Using CappedMohrCoulombCosserat with tensile failure only
# checking for small deformation
# A single element is stretched by 1E-6m in z direction, and by small amounts in x and y directions
# stress_zz = Youngs Modulus*Strain = 2E6*1E-6 = 2 Pa
# tensile_strength is set to 1Pa
# Then the final stress should return to the yeild surface and the minimum principal stress value should be 1pa.
[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
[]
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '0.1E-6*x'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '0.2E-6*y'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = '1E-6*z'
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./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
  [../]
  [./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
  [../]
  [./yield_fcn_auxk]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    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
  [../]
  [./f]
    type = PointValue
    point = '0 0 0'
    variable = yield_fcn
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./ang]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 4.0E6
    poisson = 0.0
    layer_thickness = 1.0
    joint_normal_stiffness = 1.0E16
    joint_shear_stiffness = 1.0E16
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./tensile]
    type = CappedMohrCoulombCosseratStressUpdate
    tensile_strength = ts
    compressive_strength = ts
    cohesion = coh
    friction_angle = ang
    dilation_angle = ang
    smoothing_tol = 0.0
    yield_function_tol = 1.0E-9
    host_youngs_modulus = 4.0E6
    host_poissons_ratio = 0.0
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = tensile
    perform_finite_strain_rotations = false
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  nl_abs_tol = 1E-10
  type = Transient
[]
[Outputs]
  file_base = small_deform1_cosserat
  csv = true
[]
(modules/porous_flow/examples/coal_mining/fine_with_fluid.i)
#################################################################
#
#  NOTE:
#  The mesh for this model is too large for the MOOSE repository
#  so is kept in the the large_media submodule
#
#################################################################
#
# Strata deformation and fluid flow aaround a coal mine - 3D model
#
# A "half model" is used.  The mine is 400m deep and
# just the roof is studied (-400<=z<=0).  The mining panel
# sits between 0<=x<=150, and 0<=y<=1000, so this simulates
# a coal panel that is 300m wide and 1000m long.  The outer boundaries
# are 1km from the excavation boundaries.
#
# The excavation takes 0.5 years.
#
# The boundary conditions for this simulation are:
#  - disp_x = 0 at x=0 and x=1150
#  - disp_y = 0 at y=-1000 and y=1000
#  - disp_z = 0 at z=-400, but there is a time-dependent
#               Young modulus that simulates excavation
#  - wc_x = 0 at y=-1000 and y=1000
#  - wc_y = 0 at x=0 and x=1150
#  - no flow at x=0, z=-400 and z=0
#  - fixed porepressure at y=-1000, y=1000 and x=1150
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# A single-phase unsaturated fluid is used.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa, and time units are measured in years.
#
# The initial porepressure is hydrostatic with P=0 at z=0, so
# Porepressure ~ - 0.01*z MPa, where the fluid has density 1E3 kg/m^3 and
# gravity = = 10 m.s^-2 = 1E-5 MPa m^2/kg.
# To be more accurate, i use
# Porepressure = -bulk * log(1 + g*rho0*z/bulk)
# where bulk=2E3 MPa and rho0=1Ee kg/m^3.
# The initial stress is consistent with the weight force from undrained
# density 2500 kg/m^3, and fluid porepressure, and a Biot coefficient of 0.7, ie,
# stress_zz^effective = 0.025*z + 0.7 * initial_porepressure
# The maximum and minimum principal horizontal effective stresses are
# assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 2 MPa
# MC friction angle = 35 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa
# WeakPlane cohesion = 0.1 MPa
# WeakPlane friction angle = 30 deg
# WeakPlane dilation angle = 10 deg
# WeakPlane tensile strength = 0.1 MPa
# WeakPlane compressive strength = 100 MPa softening to 1 MPa at strain = 1
# Fluid density at zero porepressure = 1E3 kg/m^3
# Fluid bulk modulus = 2E3 MPa
# Fluid viscosity = 1.1E-3 Pa.s = 1.1E-9 MPa.s = 3.5E-17 MPa.year
#
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
  PorousFlowDictator = dictator
  biot_coefficient = 0.7
[]
[Mesh]
  [file]
    type = FileMeshGenerator
    file = fine.e
  []
  [xmin]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = xmin
    normal = '-1 0 0'
    input = file
  []
  [xmax]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = xmax
    normal = '1 0 0'
    input = xmin
  []
  [ymin]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = ymin
    normal = '0 -1 0'
    input = xmax
  []
  [ymax]
    type = SideSetsAroundSubdomainGenerator
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    new_boundary = ymax
    normal = '0 1 0'
    input = ymin
  []
  [zmax]
    type = SideSetsAroundSubdomainGenerator
    block = 30
    new_boundary = zmax
    normal = '0 0 1'
    input = ymax
  []
  [zmin]
    type = SideSetsAroundSubdomainGenerator
    block = 2
    new_boundary = zmin
    normal = '0 0 -1'
    input = zmax
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    input = zmin
    block_id = 1
    bottom_left = '0 0 -400'
    top_right = '150 1000 -397'
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    primary_block = 3
    paired_block = 1
    input = excav
    new_boundary = roof
  []
[]
[Variables]
  [disp_x]
  []
  [disp_y]
  []
  [disp_z]
  []
  [wc_x]
  []
  [wc_y]
  []
  [porepressure]
    scaling = 1E-5
  []
[]
[ICs]
  [porepressure]
    type = FunctionIC
    variable = porepressure
    function = ini_pp
  []
[]
[Kernels]
  [cx_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  []
  [cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  []
  [cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  []
  [x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  []
  [y_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  []
  [x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  []
  [y_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_y
    component = 1
  []
  [gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  []
  [poro_x]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    variable = disp_x
    component = 0
  []
  [poro_y]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  []
  [poro_z]
    type = PorousFlowEffectiveStressCoupling
    use_displaced_mesh = false
    component = 2
    variable = disp_z
  []
  [poro_vol_exp]
    type = PorousFlowMassVolumetricExpansion
    use_displaced_mesh = false
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    variable = porepressure
    fluid_component = 0
  []
  [mass0]
    type = PorousFlowMassTimeDerivative
    use_displaced_mesh = false
    fluid_component = 0
    variable = porepressure
  []
  [flux]
    type = PorousFlowAdvectiveFlux
    use_displaced_mesh = false
    variable = porepressure
    gravity = '0 0 -10E-6'
    fluid_component = 0
  []
[]
[AuxVariables]
  [saturation]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_x]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_y]
    order = CONSTANT
    family = MONOMIAL
  []
  [darcy_z]
    order = CONSTANT
    family = MONOMIAL
  []
  [porosity]
    order = CONSTANT
    family = MONOMIAL
  []
  [wc_z]
  []
  [stress_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_xy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_xz]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_yz]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zx]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zy]
    order = CONSTANT
    family = MONOMIAL
  []
  [stress_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_xz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_yz]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zx]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zy]
    order = CONSTANT
    family = MONOMIAL
  []
  [total_strain_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_xx]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_yy]
    order = CONSTANT
    family = MONOMIAL
  []
  [perm_zz]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_shear]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_shear]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  []
  [mc_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[AuxKernels]
  [saturation_water]
    type = PorousFlowPropertyAux
    variable = saturation
    property = saturation
    phase = 0
    execute_on = timestep_end
  []
  [darcy_x]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_x
    gravity = '0 0 -10E-6'
    component = x
  []
  [darcy_y]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_y
    gravity = '0 0 -10E-6'
    component = y
  []
  [darcy_z]
    type = PorousFlowDarcyVelocityComponent
    variable = darcy_z
    gravity = '0 0 -10E-6'
    component = z
  []
  [porosity]
    type = PorousFlowPropertyAux
    property = porosity
    variable = porosity
    execute_on = timestep_end
  []
  [stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
    execute_on = timestep_end
  []
  [stress_xy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xy
    index_i = 0
    index_j = 1
    execute_on = timestep_end
  []
  [stress_xz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xz
    index_i = 0
    index_j = 2
    execute_on = timestep_end
  []
  [stress_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
    execute_on = timestep_end
  []
  [stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
    execute_on = timestep_end
  []
  [stress_yz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yz
    index_i = 1
    index_j = 2
    execute_on = timestep_end
  []
  [stress_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
    execute_on = timestep_end
  []
  [stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
    execute_on = timestep_end
  []
  [stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xx
    index_i = 0
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xy
    index_i = 0
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_xz
    index_i = 0
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yx
    index_i = 1
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yy
    index_i = 1
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_yz
    index_i = 1
    index_j = 2
    execute_on = timestep_end
  []
  [total_strain_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zx
    index_i = 2
    index_j = 0
    execute_on = timestep_end
  []
  [total_strain_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zy
    index_i = 2
    index_j = 1
    execute_on = timestep_end
  []
  [total_strain_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = total_strain_zz
    index_i = 2
    index_j = 2
    execute_on = timestep_end
  []
  [perm_xx]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_xx
    row = 0
    column = 0
    execute_on = timestep_end
  []
  [perm_yy]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_yy
    row = 1
    column = 1
    execute_on = timestep_end
  []
  [perm_zz]
    type = PorousFlowPropertyAux
    property = permeability
    variable = perm_zz
    row = 2
    column = 2
    execute_on = timestep_end
  []
  [mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
    execute_on = timestep_end
  []
  [mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
    execute_on = timestep_end
  []
  [wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
    execute_on = timestep_end
  []
  [wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
    execute_on = timestep_end
  []
  [mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
    execute_on = timestep_end
  []
  [mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
    execute_on = timestep_end
  []
  [wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
    execute_on = timestep_end
  []
  [wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
    execute_on = timestep_end
  []
[]
[BCs]
  [no_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'xmin xmax'
    value = 0.0
  []
  [no_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'ymin ymax'
    value = 0.0
  []
  [no_z]
    type = DirichletBC
    variable = disp_z
    boundary = zmin
    value = 0.0
  []
  [no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'ymin ymax'
    value = 0.0
  []
  [no_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'xmin xmax'
    value = 0.0
  []
  [fix_porepressure]
    type = FunctionDirichletBC
    variable = porepressure
    boundary = 'ymin ymax xmax'
    function = ini_pp
  []
  [roof_porepressure]
    type = PorousFlowPiecewiseLinearSink
    variable = porepressure
    pt_vals = '-1E3 1E3'
    multipliers = '-1 1'
    fluid_phase = 0
    flux_function = roof_conductance
    boundary = roof
  []
  [roof]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = roof
  []
[]
[Functions]
  [ini_pp]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0'
    symbol_values = '2E3 0.0 1E-5 1E3'
    expression = '-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk)'
  []
  [ini_xx]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0 biot'
    symbol_values = '2E3 0.0 1E-5 1E3  0.7'
    expression = '0.8*(2500*10E-6*z+biot*(-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk)))'
  []
  [ini_zz]
    type = ParsedFunction
    symbol_names = 'bulk p0 g    rho0 biot'
    symbol_values = '2E3 0.0 1E-5 1E3  0.7'
    expression = '2500*10E-6*z+biot*(-bulk*log(exp(-p0/bulk)+g*rho0*z/bulk))'
  []
  [excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '0.5   0    1000.0 1E-9 1 10'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  []
  [density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '0.5   0    1000.0 0 2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  []
  [roof_conductance]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax   maxval minval'
    symbol_values = '0.5   0    1000.0 1E7      0'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),maxval,minval)'
  []
[]
[UserObjects]
  [dictator]
    type = PorousFlowDictator
    porous_flow_vars = 'porepressure disp_x disp_y disp_z'
    number_fluid_phases = 1
    number_fluid_components = 1
  []
  [pc]
    type = PorousFlowCapillaryPressureVG
    m = 0.5
    alpha = 1 # MPa^-1
  []
  [mc_coh_strong_harden]
    type = TensorMechanicsHardeningExponential
    value_0 = 1.99 # MPa
    value_residual = 2.01 # MPa
    rate = 1.0
  []
  [mc_fric]
    type = TensorMechanicsHardeningConstant
    value = 0.61 # 35deg
  []
  [mc_dil]
    type = TensorMechanicsHardeningConstant
    value = 0.15 # 8deg
  []
  [mc_tensile_str_strong_harden]
    type = TensorMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  []
  [mc_compressive_str]
    type = TensorMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  []
  [wp_coh_harden]
    type = TensorMechanicsHardeningCubic
    value_0 = 0.05
    value_residual = 0.05
    internal_limit = 10
  []
  [wp_tan_fric]
    type = TensorMechanicsHardeningConstant
    value = 0.26 # 15deg
  []
  [wp_tan_dil]
    type = TensorMechanicsHardeningConstant
    value = 0.18 # 10deg
  []
  [wp_tensile_str_harden]
    type = TensorMechanicsHardeningCubic
    value_0 = 0.05
    value_residual = 0.05
    internal_limit = 10
  []
  [wp_compressive_str_soften]
    type = TensorMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1
    internal_limit = 1.0
  []
[]
[FluidProperties]
  [simple_fluid]
    type = SimpleFluidProperties
    bulk_modulus = 2E3
    density0 = 1000
    thermal_expansion = 0
    viscosity = 3.5E-17
  []
[]
[Materials]
  [temperature]
    type = PorousFlowTemperature
  []
  [eff_fluid_pressure]
    type = PorousFlowEffectiveFluidPressure
  []
  [vol_strain]
    type = PorousFlowVolumetricStrain
  []
  [ppss]
    type = PorousFlow1PhaseP
    porepressure = porepressure
    capillary_pressure = pc
  []
  [massfrac]
    type = PorousFlowMassFraction
  []
  [simple_fluid]
    type = PorousFlowSingleComponentFluid
    fp = simple_fluid
    phase = 0
  []
  [porosity_for_aux]
    type = PorousFlowPorosity
    at_nodes = false
    fluid = true
    mechanical = true
    ensure_positive = true
    porosity_zero = 0.02
    solid_bulk = 5.3333E3
  []
  [porosity_bulk]
    type = PorousFlowPorosity
    fluid = true
    mechanical = true
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    ensure_positive = true
    porosity_zero = 0.02
    solid_bulk = 5.3333E3
  []
  [porosity_excav]
    type = PorousFlowPorosityConst
    block = 1
    porosity = 1.0
  []
  [permeability_bulk]
    type = PorousFlowPermeabilityKozenyCarman
    block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    poroperm_function = kozeny_carman_phi0
    k0 = 1E-15
    phi0 = 0.02
    n = 2
    m = 2
  []
  [permeability_excav]
    type = PorousFlowPermeabilityConst
    block = 1
    permeability = '0 0 0   0 0 0   0 0 0'
  []
  [relperm]
    type = PorousFlowRelativePermeabilityCorey
    n = 4
    s_res = 0.4
    sum_s_res = 0.4
    phase = 0
  []
  [elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  []
  [elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  []
  [strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  []
  [ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  []
  [stress_0]
    type = ComputeMultipleInelasticCosseratStress
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  []
  [stress_1]
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  []
  [mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  []
  [wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.05
    smoothing_tol = 0.05 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  []
  [undrained_density_0]
    type = GenericConstantMaterial
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    prop_names = density
    prop_values = 2500
  []
  [undrained_density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  []
[]
[Preconditioning]
  [SMP]
    type = SMP
    full = true
  []
[]
[Postprocessors]
  [min_roof_disp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = disp_z
  []
  [min_roof_pp]
    type = NodalExtremeValue
    boundary = roof
    value_type = min
    variable = porepressure
  []
  [min_surface_disp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = disp_z
  []
  [min_surface_pp]
    type = NodalExtremeValue
    boundary = zmax
    value_type = min
    variable = porepressure
  []
  [max_perm_zz]
    type = ElementExtremeValue
     block = '2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30'
    variable = perm_zz
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  # best overall
  petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
  petsc_options_value = ' lu       mumps'
  # best if you don't have mumps:
  #petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  #petsc_options_value = ' asm      2              lu            gmres     200'
  # very basic:
  #petsc_options_iname = '-pc_type -ksp_type -ksp_gmres_restart'
  #petsc_options_value = ' bjacobi  gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 200
  nl_max_its = 30
  start_time = 0.0
  dt = 0.0025
  end_time = 0.5
[]
[Outputs]
  time_step_interval = 1
  print_linear_residuals = true
  exodus = true
  csv = true
  console = true
[]
(modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat3.i)
# Plastic deformation.  Layered Cosserat with parameters:
# Young = 10.0
# Poisson = 0.25
# layer_thickness = 10
# joint_normal_stiffness = 2.5
# joint_shear_stiffness = 2.0
# These give the following nonzero components of the elasticity tensor:
# E_0000 = E_1111 = 1.156756756757E+01
# E_0011 = E_1100 = 3.855855855856E+00
# E_2222 = E_pp = 8.108108108108E+00
# E_0022 = E_1122 = E_2200 = E_2211 = 2.702702702703E+00
# G = E_0101 = E_0110 = E_1001 = E_1010 = 4
# Gt = E_qq = E_0202 = E_0220 = E_2002 = E_1212 = E_1221 = E_2112 = 3.333333333333E+00
# E_2020 = E_2121 = 3.666666666667E+00
# They give the following nonzero components of the bending rigidity tensor:
# D = 8.888888888889E+02
# B_0101 = B_1010 = 8.080808080808E+00
# B_0110 = B_1001 = -2.020202020202E+00
#
# Applying the following deformation to the zmax surface of a unit cube:
# disp_x = 32*t/Gt
# disp_y = 24*t/Gt
# disp_z = 10*t/E_2222
# omega_x = omega_y = omega_z = 0
# yields the following strains:
# strain_xz = 32*t/Gt = 9.6*t
# strain_yz = 24*t/Gt = 7.2*t
# strain_zz = 10*t/E_2222 = 1.23333333*t
# and all other components, and the curvature, are zero.
# The nonzero components of stress are therefore:
# stress_xx = stress_yy = 3.33333*t
# stress_xz = stress_zx = 32*t
# stress_yz = stress_zy = 24*t
# stress_zz = 10*t
# The moment stress is zero.
# So q = 40*t and p = 10*t
#
# Use tan(friction_angle) = 0.5 and tan(dilation_angle) = E_qq/Epp/2, and cohesion=20,
# the system should return to p=0, q=20, ie stress_zz=0, stress_xz=16,
# stress_yz=12 on the first time step (t=1)
# and
# stress_xx = stress_yy = 0
# and
# stress_zx = 32, and stress_zy = 24.
# Although this has resulted in a non-symmetric stress tensor, the
# moments generated are cancelled by the boundary conditions on
# omega_x and omega_y.  (Removing these boundary conditions results
# in a symmetric stress tensor, and some omega!=0 being generated.)
# No moment stresses are generated because omega=0=curvature.
#
# The total strains are given above (strain_xz = 9.6,
# strain_yz = 7.2 and strain_zz = 1.23333).
# Since q returned from 40 to 20, plastic_strain_xz = strain_xz/2 = 4.8
# and plastic_strain_yz = strain_yz/2 = 3.6.
# Since p returned to zero, all of the total strain_zz is
# plastic, ie plastic_strain_zz = 1.23333
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./bottomx]
    type = DirichletBC
    variable = disp_x
    boundary = back
    value = 0.0
  [../]
  [./bottomy]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0.0
  [../]
  [./bottomz]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0.0
  [../]
  [./bottom_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = back
    value = 0.0
  [../]
  [./bottom_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = back
    value = 0.0
  [../]
  [./topx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = front
    function = 32*t/3.333333333333E+00
  [../]
  [./topy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = front
    function = 24*t/3.333333333333E+00
  [../]
  [./topz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = 10*t/8.108108108108E+00
  [../]
  [./top_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = front
    value = 0.0
  [../]
  [./top_wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = front
    value = 0.0
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strainp_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_compressive]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ls]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./strainp_xx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xx
    index_i = 0
    index_j = 0
  [../]
  [./strainp_xy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xy
    index_i = 0
    index_j = 1
  [../]
  [./strainp_xz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xz
    index_i = 0
    index_j = 2
  [../]
  [./strainp_yx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yx
    index_i = 1
    index_j = 0
  [../]
  [./strainp_yy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yy
    index_i = 1
    index_j = 1
  [../]
  [./strainp_yz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yz
    index_i = 1
    index_j = 2
  [../]
  [./strainp_zx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zx
    index_i = 2
    index_j = 0
  [../]
  [./strainp_zy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zy
    index_i = 2
    index_j = 1
  [../]
  [./strainp_zz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zz
    index_i = 2
    index_j = 2
  [../]
  [./straint_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xx
    index_i = 0
    index_j = 0
  [../]
  [./straint_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xy
    index_i = 0
    index_j = 1
  [../]
  [./straint_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xz
    index_i = 0
    index_j = 2
  [../]
  [./straint_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yx
    index_i = 1
    index_j = 0
  [../]
  [./straint_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yy
    index_i = 1
    index_j = 1
  [../]
  [./straint_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yz
    index_i = 1
    index_j = 2
  [../]
  [./straint_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zx
    index_i = 2
    index_j = 0
  [../]
  [./straint_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zy
    index_i = 2
    index_j = 1
  [../]
  [./straint_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zz
    index_i = 2
    index_j = 2
  [../]
  [./f_shear]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    variable = f_shear
  [../]
  [./f_tensile]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 1
    variable = f_tensile
  [../]
  [./f_compressive]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 2
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 0
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 1
    variable = intnl_tensile
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./ls]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = ls
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
  [./strainp_xx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xx
  [../]
  [./strainp_xy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xy
  [../]
  [./strainp_xz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xz
  [../]
  [./strainp_yx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yx
  [../]
  [./strainp_yy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yy
  [../]
  [./strainp_yz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yz
  [../]
  [./strainp_zx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zx
  [../]
  [./strainp_zy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zy
  [../]
  [./strainp_zz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zz
  [../]
  [./straint_xx]
    type = PointValue
    point = '0 0 0'
    variable = straint_xx
  [../]
  [./straint_xy]
    type = PointValue
    point = '0 0 0'
    variable = straint_xy
  [../]
  [./straint_xz]
    type = PointValue
    point = '0 0 0'
    variable = straint_xz
  [../]
  [./straint_yx]
    type = PointValue
    point = '0 0 0'
    variable = straint_yx
  [../]
  [./straint_yy]
    type = PointValue
    point = '0 0 0'
    variable = straint_yy
  [../]
  [./straint_yz]
    type = PointValue
    point = '0 0 0'
    variable = straint_yz
  [../]
  [./straint_zx]
    type = PointValue
    point = '0 0 0'
    variable = straint_zx
  [../]
  [./straint_zy]
    type = PointValue
    point = '0 0 0'
    variable = straint_zy
  [../]
  [./straint_zz]
    type = PointValue
    point = '0 0 0'
    variable = straint_zz
  [../]
  [./f_shear]
    type = PointValue
    point = '0 0 0'
    variable = f_shear
  [../]
  [./f_tensile]
    type = PointValue
    point = '0 0 0'
    variable = f_tensile
  [../]
  [./f_compressive]
    type = PointValue
    point = '0 0 0'
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = PointValue
    point = '0 0 0'
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = PointValue
    point = '0 0 0'
    variable = intnl_tensile
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
  [./ls]
    type = PointValue
    point = '0 0 0'
    variable = ls
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 20
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
    perform_finite_strain_rotations = false
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0
    smoothing_tol = 0
    yield_function_tol = 1E-5
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = small_deform_cosserat3
  csv = true
[]
(modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_03.i)
# apply deformations and observe the moment-stresses
# with
# young = 0.7
# poisson = 0.2
# layer_thickness = 0.1
# joint_normal_stiffness = 0.25
# joint_shear_stiffness = 0.2
# then
# a0000 = 0.730681
# a0011 = 0.18267
# a2222 = 0.0244221
# a0022 = 0.006055
# a0101 = 0.291667
# a66 = 0.018717
# a77 = 0.310383
# b0101 = 0.000534
# b0110 = -0.000107
# and with
# wc_x = x + 2*y + 3*z
# wc_y = -1.1*x - 2.2*y - 3.3*z
# then
# curvature_xy = 2
# curvature_yx = -1.1
# and all others are either zero at (x,y,z)=(0,0,0) or unimportant for layered Cosserat
# so that
# m_xy = b0101*(2) + b0110*(-1.1) = 0.00118
# m_yx = b0110*2 + b0101*(-1.1) = -0.000801
# and all others zero (at (x,y,z)=(0,0,0))
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 1
  xmin = -1
  xmax = 1
  ymin = -1
  ymax = 1
  zmin = -1
  zmax = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./wc_x]
    type = FunctionDirichletBC
    variable = wc_x
    boundary = 'left right'
    function = 'x+2*y+3*z'
  [../]
  [./wc_y]
    type = FunctionDirichletBC
    variable = wc_y
    boundary = 'left right'
    function = '-1.1*x-2.2*y-3.3*z'
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 0.7
    poisson = 0.2
    layer_thickness = 0.1
    joint_normal_stiffness = 0.25
    joint_shear_stiffness = 0.2
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol -sub_pc_factor_shift_type'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10 NONZERO'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = layered_cosserat_03
  csv = true
[]
(modules/solid_mechanics/test/tests/initial_stress/gravity_cosserat.i)
# Apply an initial stress that should be
# exactly that caused by gravity, and then
# do a transient step to check that nothing
# happens
# TODO: currently this has no div(moment_stress)
# contriution to the Kernels.  This is because
# there is no way in MOOSE of calculating
# moment stresses and applying initial stresses.
# This will become possible after issue #7243 is
# resolved.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  nz = 10
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = -10
  zmax = 0
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
  [./weight]
    type = BodyForce
    variable = disp_z
    value = -0.5 # this is density*gravity
  [../]
[]
[BCs]
  # back = zmin
  # front = zmax
  # bottom = ymin
  # top = ymax
  # left = xmin
  # right = xmax
  [./x]
    type = DirichletBC
    variable = disp_x
    boundary = 'left right'
    value = 0
  [../]
  [./y]
    type = DirichletBC
    variable = disp_y
    boundary = 'bottom top'
    value = 0
  [../]
  [./z]
    type = DirichletBC
    variable = disp_z
    boundary = 'back'
    value = 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
  [../]
[]
[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
  [../]
[]
[Functions]
  [./weight]
    type = ParsedFunction
    expression = '0.5*z' # initial stress that should result from the weight force
  [../]
  [./kxx]
    type = ParsedFunction
    expression = '0.4*z' # some arbitrary xx and yy stress that should not affect the result
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1.1 0.6 0.6' # In Forest notation this is alpha=1.1 (this is unimportant), beta=gamma=0.6.
    fill_method_bending = 'general_isotropic'
    fill_method = symmetric_isotropic
    E_ijkl = '0.4 0.4' # young = 1, poisson = 0.25
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = 'kxx 0 0  0 kxx 0  0 0 weight'
    eigenstrain_name = ini_stress
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  end_time = 1.0
  dt = 1.0
  solve_type = NEWTON
  type = Transient
  nl_abs_tol = 1E-8
  nl_rel_tol = 1E-12
  l_tol = 1E-3
  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 = gravity_cosserat
  exodus = true
[]
(modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_02_apply_disps.i)
# Beam bending.
# Displacements are applied to a beam and stresses and moment-stresses
# are measured.  Note that since these quantities are averaged over
# elements, to get a good agreement with the analytical solution the
# number of elements (nz) should be increased.  Using nx=10
# and nz=10 yields roughly 1% error.
# The displacements applied are a pure-bend around the y axis
# with an additional displacement in the y direction so that
# the result (below) will end up being plane stress (stress_yy=0):
# u_x = Axz
# u_y = Dzy
# u_z = -(A/2)x^2 + (D/2)(z^2-y^2)
# wc_x = -Dy
# wc_y = Ax
# wc_z = 0
# Here A and D are arbitrary constants.
# This results in strains being symmetric, and the only
# nonzero ones are
# ep_xx = Az
# ep_yy = Dz
# ep_zz = Dz
# kappa_xy = -D
# kappa_yx = A
# Then choosing D = -poisson*A gives, for layered Cosserat:
# stress_xx = EAz
# m_yx = (1-poisson^2)*A*B = (1/12)EAh^2 (last equality for joint_shear_stiffness=0)
# where h is the layer thickness.  All other stress and moment-stress
# components are zero.
# The test uses: E=1.2, poisson=0.3, A=1.11E-2, h=2
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 10
  xmax = 10
  ny = 1
  nz = 10
  ymin = -0.5
  ymax = 0.5
  zmin = -0.5
  zmax = 0.5
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./clamp_z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'left right top bottom front back'
    function = '-1.11E-2*x*x/2-0.3*(z*z-y*y)/2.0*1.11E-2'
  [../]
  [./clamp_y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'left right top bottom front back'
    function = '-0.3*z*y*1.11E-2'
  [../]
  [./clamp_x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'left right top bottom front back'
    function = '1.11E-2*x*z'
  [../]
  [./clamp_wc_x]
    type = FunctionDirichletBC
    variable = wc_x
    boundary = 'left right top bottom front back'
    function = '0.3*y*1.11E-2'
  [../]
  [./clamp_wc_y]
    type = FunctionDirichletBC
    variable = wc_y
    boundary = 'left right top bottom front back'
    function = '1.11E-2*x'
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.2
    poisson = 0.3
    layer_thickness = 2.0
    joint_normal_stiffness = 1E16
    joint_shear_stiffness = 1E-15
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol -sub_pc_factor_shift_type'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10 NONZERO'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = beam_cosserat_02_apply_disps
  exodus = true
[]
(modules/solid_mechanics/test/tests/static_deformations/layered_cosserat_01.i)
# apply uniform stretches and observe the stresses
# with
# young = 0.7
# poisson = 0.2
# layer_thickness = 0.1
# joint_normal_stiffness = 0.25
# joint_shear_stiffness = 0.2
# then
# a0000 = 0.730681
# a0011 = 0.18267
# a2222 = 0.0244221
# a0022 = 0.006055
# a0101 = 0.291667
# a66 = 0.018717
# a77 = 0.310383
# b0110 = 0.000534
# b0101 = 0.000107
# and with
# strain_xx = 1
# strain_yy = 2
# strain_zz = 3
# then
# stress_xx = a0000*1 + a0011*2 + a0022*3 = 1.114187
# stress_yy = a0011*1 + a0000*2 + a0022*3 = 1.662197
# stress_zz = a0022*(1+2) + a2222*3 = 0.09083
# and all others zero
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 1
  ny = 1
  ymax = 1
  nz = 1
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./strain_xx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'left right'
    function = x
  [../]
  [./strain_yy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'bottom top'
    function = 2*y
  [../]
  [./strain_zz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'back front'
    function = 3*z
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 0.7
    poisson = 0.2
    layer_thickness = 0.1
    joint_normal_stiffness = 0.25
    joint_shear_stiffness = 0.2
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = layered_cosserat_01
  csv = true
[]
(modules/solid_mechanics/test/tests/capped_mohr_coulomb/small_deform9_cosserat.i)
# Using Cosserat with large layer thickness, so this should reduce to standard
# Using CappedMohrCoulombCosserat with tensile failure only
# A single unit element is stretched in a complicated way that
# the trial stress is
#        1.51515             0.8        0.666667
#            0.8        -3.74545    -1.85037e-17
#            0.7    -1.66533e-17        -1.27273
# with symmetric part
#        1.51515             0.8        0.6833
#            0.8        -3.74545    -1.85037e-17
#            0.6833  -1.66533e-17      -1.27273
#
# This has eigenvalues
# la = {-3.86844, 1.78368, -1.41827}
# and eigenvectors
#
# {0.15183, -0.987598, -0.03997},
# {-0.966321, -0.139815, -0.216044},
# {-0.207777, -0.0714259, 0.975565}}
#
# The tensile strength is 0.5 and Young=1 and Poisson=0.25,
# with E_0000/E_0011 = nu / (1 - nu) = 0.333333
# Using smoothing_tol=0.01, the return-map algorithm should
# return to stress_I = 0.5, which is a reduction of 1.28368, so
# stress_II = -1.41827 - 1.28368 * 0.33333 = -1.846
# stress_III = -3.86844 - 1.28368 * 0.33333 = -4.296
#
# The final stress symmetric stress is
#
# {0.29, 0.69, 0.51},
# {0.69, -4.19, -0.03},
# {0.51, -0.03, -1.74}
#
# and a final unsymmetric stress of
#
# {0.29, 0.69, 0.49},
# {0.69, -4.19, -0.03},
# {0.52, -0.03, -1.74}
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./x]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = 'front back'
    function = '3*x-y+z'
  [../]
  [./y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = 'front back'
    function = '3*x-4*y'
  [../]
  [./z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 'front back'
    function = 'x-2*z'
  [../]
  [./wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'front back'
    value = 0.0
  [../]
  [./wc_y]
    type = DirichletBC
    variable = wc_y
    boundary = 'front back'
    value = 0.0
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_I]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_II]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_III]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f0]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f1]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f2]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_I]
    type = RankTwoScalarAux
    scalar_type = MaxPrincipal
    rank_two_tensor = stress
    variable = stress_I
    selected_qp = 0
  [../]
  [./stress_II]
    type = RankTwoScalarAux
    scalar_type = MidPrincipal
    rank_two_tensor = stress
    variable = stress_II
    selected_qp = 0
  [../]
  [./stress_III]
    type = RankTwoScalarAux
    scalar_type = MinPrincipal
    rank_two_tensor = stress
    variable = stress_III
    selected_qp = 0
  [../]
  [./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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./f0_auxk]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    variable = f0
  [../]
  [./f1_auxk]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 1
    variable = f1
  [../]
  [./f2_auxk]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 2
    variable = f2
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./intnl_auxk]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 1
    variable = intnl
  [../]
[]
[Postprocessors]
  [./s_I]
    type = PointValue
    point = '0 0 0'
    variable = stress_I
  [../]
  [./s_II]
    type = PointValue
    point = '0 0 0'
    variable = stress_II
  [../]
  [./s_III]
    type = PointValue
    point = '0 0 0'
    variable = stress_III
  [../]
  [./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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./f0]
    type = PointValue
    point = '0 0 0'
    variable = f0
  [../]
  [./f1]
    type = PointValue
    point = '0 0 0'
    variable = f1
  [../]
  [./f2]
    type = PointValue
    point = '0 0 0'
    variable = f2
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
  [./intnl]
    type = PointValue
    point = '0 0 0'
    variable = intnl
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./ang]
    type = SolidMechanicsHardeningConstant
    value = 30
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1.0
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./tensile]
    type = CappedMohrCoulombCosseratStressUpdate
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = ang
    dilation_angle = ang
    smoothing_tol = 0.001
    yield_function_tol = 1.0E-12
    host_youngs_modulus = 1.0
    host_poissons_ratio = 0.25
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = tensile
    perform_finite_strain_rotations = false
  [../]
[]
[Executioner]
  end_time = 1
  dt = 1
  nl_abs_tol = 1E-10
  type = Transient
[]
[Outputs]
  file_base = small_deform9_cosserat
  csv = true
[]
(modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat4.i)
# Plastic deformation.  Layered Cosserat with parameters:
# Young = 10.0
# Poisson = 0.25
# layer_thickness = 10
# joint_normal_stiffness = 2.5
# joint_shear_stiffness = 2.0
# These give the following nonzero components of the elasticity tensor:
# E_0000 = E_1111 = 1.156756756757E+01
# E_0011 = E_1100 = 3.855855855856E+00
# E_2222 = E_pp = 8.108108108108E+00
# E_0022 = E_1122 = E_2200 = E_2211 = 2.702702702703E+00
# G = E_0101 = E_0110 = E_1001 = E_1010 = 4
# Gt = E_qq = E_0202 = E_0220 = E_2002 = E_1212 = E_1221 = E_2112 = 3.333333333333E+00
# E_2020 = E_2121 = 3.666666666667E+00
# They give the following nonzero components of the bending rigidity tensor:
# D = 8.888888888889E+02
# B_0101 = B_1010 = 8.080808080808E+00
# B_0110 = B_1001 = -2.020202020202E+00
#
# Applying the following deformation to the zmax surface of a unit cube:
# disp_x = 32*t/Gt
# disp_y = 24*t/Gt
# disp_z = 10*t/E_2222
# but leaving wc_x and wc_y unfixed
# yields the following strains:
# strain_xz = 32*t/Gt - wc_y = 9.6*t - wc_y
# strain_zx = wc_y
# strain_yz = 24*t/Gt + wc_x = 7.2*t + wc_x
# strain_zy = - wc_x
# strain_zz = 10*t/E_2222 = 1.23333333*t
# and all other components, and the curvature, are zero (assuming
# wc is uniform over the cube).
#
# When wc=0, the nonzero components of stress are therefore:
# stress_xx = stress_yy = 3.33333*t
# stress_xz = stress_zx = 32*t
# stress_yz = stress_zy = 24*t
# stress_zz = 10*t
# The moment stress is zero.
# So q = 40*t and p = 10*t
#
# Use tan(friction_angle) = 0.5 and tan(dilation_angle) = E_qq/Epp/2, and cohesion=20,
# the system should return to p=0, q=20, ie stress_zz=0, stress_xz=16,
# stress_yz=12 on the first time step (t=1)
# and
# stress_xx = stress_yy = 0
# and
# stress_zx = 32, and stress_zy = 24.
# This has resulted in a non-symmetric stress tensor, and there is
# zero moment stress, so the system is not in equilibrium.  A
# nonzero wc must therefore be generated.
#
# The obvious choice of wc is such that stress_zx = 16 and
# stress_zy = 12, because then the final returned stress will
# be symmetric.  This gives
# wc_y = - 48
# wc_x = 36
# At t=1, the nonzero components of stress are
# stress_xx = stress_yy = 3.33333
# stress_xz = 32, stress_zx = 16
# stress_yz = 24, stress_zy = 12
# stress_zz = 10*t
# The moment stress is zero.
#
# The returned stress is
# stress_xx = stress_yy = 0
# stress_xz = stress_zx = 16
# stress_yz = stress_zy = 12
# stress_zz = 0
# The total strains are given above.
# Since q returned from 40 to 20, plastic_strain_xz = 9.6/2 = 4.8
# and plastic_strain_yz = 7.2/2 = 3.6.
# Since p returned to zero, all of the total strain_zz is
# plastic, ie plastic_strain_zz = 1.23333
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./bottomx]
    type = DirichletBC
    variable = disp_x
    boundary = back
    value = 0.0
  [../]
  [./bottomy]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0.0
  [../]
  [./bottomz]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0.0
  [../]
  [./topx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = front
    function = 32*t/3.333333333333E+00
  [../]
  [./topy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = front
    function = 24*t/3.333333333333E+00
  [../]
  [./topz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = 10*t/8.108108108108E+00
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strainp_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_compressive]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ls]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./strainp_xx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xx
    index_i = 0
    index_j = 0
  [../]
  [./strainp_xy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xy
    index_i = 0
    index_j = 1
  [../]
  [./strainp_xz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xz
    index_i = 0
    index_j = 2
  [../]
  [./strainp_yx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yx
    index_i = 1
    index_j = 0
  [../]
  [./strainp_yy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yy
    index_i = 1
    index_j = 1
  [../]
  [./strainp_yz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yz
    index_i = 1
    index_j = 2
  [../]
  [./strainp_zx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zx
    index_i = 2
    index_j = 0
  [../]
  [./strainp_zy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zy
    index_i = 2
    index_j = 1
  [../]
  [./strainp_zz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zz
    index_i = 2
    index_j = 2
  [../]
  [./straint_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xx
    index_i = 0
    index_j = 0
  [../]
  [./straint_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xy
    index_i = 0
    index_j = 1
  [../]
  [./straint_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xz
    index_i = 0
    index_j = 2
  [../]
  [./straint_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yx
    index_i = 1
    index_j = 0
  [../]
  [./straint_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yy
    index_i = 1
    index_j = 1
  [../]
  [./straint_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yz
    index_i = 1
    index_j = 2
  [../]
  [./straint_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zx
    index_i = 2
    index_j = 0
  [../]
  [./straint_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zy
    index_i = 2
    index_j = 1
  [../]
  [./straint_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zz
    index_i = 2
    index_j = 2
  [../]
  [./f_shear]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    variable = f_shear
  [../]
  [./f_tensile]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 1
    variable = f_tensile
  [../]
  [./f_compressive]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 2
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 0
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 1
    variable = intnl_tensile
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./ls]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = ls
  [../]
[]
[Postprocessors]
  [./wc_x]
    type = PointValue
    point = '0 0 0'
    variable = wc_x
  [../]
  [./wc_y]
    type = PointValue
    point = '0 0 0'
    variable = wc_y
  [../]
  [./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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
  [./strainp_xx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xx
  [../]
  [./strainp_xy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xy
  [../]
  [./strainp_xz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xz
  [../]
  [./strainp_yx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yx
  [../]
  [./strainp_yy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yy
  [../]
  [./strainp_yz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yz
  [../]
  [./strainp_zx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zx
  [../]
  [./strainp_zy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zy
  [../]
  [./strainp_zz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zz
  [../]
  [./straint_xx]
    type = PointValue
    point = '0 0 0'
    variable = straint_xx
  [../]
  [./straint_xy]
    type = PointValue
    point = '0 0 0'
    variable = straint_xy
  [../]
  [./straint_xz]
    type = PointValue
    point = '0 0 0'
    variable = straint_xz
  [../]
  [./straint_yx]
    type = PointValue
    point = '0 0 0'
    variable = straint_yx
  [../]
  [./straint_yy]
    type = PointValue
    point = '0 0 0'
    variable = straint_yy
  [../]
  [./straint_yz]
    type = PointValue
    point = '0 0 0'
    variable = straint_yz
  [../]
  [./straint_zx]
    type = PointValue
    point = '0 0 0'
    variable = straint_zx
  [../]
  [./straint_zy]
    type = PointValue
    point = '0 0 0'
    variable = straint_zy
  [../]
  [./straint_zz]
    type = PointValue
    point = '0 0 0'
    variable = straint_zz
  [../]
  [./f_shear]
    type = PointValue
    point = '0 0 0'
    variable = f_shear
  [../]
  [./f_tensile]
    type = PointValue
    point = '0 0 0'
    variable = f_tensile
  [../]
  [./f_compressive]
    type = PointValue
    point = '0 0 0'
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = PointValue
    point = '0 0 0'
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = PointValue
    point = '0 0 0'
    variable = intnl_tensile
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
  [./ls]
    type = PointValue
    point = '0 0 0'
    variable = ls
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 20
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
    perform_finite_strain_rotations = false
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0
    smoothing_tol = 0
    yield_function_tol = 1E-5
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = small_deform_cosserat4
  csv = true
[]
(modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_01.i)
# Beam bending.  One end is clamped and the other end is subjected to
# a surface traction.
# The joint normal and shear stiffnesses are set very large, so
# that this situation should be identical to the standard (non-Cosserat)
# isotropic elasticity case.
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 40
  xmax = 10
  ny = 1
  nz = 4
  zmin = -0.5
  zmax = 0.5
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./no_dispy]
    type = DirichletBC
    variable = disp_y
    boundary = 'bottom top'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = 'bottom top back front left right'
    value = 0.0
  [../]
  [./clamp_z]
    type = DirichletBC
    variable = disp_z
    boundary = left
    value = 0.0
  [../]
  [./clamp_x]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0.0
  [../]
  [./end_traction]
    type = VectorNeumannBC
    variable = disp_z
    vector_value = '-2E-4 0 0'
    boundary = right
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[VectorPostprocessors]
  [./soln]
    type = LineValueSampler
    warn_discontinuous_face_values = false
    sort_by = x
    variable = 'disp_x disp_z stress_xx stress_xz stress_zx stress_zz wc_x wc_y  couple_stress_xx couple_stress_xz couple_stress_zx couple_stress_zz'
    start_point = '0 0 0.5'
    end_point = '10 0 0.5'
    num_points = 11
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.2
    poisson = 0.3
    layer_thickness = 1
    joint_normal_stiffness = 1E16
    joint_shear_stiffness = 1E16
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol -sub_pc_factor_shift_type'
    petsc_options_value = 'gmres asm lu 1E-10 1E-14 10 1E-15 1E-10 NONZERO'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = beam_cosserat_01
  csv = true
  exodus = true
[]
(modules/solid_mechanics/test/tests/jacobian/cto29.i)
# CappedDruckerPragerCosserat
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningCubic
    value_0 = 1
    value_residual = 2
    internal_limit = 100
  [../]
  [./cs]
    type = SolidMechanicsHardeningCubic
    value_0 = 5
    value_residual = 3
    internal_limit = 100
  [../]
  [./mc_coh]
    type = SolidMechanicsHardeningCubic
    value_0 = 10
    value_residual = 1
    internal_limit = 100
  [../]
  [./phi]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.8
    value_residual = 0.4
    internal_limit = 50
  [../]
  [./psi]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.4
    value_residual = 0
    internal_limit = 10
  [../]
  [./dp]
    type = SolidMechanicsPlasticDruckerPragerHyperbolic
    mc_cohesion = mc_coh
    mc_friction_angle = phi
    mc_dilation_angle = psi
    yield_function_tolerance = 1E-11     # irrelevant here
    internal_constraint_tolerance = 1E-9 # irrelevant here
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 2.1
    poisson = 0.1
    layer_thickness = 1.0
    joint_normal_stiffness = 3.0
    joint_shear_stiffness = 2.5
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '6 5 4  5.1 7 2  4 2.1 2'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = dp
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    host_youngs_modulus = 2.1
    host_poissons_ratio = 0.1
    DP_model = dp
    tensile_strength = ts
    compressive_strength = cs
    yield_function_tol = 1E-11
    tip_smoother = 0.1
    smoothing_tol = 0.1
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat05.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_couple y_couple z_couple x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1 2.2 2.333 1.9 0.89 2.1'
    fill_method_bending = 'antisymmetric'
    E_ijkl = '1 2.2 2.333 1.9 0.89 2.1'
    fill_method = 'antisymmetric'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/jacobian/cdp_cwp_coss02.i)
#Cosserat capped weak plane and capped drucker prager, coming back to a mix of shear and tensile failure in both
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./mc_coh]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 0.8
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 0.4
  [../]
  [./dp]
    type = SolidMechanicsPlasticDruckerPragerHyperbolic
    mc_cohesion = mc_coh
    mc_friction_angle = phi
    mc_dilation_angle = psi
    yield_function_tolerance = 1E-11     # irrelevant here
    internal_constraint_tolerance = 1E-9 # irrelevant here
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 2
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '1 0.1 0  0.1 2 0  11 12 10' # note unsymmetric
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = 'dp wp'
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    host_youngs_modulus = 10.0
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = dp
    tensile_strength = ts
    compressive_strength = cs
    yield_function_tol = 1E-11
    tip_smoother = 1
    smoothing_tol = 1
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    base_name = wp
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0.1
    smoothing_tol = 0.1
    yield_function_tol = 1E-11
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    #petsc_options = '-snes_test_display'
    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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/test/tests/jacobian/cdpc02.i)
#Cosserat capped weak plane and capped drucker prager
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./mc_coh]
    type = SolidMechanicsHardeningConstant
    value = 4
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 0.8
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 0.4
  [../]
  [./dp]
    type = SolidMechanicsPlasticDruckerPragerHyperbolic
    mc_cohesion = mc_coh
    mc_friction_angle = phi
    mc_dilation_angle = psi
    yield_function_tolerance = 1E-11     # irrelevant here
    internal_constraint_tolerance = 1E-9 # irrelevant here
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '5 1 2  1 4 3  2.1 3.1 1'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = 'dp'
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    host_youngs_modulus = 10.0
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = dp
    tensile_strength = ts
    compressive_strength = cs
    yield_function_tol = 1E-11
    tip_smoother = 1
    smoothing_tol = 1
  [../]
[]
[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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_wp_only.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a transverse section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 300m deep
# and just the roof is studied (0<=z<=300).  The model sits
# between 0<=y<=450.  The excavation sits in 0<=y<=150.  This
# is a "half model": the boundary conditions are such that
# the model simulates an excavation sitting in -150<=y<=150
# inside a model of the region -450<=y<=450.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).  Mining is simulated by moving the excavation's
# roof down, until disp_z=-3 at t=1.
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=0 and y=450
#  - disp_z = 0 for y>150
#  - disp_z = -3 at maximum, for 0<=y<=150.  See excav function.
# That is, rollers on the sides, free at top, and prescribed at bottom.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Below you will see Drucker-Prager parameters and AuxVariables, etc.
# These are not actally used in this example.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# Weak-plane cohesion = 0.1 MPa
# Weak-plane friction angle = 20 deg
# Weak-plane dilation angle = 10 deg
# Weak-plane tensile strength = 0.1 MPa
# Weak-plane compressive strength = 100 MPa, varying down to 1 MPa when tensile strain = 1
#
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 400
    bias_z = 1.1
    ny = 30 # make this a multiple of 3, so y=150 is at a node
    ymin = 0
    ymax = 450
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 150 3'
    input = bottom
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    new_boundary = 21
    primary_block = 0
    paired_block = 1
    input = excav
  []
  [hole]
    type = BlockDeletionGenerator
    block = 1
    input = roof
  []
[]
[GlobalParams]
  block = 0
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./stress_xx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./stress_yy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./dp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = dp_plastic_internal_parameter
    variable = dp_shear
  [../]
  [./dp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = dp_plastic_internal_parameter
    variable = dp_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./dp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = dp_plastic_yield_function
    variable = dp_shear_f
  [../]
  [./dp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = dp_plastic_yield_function
    variable = dp_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12 16 21' # note addition of 16 and 21
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
  [./roof]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = 21
    function = excav_sideways
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(400-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(400-z)'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*max(min((t/end_t*(ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
  [./excav_downwards]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  e_h  closure_dist'
    symbol_values = '1.0   0    150.0 -3.0 15.0'
    expression = 'e_h*t/end_t*max(min(((ymax-ymin)+ymin-y)/closure_dist,1),0)'
  [../]
[]
[UserObjects]
  [./dp_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.9 # MPa
    value_residual = 3.1 # MPa
    rate = 1.0
  [../]
  [./dp_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./dp_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.65
  [../]
  [./dp_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.4 # MPa
    rate = 1.0
  [../]
  [./dp_compressive_str]
    type = SolidMechanicsHardeningConstant
    value = 1.0E3 # Large!
  [../]
  [./drucker_prager_model]
    type = SolidMechanicsPlasticDruckerPrager
    mc_cohesion = dp_coh_strong_harden
    mc_friction_angle = dp_fric
    mc_dilation_angle = dp_dil
    internal_constraint_tolerance = 1 # irrelevant here
    yield_function_tolerance = 1      # irrelevant here
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1.0
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
    eigenstrain_name = ini_stress
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = 'wp'
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = drucker_prager_model
    tensile_strength = dp_tensile_str_strong_harden
    compressive_strength = dp_compressive_str
    max_NR_iterations = 100000
    tip_smoother = 0.1E1
    smoothing_tol = 0.1E1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density]
    type = GenericConstantMaterial
    prop_names = density
    prop_values = 2500
  [../]
[]
[Postprocessors]
  [./subsidence]
    type = PointValue
    point = '0 0 400'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 0.2
  end_time = 0.2
[]
[Outputs]
  file_base = cosserat_wp_only
  time_step_interval = 1
  print_linear_residuals = false
  csv = true
  exodus = true
  [./console]
    type = Console
    output_linear = false
  [../]
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update23_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Tensile + shear failure, starting from a symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 4E1
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 35
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0
    joint_shear_stiffness = 1.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '10 12 -14.9  12 5 20  -14 20 8'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 0.5
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/jacobian/cwpc01.i)
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 20
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 2.055555555556E-01
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 1
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 100
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '10 0 0  0 10 0  0 0 10'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
    perform_finite_strain_rotations = false
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 1
    smoothing_tol = 1
    yield_function_tol = 1E-11
  [../]
[]
[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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat02.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_couple y_couple z_couple x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    displacements = 'disp_x disp_y disp_z'
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    component = 1
    displacements = 'wc_x wc_y wc_z'
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    component = 2
    displacements = 'wc_x wc_y wc_z'
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1.3 0.98 1.4'
    fill_method_bending = 'general_isotropic'
    E_ijkl = '1 2 1.333'
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/jacobian/cdpc01.i)
#Cosserat capped weak plane and capped drucker prager
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./mc_coh]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 0.8
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 0.4
  [../]
  [./dp]
    type = SolidMechanicsPlasticDruckerPragerHyperbolic
    mc_cohesion = mc_coh
    mc_friction_angle = phi
    mc_dilation_angle = psi
    yield_function_tolerance = 1E-11     # irrelevant here
    internal_constraint_tolerance = 1E-9 # irrelevant here
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '10 0 0  0 10 0  0 0 10'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = 'dp'
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    host_youngs_modulus = 10.0
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = dp
    tensile_strength = ts
    compressive_strength = cs
    yield_function_tol = 1E-11
    tip_smoother = 1
    smoothing_tol = 1
  [../]
[]
[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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_elastic.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a transverse section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 400m deep
# and just the roof is studied (0<=z<=400).  The model sits
# between 0<=y<=450.  The excavation sits in 0<=y<=150.  This
# is a "half model": the boundary conditions are such that
# the model simulates an excavation sitting in -150<=y<=150
# inside a model of the region -450<=y<=450.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).
#
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions for this elastic simulation are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=0 and y=450
#  - disp_z = 0 for y>150
#  - wc_x = 0 at y=0 and y=450.
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# This is an elastic simulation, but the weak-plane and Drucker-Prager
# parameters and AuxVariables may be found below.  They are irrelevant
# in this simulation.  The weak-plane and Drucker-Prager cohesions,
# tensile strengths and compressive strengths have been set very high
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
#
[Mesh]
  [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 403.003
    bias_z = 1.1
    ny = 30 # make this a multiple of 3, so y=150 is at a node
    ymin = 0
    ymax = 450
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 150 3'
    input = bottom
  []
  [roof]
    type = SideSetsBetweenSubdomainsGenerator
    new_boundary = 21
    primary_block = 0
    paired_block = 1
    input = excav
  []
  [hole]
    type = BlockDeletionGenerator
    block = 1
    input = roof
  []
[]
[GlobalParams]
  block = 0
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./dp_tensile_f]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./dp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = dp_plastic_internal_parameter
    variable = dp_shear
  [../]
  [./dp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = dp_plastic_internal_parameter
    variable = dp_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./dp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = dp_plastic_yield_function
    variable = dp_shear_f
  [../]
  [./dp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = dp_plastic_yield_function
    variable = dp_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12'
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(403.003-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(403.003-z)'
  [../]
[]
[UserObjects]
  [./dp_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.9 # MPa
    value_residual = 3.1 # MPa
    rate = 1.0
  [../]
  [./dp_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./dp_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.65
  [../]
  [./dp_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.4 # MPa
    rate = 1.0
  [../]
  [./dp_compressive_str]
    type = SolidMechanicsHardeningConstant
    value = 1.0E3 # Large!
  [../]
  [./drucker_prager_model]
    type = SolidMechanicsPlasticDruckerPrager
    mc_cohesion = dp_coh_strong_harden
    mc_friction_angle = dp_fric
    mc_dilation_angle = dp_dil
    internal_constraint_tolerance = 1 # irrelevant here
    yield_function_tolerance = 1      # irrelevant here
  [../]
  [./wp_coh]
    type = SolidMechanicsHardeningConstant
    value = 1E12
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str]
    type = SolidMechanicsHardeningConstant
    value = 1E12
  [../]
  [./wp_compressive_str]
    type = SolidMechanicsHardeningConstant
    value = 1E12
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
    eigenstrain_name = ini_stress
  [../]
  [./stress]
    # this is needed so as to correctly apply the initial stress
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./dp]
    type = CappedDruckerPragerCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = dp
    DP_model = drucker_prager_model
    tensile_strength = dp_tensile_str_strong_harden
    compressive_strength = dp_compressive_str
    max_NR_iterations = 100000
    tip_smoother = 0.1E1
    smoothing_tol = 0.1E1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    block = 0
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str
    compressive_strength = wp_compressive_str
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density]
    type = GenericConstantMaterial
    prop_names = density
    prop_values = 2500
  [../]
[]
[Postprocessors]
  [./subs_max]
    type = PointValue
    point = '0 0 403.003'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'Linear'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 1000
  start_time = 0.0
  dt = 1.0
  end_time = 1.0
[]
[Outputs]
  file_base = cosserat_elastic
  time_step_interval = 1
  print_linear_residuals = false
  exodus = true
  csv = true
  console = true
  #[./console]
  #  type = Console
  #  output_linear = false
  #[../]
[]
(modules/solid_mechanics/test/tests/capped_weak_plane/small_deform_cosserat1.i)
# Plastic deformation.  Layered Cosserat with parameters:
# Young = 1.0
# Poisson = 0.2
# layer_thickness = 0.1
# joint_normal_stiffness = 0.25
# joint_shear_stiffness = 0.2
# These give the following nonzero components of the elasticity tensor:
# E_0000 = E_1111 = 1.043195
# E_0011 = E_1100 = 0.260799
# E_2222 = 0.02445
# E_0022 = E_1122 = E_2200 = E_2211 = 0.006112
# G = E_0101 = E_0110 = E_1001 = E_1010 = 0.416667
# Gt = E_0202 = E_0220 = E_2002 = E_1212 = E_1221 = E_2112 = 0.019084
# E_2020 = E_2121 = 0.217875
# They give the following nonzero components of the bending rigidity tensor:
# D = 8.68056E-5
# B_0101 = B_1010 = 7.92021E-4
# B_0110 = B_1001 = -1.584E-4
#
# Applying the following deformation to the zmax surface of a unit cube:
# disp_x = 8*t
# disp_y = 6*t
# disp_z = t
# omega_x = omega_y = omega_z = 0
# yields the following strains:
# strain_xz = 8*t
# strain_yz = 6*t
# strain_zz = t
# and all other components, and the curvature, are zero.
# The nonzero components of stress are therefore:
# stress_xx = stress_yy = 0.006112*t
# stress_xz = stress_zx = 0.152671*t
# stress_yz = stress_zy = 0.114504*t
# stress_zz = 0.0244499*t
# The moment stress is zero.
# So q = 0.19084*t and p = 0.0244*t.
#
# With large cohesion, but tensile strength = 0.0244499, the
# system is elastic up to t=1.  After that time
# stress_zz = 0.0244499 (for t>=1)
# and
# stress_xx = stress_yy = 0.006112 (for t>=1), since the
# elastic trial increment is exactly canelled by the Poisson's
# contribution from the return to the yield surface.
# The plastic strains are zero for t<=1, but for larger times:
# plastic_strain_zz = (t - 1)  (for t>=1)
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  [./bottomx]
    type = DirichletBC
    variable = disp_x
    boundary = back
    value = 0.0
  [../]
  [./bottomy]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0.0
  [../]
  [./bottomz]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0.0
  [../]
  [./topx]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = front
    function = 8*t
  [../]
  [./topy]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = front
    function = 6*t
  [../]
  [./topz]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = front
    function = t
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strainp_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strainp_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./straint_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_compressive]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./intnl_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./iter]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./ls]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./strainp_xx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xx
    index_i = 0
    index_j = 0
  [../]
  [./strainp_xy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xy
    index_i = 0
    index_j = 1
  [../]
  [./strainp_xz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_xz
    index_i = 0
    index_j = 2
  [../]
  [./strainp_yx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yx
    index_i = 1
    index_j = 0
  [../]
  [./strainp_yy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yy
    index_i = 1
    index_j = 1
  [../]
  [./strainp_yz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_yz
    index_i = 1
    index_j = 2
  [../]
  [./strainp_zx]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zx
    index_i = 2
    index_j = 0
  [../]
  [./strainp_zy]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zy
    index_i = 2
    index_j = 1
  [../]
  [./strainp_zz]
    type = RankTwoAux
    rank_two_tensor = plastic_strain
    variable = strainp_zz
    index_i = 2
    index_j = 2
  [../]
  [./straint_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xx
    index_i = 0
    index_j = 0
  [../]
  [./straint_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xy
    index_i = 0
    index_j = 1
  [../]
  [./straint_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_xz
    index_i = 0
    index_j = 2
  [../]
  [./straint_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yx
    index_i = 1
    index_j = 0
  [../]
  [./straint_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yy
    index_i = 1
    index_j = 1
  [../]
  [./straint_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_yz
    index_i = 1
    index_j = 2
  [../]
  [./straint_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zx
    index_i = 2
    index_j = 0
  [../]
  [./straint_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zy
    index_i = 2
    index_j = 1
  [../]
  [./straint_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = straint_zz
    index_i = 2
    index_j = 2
  [../]
  [./f_shear]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 0
    variable = f_shear
  [../]
  [./f_tensile]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 1
    variable = f_tensile
  [../]
  [./f_compressive]
    type = MaterialStdVectorAux
    property = plastic_yield_function
    index = 2
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 0
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = MaterialStdVectorAux
    property = plastic_internal_parameter
    index = 1
    variable = intnl_tensile
  [../]
  [./iter]
    type = MaterialRealAux
    property = plastic_NR_iterations
    variable = iter
  [../]
  [./ls]
    type = MaterialRealAux
    property = plastic_linesearch_needed
    variable = ls
  [../]
[]
[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_yx]
    type = PointValue
    point = '0 0 0'
    variable = stress_yx
  [../]
  [./s_yy]
    type = PointValue
    point = '0 0 0'
    variable = stress_yy
  [../]
  [./s_yz]
    type = PointValue
    point = '0 0 0'
    variable = stress_yz
  [../]
  [./s_zx]
    type = PointValue
    point = '0 0 0'
    variable = stress_zx
  [../]
  [./s_zy]
    type = PointValue
    point = '0 0 0'
    variable = stress_zy
  [../]
  [./s_zz]
    type = PointValue
    point = '0 0 0'
    variable = stress_zz
  [../]
  [./c_s_xx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xx
  [../]
  [./c_s_xy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xy
  [../]
  [./c_s_xz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_xz
  [../]
  [./c_s_yx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yx
  [../]
  [./c_s_yy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yy
  [../]
  [./c_s_yz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_yz
  [../]
  [./c_s_zx]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zx
  [../]
  [./c_s_zy]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zy
  [../]
  [./c_s_zz]
    type = PointValue
    point = '0 0 0'
    variable = couple_stress_zz
  [../]
  [./strainp_xx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xx
  [../]
  [./strainp_xy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xy
  [../]
  [./strainp_xz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_xz
  [../]
  [./strainp_yx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yx
  [../]
  [./strainp_yy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yy
  [../]
  [./strainp_yz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_yz
  [../]
  [./strainp_zx]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zx
  [../]
  [./strainp_zy]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zy
  [../]
  [./strainp_zz]
    type = PointValue
    point = '0 0 0'
    variable = strainp_zz
  [../]
  [./straint_xx]
    type = PointValue
    point = '0 0 0'
    variable = straint_xx
  [../]
  [./straint_xy]
    type = PointValue
    point = '0 0 0'
    variable = straint_xy
  [../]
  [./straint_xz]
    type = PointValue
    point = '0 0 0'
    variable = straint_xz
  [../]
  [./straint_yx]
    type = PointValue
    point = '0 0 0'
    variable = straint_yx
  [../]
  [./straint_yy]
    type = PointValue
    point = '0 0 0'
    variable = straint_yy
  [../]
  [./straint_yz]
    type = PointValue
    point = '0 0 0'
    variable = straint_yz
  [../]
  [./straint_zx]
    type = PointValue
    point = '0 0 0'
    variable = straint_zx
  [../]
  [./straint_zy]
    type = PointValue
    point = '0 0 0'
    variable = straint_zy
  [../]
  [./straint_zz]
    type = PointValue
    point = '0 0 0'
    variable = straint_zz
  [../]
  [./f_shear]
    type = PointValue
    point = '0 0 0'
    variable = f_shear
  [../]
  [./f_tensile]
    type = PointValue
    point = '0 0 0'
    variable = f_tensile
  [../]
  [./f_compressive]
    type = PointValue
    point = '0 0 0'
    variable = f_compressive
  [../]
  [./intnl_shear]
    type = PointValue
    point = '0 0 0'
    variable = intnl_shear
  [../]
  [./intnl_tensile]
    type = PointValue
    point = '0 0 0'
    variable = intnl_tensile
  [../]
  [./iter]
    type = PointValue
    point = '0 0 0'
    variable = iter
  [../]
  [./ls]
    type = PointValue
    point = '0 0 0'
    variable = ls
  [../]
[]
[UserObjects]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 30
  [../]
  [./tanphi]
    type = SolidMechanicsHardeningConstant
    value = 0.5
  [../]
  [./tanpsi]
    type = SolidMechanicsHardeningConstant
    value = 0.1111077
  [../]
  [./t_strength]
    type = SolidMechanicsHardeningConstant
    value = 0.024449878
  [../]
  [./c_strength]
    type = SolidMechanicsHardeningConstant
    value = 40
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.0
    poisson = 0.2
    layer_thickness = 0.1
    joint_normal_stiffness = 0.25
    joint_shear_stiffness = 0.2
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
  [../]
  [./admissible]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = stress
    perform_finite_strain_rotations = false
  [../]
  [./stress]
    type = CappedWeakPlaneCosseratStressUpdate
    cohesion = coh
    tan_friction_angle = tanphi
    tan_dilation_angle = tanpsi
    tensile_strength = t_strength
    compressive_strength = c_strength
    tip_smoother = 0
    smoothing_tol = 1
    yield_function_tol = 1E-5
  [../]
[]
[Executioner]
  nl_abs_tol = 1E-14
  end_time = 3
  dt = 1
  type = Transient
[]
[Outputs]
  file_base = small_deform_cosserat1
  csv = true
[]
(modules/solid_mechanics/examples/coal_mining/cosserat_mc_wp_sticky_longitudinal.i)
# Strata deformation and fracturing around a coal mine
#
# A 2D geometry is used that simulates a longitudinal section of
# the coal mine.  The model is actually 3D, but the "x"
# dimension is only 10m long, meshed with 1 element, and
# there is no "x" displacement.  The mine is 400m deep
# and just the roof is studied (0<=z<=400).  The model sits
# between -300<=y<=1800.  The excavation sits in 0<=y<=1500.  The
# excavation height is 3m (ie, the excavation lies within
# 0<=z<=3).
#
# Time is meaningless in this example
# as quasi-static solutions are sought at each timestep, but
# the number of timesteps controls the resolution of the
# process.
#
# The boundary conditions for this elastic simulation are:
#  - disp_x = 0 everywhere
#  - disp_y = 0 at y=-300 and y=1800
#  - disp_z = 0 at z=0, but there is a time-dependent
#               Young's modulus that simulates excavation
#  - wc_x = 0 at y=300 and y=1800.
# That is, rollers on the sides, free at top,
# and prescribed at bottom in the unexcavated portion.
#
# The small strain formulation is used.
#
# All stresses are measured in MPa.  The initial stress is consistent with
# the weight force from density 2500 kg/m^3, ie, stress_zz = -0.025*(300-z) MPa
# where gravity = 10 m.s^-2 = 1E-5 MPa m^2/kg.  The maximum and minimum
# principal horizontal stresses are assumed to be equal to 0.8*stress_zz.
#
# Material properties:
# Young's modulus = 8 GPa
# Poisson's ratio = 0.25
# Cosserat layer thickness = 1 m
# Cosserat-joint normal stiffness = large
# Cosserat-joint shear stiffness = 1 GPa
# MC cohesion = 3 MPa
# MC friction angle = 37 deg
# MC dilation angle = 8 deg
# MC tensile strength = 1 MPa
# MC compressive strength = 100 MPa
#
[Mesh]
   [generated_mesh]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 1
    xmin = -5
    xmax = 5
    nz = 40
    zmin = 0
    zmax = 400
    bias_z = 1.1
    ny = 140 # 15m elements
    ymin = -300
    ymax = 1800
  []
  [left]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 11
    normal = '0 -1 0'
    input = generated_mesh
  []
  [right]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 12
    normal = '0 1 0'
    input = left
  []
  [front]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 13
    normal = '-1 0 0'
    input = right
  []
  [back]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 14
    normal = '1 0 0'
    input = front
  []
  [top]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 15
    normal = '0 0 1'
    input = back
  []
  [bottom]
    type = SideSetsAroundSubdomainGenerator
    block = 0
    new_boundary = 16
    normal = '0 0 -1'
    input = top
  []
  [excav]
    type = SubdomainBoundingBoxGenerator
    block_id = 1
    bottom_left = '-5 0 0'
    top_right = '5 1500 3'
    input = bottom
  []
  [roof]
    type = SideSetsAroundSubdomainGenerator
    block = 1
    new_boundary = 18
    normal = '0 0 1'
    input = excav
  []
[]
[GlobalParams]
  perform_finite_strain_rotations = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
[]
[Kernels]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    use_displaced_mesh = false
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    use_displaced_mesh = false
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    use_displaced_mesh = false
    variable = wc_x
    component = 0
  [../]
  [./gravity]
    type = Gravity
    use_displaced_mesh = false
    variable = disp_z
    value = -10E-6 # remember this is in MPa
  [../]
[]
[AuxVariables]
  [./disp_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
  [./stress_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_xz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_yz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./stress_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./wp_tensile_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_shear_f]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./mc_tensile_f]
    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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./mc_shear]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_internal_parameter
    variable = mc_shear
  [../]
  [./mc_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = mc_plastic_internal_parameter
    variable = mc_tensile
  [../]
  [./wp_shear]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_internal_parameter
    variable = wp_shear
  [../]
  [./wp_tensile]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_internal_parameter
    variable = wp_tensile
  [../]
  [./mc_shear_f]
    type = MaterialStdVectorAux
    index = 6
    property = mc_plastic_yield_function
    variable = mc_shear_f
  [../]
  [./mc_tensile_f]
    type = MaterialStdVectorAux
    index = 0
    property = mc_plastic_yield_function
    variable = mc_tensile_f
  [../]
  [./wp_shear_f]
    type = MaterialStdVectorAux
    index = 0
    property = wp_plastic_yield_function
    variable = wp_shear_f
  [../]
  [./wp_tensile_f]
    type = MaterialStdVectorAux
    index = 1
    property = wp_plastic_yield_function
    variable = wp_tensile_f
  [../]
[]
[BCs]
  [./no_y]
    type = DirichletBC
    variable = disp_y
    boundary = '11 12'
    value = 0.0
  [../]
  [./no_z]
    type = DirichletBC
    variable = disp_z
    boundary = '16'
    value = 0.0
  [../]
  [./no_wc_x]
    type = DirichletBC
    variable = wc_x
    boundary = '11 12'
    value = 0.0
  [../]
  [./roof]
    type = StickyBC
    variable = disp_z
    min_value = -3.0
    boundary = '18'
  [../]
[]
[Functions]
  [./ini_xx]
    type = ParsedFunction
    expression = '-0.8*2500*10E-6*(400-z)'
  [../]
  [./ini_zz]
    type = ParsedFunction
    expression = '-2500*10E-6*(400-z)'
  [../]
  [./excav_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval slope'
    symbol_values = '1.0   0    1500.0 1E-9  1      15'
    # excavation face at ymin+(ymax-ymin)*min(t/end_t,1)
    # slope is the distance over which the modulus reduces from maxval to minval
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,if(y<ymin+(ymax-ymin)*min(t/end_t,1)+slope,minval+(maxval-minval)*(y-(ymin+(ymax-ymin)*min(t/end_t,1)))/slope,maxval))'
  [../]
  [./density_sideways]
    type = ParsedFunction
    symbol_names = 'end_t ymin ymax  minval maxval'
    symbol_values = '1.0   0    1500.0 0     2500'
    expression = 'if(y<ymin+(ymax-ymin)*min(t/end_t,1),minval,maxval)'
  [../]
[]
[UserObjects]
  [./mc_coh_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 2.99 # MPa
    value_residual = 3.01 # MPa
    rate = 1.0
  [../]
  [./mc_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.65 # 37deg
  [../]
  [./mc_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.15 # 8deg
  [../]
  [./mc_tensile_str_strong_harden]
    type = SolidMechanicsHardeningExponential
    value_0 = 1.0 # MPa
    value_residual = 1.0 # MPa
    rate = 1.0
  [../]
  [./mc_compressive_str]
    type = SolidMechanicsHardeningCubic
    value_0 = 100 # Large!
    value_residual = 100
    internal_limit = 0.1
  [../]
  [./wp_coh_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_tan_fric]
    type = SolidMechanicsHardeningConstant
    value = 0.36 # 20deg
  [../]
  [./wp_tan_dil]
    type = SolidMechanicsHardeningConstant
    value = 0.18 # 10deg
  [../]
  [./wp_tensile_str_harden]
    type = SolidMechanicsHardeningCubic
    value_0 = 0.1
    value_residual = 0.1
    internal_limit = 10
  [../]
  [./wp_compressive_str_soften]
    type = SolidMechanicsHardeningCubic
    value_0 = 100
    value_residual = 1.0
    internal_limit = 1.0
  [../]
[]
[Materials]
  [./elasticity_tensor_0]
    type = ComputeLayeredCosseratElasticityTensor
    block = 0
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
  [../]
  [./elasticity_tensor_1]
    type = ComputeLayeredCosseratElasticityTensor
    block = 1
    young = 8E3 # MPa
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 1E9 # huge
    joint_shear_stiffness = 1E3 # MPa
    elasticity_tensor_prefactor = excav_sideways
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    eigenstrain_name = ini_stress
    initial_stress = 'ini_xx 0 0  0 ini_xx 0  0 0 ini_zz'
  [../]
  [./stress_0]
    type = ComputeMultipleInelasticCosseratStress
    block = 0
    inelastic_models = 'mc wp'
    cycle_models = true
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./stress_1]
    # this is needed so as to correctly apply the initial stress
    type = ComputeMultipleInelasticCosseratStress
    block = 1
    inelastic_models = ''
    relative_tolerance = 2.0
    absolute_tolerance = 1E6
    max_iterations = 1
    tangent_operator = nonlinear
    perform_finite_strain_rotations = false
  [../]
  [./mc]
    type = CappedMohrCoulombCosseratStressUpdate
    warn_about_precision_loss = false
    host_youngs_modulus = 8E3
    host_poissons_ratio = 0.25
    base_name = mc
    tensile_strength = mc_tensile_str_strong_harden
    compressive_strength = mc_compressive_str
    cohesion = mc_coh_strong_harden
    friction_angle = mc_fric
    dilation_angle = mc_dil
    max_NR_iterations = 100000
    smoothing_tol = 0.1 # MPa  # Must be linked to cohesion
    yield_function_tol = 1E-9 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0
  [../]
  [./wp]
    type = CappedWeakPlaneCosseratStressUpdate
    warn_about_precision_loss = false
    base_name = wp
    cohesion = wp_coh_harden
    tan_friction_angle = wp_tan_fric
    tan_dilation_angle = wp_tan_dil
    tensile_strength = wp_tensile_str_harden
    compressive_strength = wp_compressive_str_soften
    max_NR_iterations = 10000
    tip_smoother = 0.1
    smoothing_tol = 0.1 # MPa  # Note, this must be tied to cohesion, otherwise get no possible return at cone apex
    yield_function_tol = 1E-11 # MPa.  this is essentially the lowest possible without lots of precision loss
    perfect_guess = true
    min_step_size = 1.0E-3
  [../]
  [./density_0]
    type = GenericConstantMaterial
    block = 0
    prop_names = density
    prop_values = 2500
  [../]
  [./density_1]
    type = GenericFunctionMaterial
    block = 1
    prop_names = density
    prop_values = density_sideways
  [../]
[]
[Postprocessors]
  [./subs]
    type = PointValue
    point = '0 0 400'
    variable = disp_z
    use_displaced_mesh = false
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  petsc_options = '-snes_converged_reason'
  petsc_options_iname = '-pc_type -pc_asm_overlap -sub_pc_type -ksp_type -ksp_gmres_restart'
  petsc_options_value = ' asm      2              lu            gmres     200'
  line_search = bt
  nl_abs_tol = 1e-3
  nl_rel_tol = 1e-5
  l_max_its = 30
  nl_max_its = 100
  start_time = 0.0
  dt = 0.01 # 1 element per step
  end_time = 1.0
[]
[Outputs]
  file_base = cosserat_mc_wp_sticky_longitudinal
  time_step_interval = 1
  print_linear_residuals = false
  exodus = true
  csv = true
  console = true
  #[./console]
  #  type = Console
  #  output_linear = false
  #[../]
[]
(modules/solid_mechanics/test/tests/jacobian/coss_elastic.i)
#Cosserat elastic, using ComputeMultipleInelasticCosseratStress
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 10.0
    poisson = 0.25
    layer_thickness = 10.0
    joint_normal_stiffness = 2.5
    joint_shear_stiffness = 2.0
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '5 1 2  1 4 3  2.1 3.1 1'
    eigenstrain_name = ini_stress
  [../]
  [./admissible]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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]
  solve_type = 'NEWTON'
  end_time = 1
  dt = 1
  type = Transient
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat03.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_couple y_couple z_couple x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1.3 0.98 1.4'
    fill_method_bending = 'general_isotropic'
    E_ijkl = '1 1.2 1.333 0.988 1 1.1 1.2 1.3 1.4 1 1.2 1.333 0.988 1 1.1 1.2 1.3 1.4 1.2 1 0.6'
    fill_method = 'symmetric21'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat01.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [SolidMechanics]
    displacements = 'wc_x wc_y wc_z'
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = 0.5
    E_ijkl = '1 2 1.3333'
    fill_method = 'general_isotropic'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update18_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Compressive failure only, starting from a non-symmetric stress state, and
# using softening
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./cs]
    type = SolidMechanicsHardeningCubic
    value_0 = 1
    value_residual = 0
    internal_limit = 2E-3
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./ang]
    type = SolidMechanicsHardeningConstant
    value = 30
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 3E3
    poisson = 0.2
    layer_thickness = 1.0
    joint_normal_stiffness = 1.0E3
    joint_shear_stiffness = 2.0E3
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '-2 1 -0.5  -1 -1.9 0  -0.5 0 -3'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 3E3
    host_poissons_ratio = 0.2
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = ang
    dilation_angle = ang
    smoothing_tol = 0.1
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/static_deformations/beam_cosserat_02_apply_stress.i)
# Beam bending.
# One end is clamped and the other end is subjected to a stress
# and micromechanical moment that will induce bending.
# The stress that will induce bending around the y axis is
# stress_xx = EAz
# This implies a micromechanical moment-stress of
# m_yx = (1/12)EAh^2 for joint_shear_stiffness=0.
# For joint_shear_stiffness!=0, the micromechanical moment-stress
# is
# m_yx = (1/12)EAa^2 G/(ak_s + G)
# All other stresses and moment stresses are assumed to be zero.
# With joint_shear_stiffness=0, and introducing D=-poisson*A, the
# nonzero strains are
# ep_xx = Az
# ep_yy = Dz
# ep_zz = Dz
# kappa_xy = -D
# kappa_yx = A
# This means the displacements are:
# u_x = Axz
# u_y = Dzy
# u_z = -(A/2)x^2 + (D/2)(z^2-y^2)
# wc_x = -Dy
# wc_y = Ax
# wc_z = 0
# This is bending of a bar around the y axis, in plane stress
# (stress_yy=0).  Displacements at the left-hand (x=0) are applied
# according to the above formulae; wc_x and wc_y are applied throughout
# the bar; and stress_xx is applied at the right-hand end (x=10).
# The displacements are measured and
# compared with the above formulae.
# The test uses: E=1.2, poisson=0.3, A=1.11E-2, h=2, ks=0.1, so
# stress_xx = 1.332E-2*z
# m_yx = 0.2379E-2
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 10
  ny = 1
  nz = 10
  xmin = 0
  xmax = 10
  ymin = -1
  ymax = 1
  zmin = -0.5
  zmax = 0.5
[]
[GlobalParams]
  #use_displaced_mesh = false
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[BCs]
  # zmin is called back
  # zmax is called front
  # ymin is called bottom
  # ymax is called top
  # xmin is called left
  # xmax is called right
  [./clamp_z]
    type = FunctionDirichletBC
    variable = disp_z
    boundary = left
    function = '-0.3*(z*z-y*y)/2.0*1.11E-2'
  [../]
  [./clamp_y]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = left
    function = '-0.3*z*y*1.11E-2'
  [../]
  [./clamp_x]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0.0
  [../]
  [./end_stress]
    type = FunctionNeumannBC
    boundary = right
    function = z*1.2*1.11E-2
    variable = disp_x
  [../]
  [./fix_wc_x]
    type = FunctionDirichletBC
    variable = wc_x
    boundary = 'left' # right top bottom front back'
    function = '0.3*y*1.11E-2'
  [../]
  [./fix_wc_y]
    type = FunctionDirichletBC
    variable = wc_y
    boundary = 'left' # right top bottom front back'
    function = '1.11E-2*x'
  [../]
  [./end_moment]
    type = VectorNeumannBC
    boundary = right
    variable = wc_y
    vector_value = '2.3785714286E-3 0 0'
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
  [./strain_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./strain_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_xz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_yz]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zx]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zy]
    family = MONOMIAL
    order = CONSTANT
  [../]
  [./couple_stress_zz]
    family = MONOMIAL
    order = CONSTANT
  [../]
[]
[AuxKernels]
  [./strain_xx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xx
    index_i = 0
    index_j = 0
  [../]
  [./strain_xy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xy
    index_i = 0
    index_j = 1
  [../]
  [./strain_xz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_xz
    index_i = 0
    index_j = 2
  [../]
  [./strain_yx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yx
    index_i = 1
    index_j = 0
  [../]
  [./strain_yy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yy
    index_i = 1
    index_j = 1
  [../]
  [./strain_yz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_yz
    index_i = 1
    index_j = 2
  [../]
  [./strain_zx]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zx
    index_i = 2
    index_j = 0
  [../]
  [./strain_zy]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zy
    index_i = 2
    index_j = 1
  [../]
  [./strain_zz]
    type = RankTwoAux
    rank_two_tensor = total_strain
    variable = strain_zz
    index_i = 2
    index_j = 2
  [../]
  [./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_yx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./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_zx]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./stress_zy]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./stress_zz]
    type = RankTwoAux
    rank_two_tensor = stress
    variable = stress_zz
    index_i = 2
    index_j = 2
  [../]
  [./couple_stress_xx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xx
    index_i = 0
    index_j = 0
  [../]
  [./couple_stress_xy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xy
    index_i = 0
    index_j = 1
  [../]
  [./couple_stress_xz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_xz
    index_i = 0
    index_j = 2
  [../]
  [./couple_stress_yx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yx
    index_i = 1
    index_j = 0
  [../]
  [./couple_stress_yy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yy
    index_i = 1
    index_j = 1
  [../]
  [./couple_stress_yz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_yz
    index_i = 1
    index_j = 2
  [../]
  [./couple_stress_zx]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zx
    index_i = 2
    index_j = 0
  [../]
  [./couple_stress_zy]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zy
    index_i = 2
    index_j = 1
  [../]
  [./couple_stress_zz]
    type = RankTwoAux
    rank_two_tensor = couple_stress
    variable = couple_stress_zz
    index_i = 2
    index_j = 2
  [../]
[]
[VectorPostprocessors]
  [./soln]
    type = LineValueSampler
    warn_discontinuous_face_values = false
    sort_by = x
    variable = 'disp_x disp_y disp_z stress_xx stress_xy stress_xz stress_yx stress_yy stress_yz stress_zx stress_zy stress_zz wc_x wc_y wc_z couple_stress_xx couple_stress_xy couple_stress_xz couple_stress_yx couple_stress_yy couple_stress_yz couple_stress_zx couple_stress_zy couple_stress_zz'
    start_point = '0 0 0.5'
    end_point = '10 0 0.5'
    num_points = 11
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1.2
    poisson = 0.3
    layer_thickness = 2.0
    joint_normal_stiffness = 1E16
    joint_shear_stiffness = 0.1
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-ksp_type -pc_type -sub_pc_type -snes_atol -snes_rtol -snes_max_it -ksp_atol -ksp_rtol -ksp_max_it -sub_pc_factor_shift_type -pc_asm_overlap -ksp_gmres_restart'
    petsc_options_value = 'gmres asm lu 1E-11 1E-11 10 1E-15 1E-10 100 NONZERO 2 100'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
  num_steps = 1
[]
[Outputs]
  execute_on = 'timestep_end'
  file_base = beam_cosserat_02_apply_stress
  exodus = true
  csv = true
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update22_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Shear failure, starting from a non-symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 60
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0
    joint_shear_stiffness = 1.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '6 5 4.1  5 7 2.1  4 2 2'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 1
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/jacobian/mc_update21_cosserat.i)
# Cosserat version of Capped Mohr Columb (using StressUpdate)
# Shear failure, starting from a symmetric stress state
[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
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
[]
[Kernels]
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
[]
[AuxVariables]
  [./wc_z]
  [../]
[]
[UserObjects]
  [./ts]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./cs]
    type = SolidMechanicsHardeningConstant
    value = 1E6
  [../]
  [./coh]
    type = SolidMechanicsHardeningConstant
    value = 10
  [../]
  [./phi]
    type = SolidMechanicsHardeningConstant
    value = 60
    convert_to_radians = true
  [../]
  [./psi]
    type = SolidMechanicsHardeningConstant
    value = 5
    convert_to_radians = true
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeLayeredCosseratElasticityTensor
    young = 1
    poisson = 0.25
    layer_thickness = 1.0
    joint_normal_stiffness = 2.0
    joint_shear_stiffness = 1.0
  [../]
  [./strain]
    type = ComputeCosseratIncrementalSmallStrain
    eigenstrain_names = ini_stress
  [../]
  [./ini_stress]
    type = ComputeEigenstrainFromInitialStress
    initial_stress = '3 0 0  0 3 0  0 0 1.5'
    eigenstrain_name = ini_stress
  [../]
  [./cmc]
    type = CappedMohrCoulombCosseratStressUpdate
    host_youngs_modulus = 1
    host_poissons_ratio = 0.25
    tensile_strength = ts
    compressive_strength = cs
    cohesion = coh
    friction_angle = phi
    dilation_angle = psi
    smoothing_tol = 1
    yield_function_tol = 1.0E-12
  [../]
  [./stress]
    type = ComputeMultipleInelasticCosseratStress
    inelastic_models = cmc
    perform_finite_strain_rotations = false
  [../]
[]
[Preconditioning]
  [./andy]
    type = SMP
    full = true
    petsc_options_iname = '-snes_type'
    petsc_options_value = 'test'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = Newton
[]
(modules/solid_mechanics/test/tests/jacobian/cosserat04.i)
[Mesh]
  type = GeneratedMesh
  dim = 3
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
  Cosserat_rotations = 'wc_x wc_y wc_z'
[]
[Variables]
  [./disp_x]
  [../]
  [./disp_y]
  [../]
  [./disp_z]
  [../]
  [./wc_x]
  [../]
  [./wc_y]
  [../]
  [./wc_z]
  [../]
[]
[Kernels]
  active = 'cx_elastic cy_elastic cz_elastic x_couple y_couple z_couple x_moment y_moment z_moment'
  [./cx_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_x
    displacements = 'disp_x disp_y disp_z'
    component = 0
  [../]
  [./cy_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_y
    displacements = 'disp_x disp_y disp_z'
    component = 1
  [../]
  [./cz_elastic]
    type = CosseratStressDivergenceTensors
    variable = disp_z
    displacements = 'disp_x disp_y disp_z'
    component = 2
  [../]
  [./x_couple]
    type = StressDivergenceTensors
    variable = wc_x
    displacements = 'wc_x wc_y wc_z'
    component = 0
    base_name = couple
  [../]
  [./y_couple]
    type = StressDivergenceTensors
    variable = wc_y
    displacements = 'wc_x wc_y wc_z'
    component = 1
    base_name = couple
  [../]
  [./z_couple]
    type = StressDivergenceTensors
    variable = wc_z
    displacements = 'wc_x wc_y wc_z'
    component = 2
    base_name = couple
  [../]
  [./x_moment]
    type = MomentBalancing
    variable = wc_x
    component = 0
  [../]
  [./y_moment]
    type = MomentBalancing
    variable = wc_y
    component = 1
  [../]
  [./z_moment]
    type = MomentBalancing
    variable = wc_z
    component = 2
  [../]
[]
[Materials]
  [./elasticity_tensor]
    type = ComputeCosseratElasticityTensor
    B_ijkl = '1 2.2 2.333 1.988 1 2.1 2.2 2.3 2.4 1 2.2 2.333 1.988 1 2.1 2.2 2.3 2.4 2.2 2 1.6'
    fill_method_bending = 'symmetric21'
    E_ijkl = '1.07 1.2 1.333 0.988 1.123 1.1 1.25 1.3 1.4 1 1.2 1.333 0.9 1.11 1.16 1.28 1.35 1.45 1.03 1 0.6'
    fill_method = 'symmetric21'
  [../]
  [./strain]
    type = ComputeCosseratSmallStrain
  [../]
  [./stress]
    type = ComputeCosseratLinearElasticStress
  [../]
[]
[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
[]