- custom_small_jacobianThe name of the small stress Jacobian.
C++ Type:MaterialPropertyName
Unit:(no unit assumed)
Controllable:No
Description:The name of the small stress Jacobian.
 - custom_small_stressThe name of the small stress.
C++ Type:MaterialPropertyName
Unit:(no unit assumed)
Controllable:No
Description:The name of the small stress.
 
ComputeLagrangianObjectiveCustomSymmetricStress
Objectively integrated constitutive model with a user-defined small stress and small stress Jacobian, useful for coupling with 3rd party libraries which define custom stress-strain relations.
Input Parameters
- base_nameMaterial property base name
C++ Type:std::string
Controllable:No
Description:Material property base name
 - blockThe list of blocks (ids or names) that this object will be applied
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:The list of blocks (ids or names) that this object will be applied
 - boundaryThe list of boundaries (ids or names) from the mesh where this object applies
C++ Type:std::vector<BoundaryName>
Controllable:No
Description:The list of boundaries (ids or names) from the mesh where this object applies
 - computeTrueWhen false, MOOSE will not call compute methods on this material. The user must call computeProperties() after retrieving the MaterialBase via MaterialBasePropertyInterface::getMaterialBase(). Non-computed MaterialBases are not sorted for dependencies.
Default:True
C++ Type:bool
Controllable:No
Description:When false, MOOSE will not call compute methods on this material. The user must call computeProperties() after retrieving the MaterialBase via MaterialBasePropertyInterface::getMaterialBase(). Non-computed MaterialBases are not sorted for dependencies.
 - constant_onNONEWhen ELEMENT, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps.When SUBDOMAIN, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps. Evaluations on element qps will be skipped
Default:NONE
C++ Type:MooseEnum
Options:NONE, ELEMENT, SUBDOMAIN
Controllable:No
Description:When ELEMENT, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps.When SUBDOMAIN, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps. Evaluations on element qps will be skipped
 - declare_suffixAn optional suffix parameter that can be appended to any declared 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 declared properties. The suffix will be prepended with a '_' character.
 - large_kinematicsFalseUse a large displacement stress update.
Default:False
C++ Type:bool
Controllable:No
Description:Use a large displacement stress update.
 - objective_ratetruesdellWhich type of objective integration to use
Default:truesdell
C++ Type:MooseEnum
Options:truesdell, jaumann, green_naghdi
Controllable:No
Description:Which type of objective integration to use
 
Optional 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.
 - 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 form
Default:True
C++ Type:bool
Controllable:No
Description:Determines whether this object is calculated using an implicit or explicit form
 - 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 generator
Default: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
- output_propertiesList of material properties, from this material, to output (outputs must also be defined to an output type)
C++ Type:std::vector<std::string>
Controllable:No
Description:List of material properties, from this material, to output (outputs must also be defined to an output type)
 - outputsnone Vector of output names where you would like to restrict the output of variables(s) associated with this object
Default:none
C++ Type:std::vector<OutputName>
Controllable:No
Description:Vector of output names where you would like to restrict the output of variables(s) associated with this object
 
Outputs 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/neml2/viscoplasticity/perfect.i)
 - (modules/solid_mechanics/test/tests/neml2/viscoplasticity/radial_return.i)
 - (modules/solid_mechanics/test/tests/neml2/plasticity/isokinharden.i)
 - (modules/solid_mechanics/test/tests/neml2/plasticity/perfect.i)
 - (modules/solid_mechanics/test/tests/neml2/viscoplasticity/isokinharden.i)
 - (modules/solid_mechanics/test/tests/neml2/viscoplasticity/chaboche.i)
 - (modules/solid_mechanics/test/tests/neml2/plasticity/isoharden.i)
 - (modules/solid_mechanics/test/tests/lagrangian/cartesian/total/homogenization/neml2/small_neml.i)
 - (modules/solid_mechanics/test/tests/neml2/laromance/laromance_return_mapping.i)
 - (modules/solid_mechanics/test/tests/neml2/viscoplasticity/isoharden.i)
 - (modules/combined/test/tests/optimization/invOpt_elasticity_modular/grad.i)
 - (modules/solid_mechanics/test/tests/neml2/viscoplasticity/kinharden.i)
 - (modules/solid_mechanics/test/tests/neml2/solve_failure/moose.i)
 - (modules/solid_mechanics/test/tests/neml2/elasticity/elasticity.i)
 - (modules/solid_mechanics/test/tests/neml2/plasticity/kinharden.i)
 - (modules/combined/test/tests/optimization/invOpt_elasticity_modular/forward.i)
 - (modules/solid_mechanics/test/tests/lagrangian/cartesian/total/homogenization/neml2/large_neml.i)
 
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/perfect.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'perfect_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S'
    moose_output_types = 'MATERIAL'
    moose_outputs = '     neml2_stress'
    neml2_outputs = '     state/S'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/radial_return.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'radial_return_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL              MATERIAL'
    moose_inputs = '     neml2_strain time          time          plastic_strain        consistency'
    neml2_inputs = '     forces/E     forces/t      old_forces/t  old_state/internal/Ep old_state/internal/gamma'
    moose_output_types = 'MATERIAL     MATERIAL          MATERIAL'
    moose_outputs = '     neml2_stress plastic_strain    consistency'
    neml2_outputs = '     state/S      state/internal/Ep state/internal/gamma'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/plasticity/isokinharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'isokinharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL              MATERIAL                  MATERIAL'
    moose_inputs = '     neml2_strain time          time          plastic_strain        equivalent_plastic_strain kinematic_plastic_strain'
    neml2_inputs = '     forces/E     forces/t      old_forces/t  old_state/internal/Ep old_state/internal/ep     old_state/internal/Kp'
    moose_output_types = 'MATERIAL     MATERIAL          MATERIAL                  MATERIAL'
    moose_outputs = '     neml2_stress plastic_strain    equivalent_plastic_strain kinematic_plastic_strain'
    neml2_outputs = '     state/S      state/internal/Ep state/internal/ep         state/internal/Kp'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/plasticity/perfect.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'perfect_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL'
    moose_inputs = '     neml2_strain time          time          plastic_strain'
    neml2_inputs = '     forces/E     forces/t      old_forces/t  old_state/internal/Ep'
    moose_output_types = 'MATERIAL     MATERIAL'
    moose_outputs = '     neml2_stress plastic_strain'
    neml2_outputs = '     state/S      state/internal/Ep'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/isokinharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'isokinharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL     MATERIAL                  MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress equivalent_plastic_strain kinematic_plastic_strain'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S  old_state/internal/ep     old_state/internal/Kp'
    moose_output_types = 'MATERIAL     MATERIAL                  MATERIAL'
    moose_outputs = '     neml2_stress equivalent_plastic_strain kinematic_plastic_strain'
    neml2_outputs = '     state/S      state/internal/ep         state/internal/Kp'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/chaboche.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'chaboche_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL     MATERIAL                  MATERIAL              MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress equivalent_plastic_strain back_stress_1         back_stress_2'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S  old_state/internal/ep     old_state/internal/X1 old_state/internal/X2'
    moose_output_types = 'MATERIAL     MATERIAL                  MATERIAL          MATERIAL'
    moose_outputs = '     neml2_stress equivalent_plastic_strain back_stress_1     back_stress_2'
    neml2_outputs = '     state/S      state/internal/ep         state/internal/X1 state/internal/X2'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/plasticity/isoharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'isoharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL              MATERIAL'
    moose_inputs = '     neml2_strain time          time          plastic_strain        equivalent_plastic_strain'
    neml2_inputs = '     forces/E     forces/t      old_forces/t  old_state/internal/Ep old_state/internal/ep'
    moose_output_types = 'MATERIAL     MATERIAL          MATERIAL'
    moose_outputs = '     neml2_stress plastic_strain    equivalent_plastic_strain'
    neml2_outputs = '     state/S      state/internal/Ep state/internal/ep'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/lagrangian/cartesian/total/homogenization/neml2/small_neml.i)
constraint_types = 'strain none none stress stress stress stress none stress'
targets = 'strain11 zero zero zero zero zero'
[Mesh]
  [base]
    type = FileMeshGenerator
    file = '3d.exo'
  []
  [sidesets]
    type = SideSetsFromNormalsGenerator
    input = base
    normals = '-1 0 0
                1 0 0
                0 -1 0
                0 1 0
                0 0 -1
                0 0 1'
    fixed_normal = true
    new_boundary = 'left right bottom top back front'
  []
[]
[BCs]
  [fix1_x]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_x
    vector_tags = residual
  []
[]
[BCs]
  [fix1_y]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_y
    vector_tags = residual
  []
[]
[BCs]
  [fix1_z]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_z
    vector_tags = residual
  []
[]
[BCs]
  [fix2_x]
    type = DirichletBC
    boundary = fix_xy
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_x
    vector_tags = residual
  []
[]
[BCs]
  [fix2_y]
    type = DirichletBC
    boundary = fix_xy
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_y
    vector_tags = residual
  []
[]
[BCs]
  [fix3_z]
    type = DirichletBC
    boundary = fix_z
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_z
    vector_tags = residual
  []
[]
[Functions]
  [strain11]
    type = ParsedFunction
    expression = t
  []
[]
[Functions]
  [zero]
    type = ConstantFunction
    value = 0
  []
[]
[Materials]
  [compute_homogenization_gradient]
    type = ComputeHomogenizedLagrangianStrain
    constraint_types = ${constraint_types}
    targets = ${targets}
    macro_gradient = hvar
  []
  [compute_strain]
    type = ComputeLagrangianStrain
    homogenization_gradient_names = 'homogenization_gradient'
    displacements = 'disp_x disp_y disp_z'
  []
[]
[Materials]
  [neml2_stress_to_moose]
    type = NEML2ToMOOSESymmetricRankTwoTensorMaterialProperty
    block = ''
    from_neml2 = state/S
    neml2_executor = neml2_model_all
    outputs = none
    to_moose = neml2_stress
  []
  [neml2_jacobian_to_moose]
    type = NEML2ToMOOSESymmetricRankFourTensorMaterialProperty
    block = ''
    from_neml2 = state/S
    neml2_executor = neml2_model_all
    neml2_input_derivative = forces/E
    outputs = none
    to_moose = neml2_jacobian
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = mechanical_strain
    outputs = none
    to = neml2_strain
  []
[]
[Materials]
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_jacobian = neml2_jacobian
    custom_small_stress = neml2_stress
    large_kinematics = false
    outputs = none
  []
[]
[BCs]
  [Periodic]
    [x]
      variable = disp_x
      auto_direction = 'x y z'
    []
    [y]
      variable = disp_y
      auto_direction = 'x y z'
    []
    [z]
      variable = disp_z
      auto_direction = 'x y z'
    []
  []
[]
[UserObjects]
  [moose_strain_to_jacobian]
    type = MOOSESymmetricRankTwoTensorMaterialPropertyToNEML2
    block = ''
    execute_on = 'INITIAL LINEAR NONLINEAR'
    from_moose = neml2_strain
    to_neml2 = forces/E
  []
  [neml2_index_model_all]
    type = NEML2BatchIndexGenerator
    block = ''
    execute_on = 'INITIAL LINEAR NONLINEAR'
  []
  [neml2_model_all]
    type = NEML2ModelExecutor
    batch_index_generator = neml2_index_model_all
    device = cpu
    execute_on = 'INITIAL LINEAR NONLINEAR'
    gatherers = moose_strain_to_jacobian
    input = neml2_elastic.i
    model = model
    param_gatherers = ''
  []
[]
[Variables]
  [disp_x]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
  [disp_y]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
  [disp_z]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
  [hvar]
    type = MooseVariableScalar
    family = SCALAR
    order = SIXTH
  []
[]
[AuxKernels]
  [cauchy_stress_xx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_xx
    variable = cauchy_stress_xx
  []
  [cauchy_stress_xy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_xy
    variable = cauchy_stress_xy
  []
  [cauchy_stress_xz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_xz
    variable = cauchy_stress_xz
  []
  [cauchy_stress_yx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_yx
    variable = cauchy_stress_yx
  []
  [cauchy_stress_yy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_yy
    variable = cauchy_stress_yy
  []
  [cauchy_stress_yz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_yz
    variable = cauchy_stress_yz
  []
  [cauchy_stress_zx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_zx
    variable = cauchy_stress_zx
  []
  [cauchy_stress_zy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_zy
    variable = cauchy_stress_zy
  []
  [cauchy_stress_zz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = cauchy_stress_zz
    variable = cauchy_stress_zz
  []
  [deformation_gradient_xx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xx
    variable = deformation_gradient_xx
  []
  [deformation_gradient_xy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xy
    variable = deformation_gradient_xy
  []
  [deformation_gradient_xz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xz
    variable = deformation_gradient_xz
  []
  [deformation_gradient_yx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yx
    variable = deformation_gradient_yx
  []
  [deformation_gradient_yy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yy
    variable = deformation_gradient_yy
  []
  [deformation_gradient_yz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yz
    variable = deformation_gradient_yz
  []
  [deformation_gradient_zx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zx
    variable = deformation_gradient_zx
  []
  [deformation_gradient_zy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zy
    variable = deformation_gradient_zy
  []
  [deformation_gradient_zz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zz
    variable = deformation_gradient_zz
  []
[]
[AuxVariables]
  [cauchy_stress_xx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_xy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_xz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_yx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_yy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_yz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_zx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_zy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [cauchy_stress_zz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
[]
[Kernels]
  [TM_all0]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 0
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = false
    stabilize_strain = false
    variable = disp_x
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
  [TM_all1]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 1
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = false
    stabilize_strain = false
    variable = disp_y
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
  [TM_all2]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 2
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = false
    stabilize_strain = false
    variable = disp_z
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
[]
[Materials]
  [cauchy_stress_xx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 0
    outputs = none
    property_name = cauchy_stress_xx
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_xy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 1
    outputs = none
    property_name = cauchy_stress_xy
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_xz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 2
    outputs = none
    property_name = cauchy_stress_xz
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_yx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 0
    outputs = none
    property_name = cauchy_stress_yx
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_yy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 1
    outputs = none
    property_name = cauchy_stress_yy
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_yz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 2
    outputs = none
    property_name = cauchy_stress_yz
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_zx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 0
    outputs = none
    property_name = cauchy_stress_zx
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_zy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 1
    outputs = none
    property_name = cauchy_stress_zy
    rank_two_tensor = cauchy_stress
  []
  [cauchy_stress_zz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 2
    outputs = none
    property_name = cauchy_stress_zz
    rank_two_tensor = cauchy_stress
  []
  [deformation_gradient_xx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 0
    outputs = none
    property_name = deformation_gradient_xx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_xy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 1
    outputs = none
    property_name = deformation_gradient_xy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_xz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 2
    outputs = none
    property_name = deformation_gradient_xz
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 0
    outputs = none
    property_name = deformation_gradient_yx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 1
    outputs = none
    property_name = deformation_gradient_yy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 2
    outputs = none
    property_name = deformation_gradient_yz
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 0
    outputs = none
    property_name = deformation_gradient_zx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 1
    outputs = none
    property_name = deformation_gradient_zy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 2
    outputs = none
    property_name = deformation_gradient_zz
    rank_two_tensor = deformation_gradient
  []
[]
[Executioner]
  type = Transient
  residual_and_jacobian_together = true
  solve_type = 'newton'
  line_search = 'none'
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  l_max_its = 2
  l_tol = 1e-14
  nl_max_its = 20
  nl_rel_tol = 1e-8
  nl_abs_tol = 1e-10
  start_time = 0.0
  dt = 0.2
  dtmin = 0.2
  end_time = 1.0
[]
[Outputs]
  [out]
    type = Exodus
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
  []
  [mCS_xx]
    type = ElementAverageValue
    variable = cauchy_stress_xx
  []
  [mCS_yy]
    type = ElementAverageValue
    variable = cauchy_stress_yy
  []
  [mCS_zz]
    type = ElementAverageValue
    variable = cauchy_stress_zz
  []
  [mCS_xy]
    type = ElementAverageValue
    variable = cauchy_stress_xy
  []
  [mCS_xz]
    type = ElementAverageValue
    variable = cauchy_stress_xz
  []
  [mCS_yx]
    type = ElementAverageValue
    variable = cauchy_stress_yx
  []
  [mCS_yz]
    type = ElementAverageValue
    variable = cauchy_stress_yz
  []
  [mCS_zy]
    type = ElementAverageValue
    variable = cauchy_stress_zy
  []
  [mCS_zx]
    type = ElementAverageValue
    variable = cauchy_stress_zx
  []
[]
(modules/solid_mechanics/test/tests/neml2/laromance/laromance_return_mapping.i)
# NEML2 file in MPA
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = 2
    ny = 2
    nz = 2
  []
[]
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [pressure_x]
    type = Pressure
    variable = disp_x
    boundary = right
    function = pressure_fcn
  []
[]
[Functions]
  [pressure_fcn]
    type = ParsedFunction
    expression = 'if(t<200,t,200)' #MPa
  []
[]
[Materials]
  [init_dd]
    type = GenericConstantMaterial
    prop_names = 'T init_cell_dd init_wall_dd init_envFac'
    prop_values = '750 1e11 8e12 2e15'
  []
[]
[NEML2]
  input = 'models/laromance_matl_radial_return.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL MATERIAL     MATERIAL         MATERIAL             MATERIAL          MATERIAL          MATERIAL       POSTPROCESSOR POSTPROCESSOR'
    moose_inputs = 'T        neml2_strain inelastic_strain eff_inelastic_strain cell_dd           wall_dd           init_envFac    time          time'
    neml2_inputs = 'forces/T forces/E     old_state/Ep     old_state/ep         old_state/cell_dd old_state/wall_dd forces/env_fac forces/t      old_forces/t'
    moose_output_types = 'Material     MATERIAL         MATERIAL             MATERIAL                  MATERIAL        MATERIAL        MATERIAL        MATERIAL      MATERIAL'
    moose_outputs = 'neml2_stress inelastic_strain eff_inelastic_strain eff_inelastic_strain_rate vonmises_stress cell_rate       wall_rate       cell_dd       wall_dd'
    neml2_outputs = 'state/S      state/Ep         state/ep             state/ep_rate             state/s         state/cell_rate state/wall_rate state/cell_dd state/wall_dd'
    initialize_outputs = 'wall_dd      cell_dd      init_envFac'
    initialize_output_values = 'init_wall_dd init_cell_dd init_envFac'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  nl_rel_tol = 1e-10
  nl_abs_tol = 1e-12
  dt = 50
  dtmin = 50
  num_steps = 10
  residual_and_jacobian_together = true
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
  [eff_inelastic_strain]
    type = ElementAverageMaterialProperty
    mat_prop = eff_inelastic_strain
  []
  [eff_inelastic_strain_rate]
    type = ElementAverageMaterialProperty
    mat_prop = eff_inelastic_strain_rate
  []
  [rhom_rate]
    type = ElementAverageMaterialProperty
    mat_prop = cell_rate
  []
  [rhoi_rate]
    type = ElementAverageMaterialProperty
    mat_prop = wall_rate
  []
  [rhom_dd]
    type = ElementAverageMaterialProperty
    mat_prop = cell_dd
  []
  [rhoi_dd]
    type = ElementAverageMaterialProperty
    mat_prop = wall_dd
  []
  [vm_stress]
    type = ElementAverageMaterialProperty
    mat_prop = vonmises_stress
  []
[]
[Outputs]
  csv = true
[]
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/isoharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'isoharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL     MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress equivalent_plastic_strain'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S  old_state/internal/ep'
    moose_output_types = 'MATERIAL     MATERIAL'
    moose_outputs = '     neml2_stress equivalent_plastic_strain'
    neml2_outputs = '     state/S      state/internal/ep'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/combined/test/tests/optimization/invOpt_elasticity_modular/grad.i)
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 2
    nx = 11
    ny = 11
    xmin = -4
    xmax = 4
    ymin = -4
    ymax = 4
  []
  displacements = 'adj_disp_x adj_disp_y'
[]
[Variables]
  # adjoint
  [adj_disp_x]
  []
  [adj_disp_y]
  []
[]
[AuxVariables]
  [dummy]
  []
  [T]
  []
  # displacement variables to be transferred from the forward app
  # we use them to compute stress and stress derivative wrt E
  [disp_x]
  []
  [disp_y]
  []
[]
[DiracKernels]
  [misfit_is_adjoint_force]
    type = ReporterPointSource
    variable = adj_disp_x
    x_coord_name = misfit/measurement_xcoord
    y_coord_name = misfit/measurement_ycoord
    z_coord_name = misfit/measurement_zcoord
    value_name = misfit/misfit_values
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      displacements = 'adj_disp_x adj_disp_y'
      [adjoint]
        strain = SMALL
        new_system = true
        formulation = TOTAL
        incremental = true
        volumetric_locking_correction = false
        displacements = 'adj_disp_x adj_disp_y'
        # add base name to distinguish between forward and adjoint
        # the total lagrangian formulation does not add base_name correctly without setting both, which should be improved
        base_name = 'adjoint'
        strain_base_name = 'adjoint'
      []
    []
  []
[]
[NEML2]
  input = 'elasticity.i'
  verbose = true
  device = 'cpu'
  [forward]
    model = 'forward_elasticity_model'
    moose_input_types = 'MATERIAL'
    moose_inputs = 'forward_strain'
    neml2_inputs = 'forces/E'
    moose_parameter_types = 'MATERIAL'
    moose_parameters = 'E_material'
    neml2_parameters = 'E'
    moose_output_types = 'MATERIAL'
    moose_outputs = 'forward_stress'
    neml2_outputs = 'state/S'
    moose_parameter_derivative_types = 'MATERIAL'
    moose_parameter_derivatives = 'forward_dstress_dE'
    neml2_parameter_derivatives = 'state/S E'
  []
  [adjoint]
    model = 'adjoint_elasticity_model'
    moose_input_types = 'MATERIAL'
    moose_inputs = 'adjoint_strain'
    neml2_inputs = 'forces/E'
    moose_parameter_types = 'MATERIAL'
    moose_parameters = 'E_material'
    neml2_parameters = 'E'
    moose_output_types = 'MATERIAL'
    moose_outputs = 'adjoint_stress'
    neml2_outputs = 'state/S'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'adjoint_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[BCs]
  [bottom_ux]
    type = DirichletBC
    variable = adj_disp_x
    boundary = bottom
    value = 0.0
  []
  [bottom_uy]
    type = DirichletBC
    variable = adj_disp_y
    boundary = bottom
    value = 0.0
  []
[]
[Materials]
  [E_material]
    type = GenericFunctionMaterial
    prop_names = 'E_material'
    prop_values = 'E'
  []
  # forward
  [forward_strain]
    type = ComputeLagrangianStrain
    displacements = 'disp_x disp_y'
    base_name = 'forward'
  []
  [convert_forward_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'forward_mechanical_strain'
    to = 'forward_strain'
  []
  # adjoint
  [convert_adjoint_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'adjoint_mechanical_strain'
    to = 'adjoint_strain'
  []
  [adjoint_stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'adjoint_stress'
    custom_small_jacobian = 'adjoint_jacobian'
    base_name = 'adjoint'
  []
[]
[Functions]
  [E]
    type = NearestReporterCoordinatesFunction
    x_coord_name = parametrization/coordx
    y_coord_name = parametrization/coordy
    value_name = parametrization/youngs_modulus
  []
[]
[Reporters]
  [measure_data]
    type = OptimizationData
    variable = 'adj_disp_x'
  []
  [misfit]
    type = OptimizationData
  []
  [parametrization]
    type = ConstantReporter
    real_vector_names = 'coordx coordy youngs_modulus'
    real_vector_values = '0 0 0; ${fparse 8/3} 0 ${fparse -8/3}; 5 5 5'
  []
[]
[VectorPostprocessors]
  [grad_youngs_modulus]
    type = AdjointStrainSymmetricStressGradInnerProduct
    stress_derivative_name = 'forward_dstress_dE'
    adjoint_strain_name = 'adjoint_mechanical_strain'
    variable = dummy
    function = E
  []
[]
[Executioner]
  type = Steady
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  # we do not compute them together as this is overwritting DiracKernel's residual calculation, which should be improved
  residual_and_jacobian_together = false
  nl_rel_tol = 1e-10
  nl_abs_tol = 1e-14
[]
[Outputs]
  file_base = 'adjoint'
  console = false
[]
(modules/solid_mechanics/test/tests/neml2/viscoplasticity/kinharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'kinharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL     MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress kinematic_plastic_strain'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S  old_state/internal/Kp'
    moose_output_types = 'MATERIAL     MATERIAL'
    moose_outputs = '     neml2_stress kinematic_plastic_strain'
    neml2_outputs = '     state/S      state/internal/Kp'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/solve_failure/moose.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        incremental = true
        new_system = true
        add_variables = true
        volumetric_locking_correction = true
      []
    []
  []
[]
[AuxVariables]
  [temp]
    initial_condition = 1200
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = 'xdisp_func'
    # Setting this to true is discouraged as it could plasticity solve more difficult.
    # We do it here simply to make the solve to fail to test the error handling.
    preset = true
  []
[]
[NEML2]
  input = 'neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     MATERIAL POSTPROCESSOR POSTPROCESSOR MATERIAL              MATERIAL                  MATERIAL'
    moose_inputs = '     neml2_strain neml2_strain time          time          neml2_stress        equivalent_plastic_strain back_stress'
    neml2_inputs = '     forces/E     old_forces/E forces/t      old_forces/t  old_state/S old_state/internal/ep     old_state/internal/X'
    moose_output_types = 'MATERIAL     MATERIAL                  MATERIAL'
    moose_outputs = '     neml2_stress    equivalent_plastic_strain back_stress'
    neml2_outputs = '     state/S      state/internal/ep         state/internal/X'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[Functions]
  [xdisp_func]
    type = PiecewiseLinear
    x = '0 0.005 0.01 0.015 0.02'
    y = '0 0.005 0 -0.005 0'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-5
  end_time = 0.006
  nl_abs_tol = 1e-12
  nl_rel_tol = 1e-10
  nl_max_its = 12
  line_search = none
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
  print_linear_residuals = false
[]
(modules/solid_mechanics/test/tests/neml2/elasticity/elasticity.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'elasticity_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL'
    moose_inputs = 'neml2_strain'
    neml2_inputs = 'forces/E'
    moose_output_types = 'MATERIAL'
    moose_outputs = 'neml2_stress'
    neml2_outputs = 'state/S'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/solid_mechanics/test/tests/neml2/plasticity/kinharden.i)
N = 2
[GlobalParams]
  displacements = 'disp_x disp_y disp_z'
[]
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 3
    nx = ${N}
    ny = ${N}
    nz = ${N}
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      [all]
        strain = SMALL
        new_system = true
        add_variables = true
        formulation = TOTAL
        volumetric_locking_correction = true
      []
    []
  []
[]
[NEML2]
  input = 'kinharden_neml2.i'
  [all]
    model = 'model'
    verbose = true
    device = 'cpu'
    moose_input_types = 'MATERIAL     POSTPROCESSOR POSTPROCESSOR MATERIAL              MATERIAL'
    moose_inputs = '     neml2_strain time          time          plastic_strain        kinematic_plastic_strain'
    neml2_inputs = '     forces/E     forces/t      old_forces/t  old_state/internal/Ep old_state/internal/Kp'
    moose_output_types = 'MATERIAL     MATERIAL          MATERIAL'
    moose_outputs = '     neml2_stress plastic_strain    kinematic_plastic_strain'
    neml2_outputs = '     state/S      state/internal/Ep state/internal/Kp'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
    outputs = 'none'
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
[]
[BCs]
  [xfix]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  []
  [yfix]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0
  []
  [zfix]
    type = DirichletBC
    variable = disp_z
    boundary = back
    value = 0
  []
  [xdisp]
    type = FunctionDirichletBC
    variable = disp_x
    boundary = right
    function = t
    preset = false
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  automatic_scaling = true
  dt = 1e-3
  dtmin = 1e-3
  num_steps = 5
  residual_and_jacobian_together = true
[]
[Outputs]
  exodus = true
[]
(modules/combined/test/tests/optimization/invOpt_elasticity_modular/forward.i)
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 2
    nx = 11
    ny = 11
    xmin = -4
    xmax = 4
    ymin = -4
    ymax = 4
  []
  displacements = 'disp_x disp_y'
[]
[Variables]
  [disp_x]
  []
  [disp_y]
  []
[]
[AuxVariables]
  [T]
  []
[]
[Physics]
  [SolidMechanics]
    [QuasiStatic]
      displacements = 'disp_x disp_y'
      [all]
        strain = SMALL
        new_system = true
        formulation = TOTAL
        incremental = true
        volumetric_locking_correction = false
        displacements = 'disp_x disp_y'
      []
    []
  []
[]
[NEML2]
  input = 'elasticity.i'
  verbose = true
  device = 'cpu'
  [all]
    model = 'forward_elasticity_model'
    moose_input_types = 'MATERIAL'
    moose_inputs = 'neml2_strain'
    neml2_inputs = 'forces/E'
    moose_parameter_types = 'MATERIAL'
    moose_parameters = 'E_material'
    neml2_parameters = 'E'
    moose_output_types = 'MATERIAL'
    moose_outputs = 'neml2_stress'
    neml2_outputs = 'state/S'
    moose_derivative_types = 'MATERIAL'
    moose_derivatives = 'neml2_jacobian'
    neml2_derivatives = 'state/S forces/E'
  []
[]
[BCs]
  [bottom_x]
    type = DirichletBC
    variable = disp_x
    boundary = bottom
    value = 0.0
  []
  [bottom_y]
    type = DirichletBC
    variable = disp_y
    boundary = bottom
    value = 0.0
  []
  [top_x]
    type = NeumannBC
    variable = disp_x
    boundary = top
    value = 1.0
  []
  [top_y]
    type = NeumannBC
    variable = disp_y
    boundary = top
    value = 1.0
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = 'mechanical_strain'
    to = 'neml2_strain'
  []
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_stress = 'neml2_stress'
    custom_small_jacobian = 'neml2_jacobian'
  []
  [E_material]
    type = GenericFunctionMaterial
    prop_names = 'E_material'
    prop_values = 'E'
  []
[]
[Functions]
  [E]
    type = NearestReporterCoordinatesFunction
    x_coord_name = parametrization/coordx
    y_coord_name = parametrization/coordy
    value_name = parametrization/youngs_modulus
  []
[]
[Reporters]
  [measure_data]
    type = OptimizationData
    variable = disp_x
    objective_name = objective_value
  []
  [parametrization]
    type = ConstantReporter
    real_vector_names = 'coordx coordy youngs_modulus'
    real_vector_values = '0 0 0; ${fparse 8/3} 0 ${fparse -8/3}; 5 5 5'
  []
[]
[Executioner]
  type = Steady
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  # better efficiency if we compute them together
  residual_and_jacobian_together = true
  nl_rel_tol = 1e-10
  nl_abs_tol = 1e-14
[]
[Postprocessors]
  [point1]
    type = PointValue
    point = '-1.0 -1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point2]
    type = PointValue
    point = '-1.0 0.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point3]
    type = PointValue
    point = '-1.0 1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point4]
    type = PointValue
    point = '0.0 -1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point5]
    type = PointValue
    point = '0.0  0.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point6]
    type = PointValue
    point = '0.0  1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point7]
    type = PointValue
    point = '1.0 -1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point8]
    type = PointValue
    point = '1.0  0.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
  [point9]
    type = PointValue
    point = '1.0  1.0 0.0'
    variable = disp_x
    execute_on = TIMESTEP_END
  []
[]
[Outputs]
  file_base = 'forward'
  console = false
[]
(modules/solid_mechanics/test/tests/lagrangian/cartesian/total/homogenization/neml2/large_neml.i)
constraint_types = 'strain strain strain stress stress stress stress strain stress'
targets = 'strain11 zero zero zero zero zero zero zero zero'
[Mesh]
  [base]
    type = FileMeshGenerator
    file = '3d.exo'
  []
  [sidesets]
    type = SideSetsFromNormalsGenerator
    input = base
    normals = '-1 0 0
                1 0 0
                0 -1 0
                0 1 0
            '
              '    0 0 -1
                0 0 1'
    fixed_normal = true
    new_boundary = 'left right bottom top back front'
  []
[]
[BCs]
  [fix1_x]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_x
    vector_tags = residual
  []
[]
[BCs]
  [fix1_y]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_y
    vector_tags = residual
  []
[]
[BCs]
  [fix1_z]
    type = DirichletBC
    boundary = fix_all
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_z
    vector_tags = residual
  []
[]
[BCs]
  [fix2_x]
    type = DirichletBC
    boundary = fix_xy
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_x
    vector_tags = residual
  []
[]
[BCs]
  [fix2_y]
    type = DirichletBC
    boundary = fix_xy
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_y
    vector_tags = residual
  []
[]
[BCs]
  [fix3_z]
    type = DirichletBC
    boundary = fix_z
    displacements = 'disp_x disp_y disp_z'
    matrix_tags = 'system time'
    value = 0
    variable = disp_z
    vector_tags = residual
  []
[]
[BCs]
  [Periodic]
    [x]
      variable = disp_x
      auto_direction = 'x y z'
    []
    [y]
      variable = disp_y
      auto_direction = 'x y z'
    []
    [z]
      variable = disp_z
      auto_direction = 'x y z'
    []
  []
[]
[Functions]
  [strain11]
    type = ParsedFunction
    expression = 't'
  []
[]
[Functions]
  [zero]
    type = ConstantFunction
    value = 0
  []
[]
[Materials]
  [convert_strain]
    type = RankTwoTensorToSymmetricRankTwoTensor
    from = mechanical_strain
    outputs = none
    to = neml2_strain
  []
[]
[Materials]
  [stress]
    type = ComputeLagrangianObjectiveCustomSymmetricStress
    custom_small_jacobian = neml2_jacobian
    custom_small_stress = neml2_stress
    large_kinematics = true
    outputs = none
  []
  [compute_homogenization_gradient]
    type = ComputeHomogenizedLagrangianStrain
    constraint_types = ${constraint_types}
    targets = ${targets}
    macro_gradient = hvar
  []
  [compute_strain]
    type = ComputeLagrangianStrain
    homogenization_gradient_names = 'homogenization_gradient'
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = true
  []
[]
[Materials]
  [material_neml2_to_moose_stress]
    type = NEML2ToMOOSESymmetricRankTwoTensorMaterialProperty
    block = ''
    from_neml2 = state/S
    neml2_executor = neml2_model_all
    outputs = none
    to_moose = neml2_stress
  []
  [material_neml2_to_moose_jacobian]
    type = NEML2ToMOOSESymmetricRankFourTensorMaterialProperty
    block = ''
    from_neml2 = state/S
    neml2_executor = neml2_model_all
    neml2_input_derivative = forces/E
    outputs = none
    to_moose = neml2_jacobian
  []
[]
[UserObjects]
  [UO_strain_moose_to_neml2]
    type = MOOSESymmetricRankTwoTensorMaterialPropertyToNEML2
    block = ''
    execute_on = 'INITIAL LINEAR NONLINEAR'
    from_moose = neml2_strain
    to_neml2 = forces/E
  []
  [neml2_index_model_all]
    type = NEML2BatchIndexGenerator
    block = ''
    execute_on = 'INITIAL LINEAR NONLINEAR'
  []
  [neml2_model_all]
    type = NEML2ModelExecutor
    batch_index_generator = neml2_index_model_all
    device = cpu
    execute_on = 'INITIAL LINEAR NONLINEAR'
    gatherers = UO_strain_moose_to_neml2
    input = neml2_elastic.i
    model = model
    param_gatherers = ''
    execution_order_group = 1
  []
[]
[Variables]
  [disp_x]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
  [disp_y]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
  [disp_z]
    type = MooseVariable
    family = LAGRANGE
    order = FIRST
  []
[]
[AuxKernels]
  [pk1_stress_xx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_xx
    variable = pk1_stress_xx
  []
  [pk1_stress_xy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_xy
    variable = pk1_stress_xy
  []
  [pk1_stress_xz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_xz
    variable = pk1_stress_xz
  []
  [pk1_stress_yx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_yx
    variable = pk1_stress_yx
  []
  [pk1_stress_yy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_yy
    variable = pk1_stress_yy
  []
  [pk1_stress_yz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_yz
    variable = pk1_stress_yz
  []
  [pk1_stress_zx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_zx
    variable = pk1_stress_zx
  []
  [pk1_stress_zy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_zy
    variable = pk1_stress_zy
  []
  [pk1_stress_zz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = pk1_stress_zz
    variable = pk1_stress_zz
  []
  [deformation_gradient_xx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xx
    variable = deformation_gradient_xx
  []
  [deformation_gradient_xy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xy
    variable = deformation_gradient_xy
  []
  [deformation_gradient_xz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_xz
    variable = deformation_gradient_xz
  []
  [deformation_gradient_yx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yx
    variable = deformation_gradient_yx
  []
  [deformation_gradient_yy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yy
    variable = deformation_gradient_yy
  []
  [deformation_gradient_yz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_yz
    variable = deformation_gradient_yz
  []
  [deformation_gradient_zx_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zx
    variable = deformation_gradient_zx
  []
  [deformation_gradient_zy_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zy
    variable = deformation_gradient_zy
  []
  [deformation_gradient_zz_all]
    type = MaterialRealAux
    block = ''
    execute_on = TIMESTEP_END
    property = deformation_gradient_zz
    variable = deformation_gradient_zz
  []
[]
[AuxVariables]
  [pk1_stress_xx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_xy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_xz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_yx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_yy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_yz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_zx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_zy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [pk1_stress_zz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_xz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_yz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zx]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zy]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
  [deformation_gradient_zz]
    type = MooseVariableConstMonomial
    family = MONOMIAL
    order = CONSTANT
  []
[]
[Kernels]
  [TM_all0]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 0
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = true
    stabilize_strain = false
    variable = disp_x
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
  [TM_all1]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 1
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = true
    stabilize_strain = false
    variable = disp_y
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
  [TM_all2]
    type = HomogenizedTotalLagrangianStressDivergence
    component = 2
    displacements = 'disp_x disp_y disp_z'
    large_kinematics = true
    stabilize_strain = false
    variable = disp_z
    macro_var = hvar
    constraint_types = ${constraint_types}
    targets = ${targets}
  []
[]
[Materials]
  [pk1_stress_xx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 0
    outputs = none
    property_name = pk1_stress_xx
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_xy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 1
    outputs = none
    property_name = pk1_stress_xy
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_xz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 2
    outputs = none
    property_name = pk1_stress_xz
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_yx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 0
    outputs = none
    property_name = pk1_stress_yx
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_yy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 1
    outputs = none
    property_name = pk1_stress_yy
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_yz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 2
    outputs = none
    property_name = pk1_stress_yz
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_zx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 0
    outputs = none
    property_name = pk1_stress_zx
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_zy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 1
    outputs = none
    property_name = pk1_stress_zy
    rank_two_tensor = pk1_stress
  []
  [pk1_stress_zz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 2
    outputs = none
    property_name = pk1_stress_zz
    rank_two_tensor = pk1_stress
  []
  [deformation_gradient_xx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 0
    outputs = none
    property_name = deformation_gradient_xx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_xy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 1
    outputs = none
    property_name = deformation_gradient_xy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_xz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 0
    index_j = 2
    outputs = none
    property_name = deformation_gradient_xz
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 0
    outputs = none
    property_name = deformation_gradient_yx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 1
    outputs = none
    property_name = deformation_gradient_yy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_yz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 1
    index_j = 2
    outputs = none
    property_name = deformation_gradient_yz
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zx_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 0
    outputs = none
    property_name = deformation_gradient_zx
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zy_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 1
    outputs = none
    property_name = deformation_gradient_zy
    rank_two_tensor = deformation_gradient
  []
  [deformation_gradient_zz_all]
    type = RankTwoCartesianComponent
    block = ''
    index_i = 2
    index_j = 2
    outputs = none
    property_name = deformation_gradient_zz
    rank_two_tensor = deformation_gradient
  []
[]
[Variables]
  [hvar]
    type = MooseVariableScalar
    family = SCALAR
    order = NINTH
  []
[]
[Preconditioning]
  [smp]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  residual_and_jacobian_together = true
  solve_type = 'newton'
  line_search = 'none'
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  l_max_its = 2
  l_tol = 1e-14
  nl_max_its = 20
  nl_rel_tol = 1e-8
  nl_abs_tol = 1e-10
  start_time = 0.0
  dt = 0.2
  dtmin = 0.2
  end_time = 1.0
[]
[Outputs]
  [out]
    type = Exodus
  []
[]
[Postprocessors]
  [time]
    type = TimePostprocessor
    execute_on = 'INITIAL TIMESTEP_BEGIN'
  []
  [mCS_xx]
    type     = ElementAverageValue
    variable = pk1_stress_xx
  []
  [mCS_yy]
    type     = ElementAverageValue
    variable = pk1_stress_yy
  []
  [mCS_zz]
    type     = ElementAverageValue
    variable = pk1_stress_zz
  []
  [mCS_xy]
    type     = ElementAverageValue
    variable = pk1_stress_xy
  []
  [mCS_xz]
    type     = ElementAverageValue
    variable = pk1_stress_xz
  []
  [mCS_yx]
    type     = ElementAverageValue
    variable = pk1_stress_yx
  []
  [mCS_yz]
    type     = ElementAverageValue
    variable = pk1_stress_yz
  []
  [mCS_zy]
    type     = ElementAverageValue
    variable = pk1_stress_zy
  []
  [mCS_zx]
    type     = ElementAverageValue
    variable = pk1_stress_zx
  []
[]