- 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 
ACInterface / ADACInterface
Gradient energy Allen-Cahn Kernel
ACInterface (and its automatic differentiation version, ADACInterface) implements the Allen-Cahn term for the  gradient energy contribution for the isotropic mobility case. Its weak form is
where  (kappa_name) is the gradient energy coefficient,  the non-conserved non-linear order parameter variable the kernel is acting on,  (mob_name) is the scalar (isotropic) mobility associated with the order parameter, and  is the test function.
Input Parameters
- 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 
- displacementsThe displacementsC++ Type:std::vector<VariableName> Unit:(no unit assumed) Controllable:No Description:The displacements 
- kappa_namekappa_opThe kappa used with the kernelDefault:kappa_op C++ Type:MaterialPropertyName Unit:(no unit assumed) Controllable:No Description:The kappa used with the kernel 
- 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) 
- mob_nameLThe mobility used with the kernelDefault:L C++ Type:MaterialPropertyName Unit:(no unit assumed) Controllable:No Description:The mobility used with the kernel 
- variable_LTrueThe mobility is a function of any MOOSE variable (if this is set to false L must be constant over the entire domain!)Default:True C++ Type:bool Controllable:No Description:The mobility is a function of any MOOSE variable (if this is set to false L must be constant over the entire domain!) 
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/phase_field/test/tests/feature_volume_vpp_test/centroid.i)
- (modules/phase_field/test/tests/KKS_system/nonlinear.i)
- (modules/phase_field/examples/kim-kim-suzuki/kks_example_dirichlet.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_offset.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_nested_damped.i)
- (modules/phase_field/test/tests/phase_field_kernels/CoupledAllenCahn.i)
- (modules/combined/examples/phase_field-mechanics/kks_mechanics_KHS.i)
- (modules/combined/test/tests/surface_tension_KKS/surface_tension_VDWgas.i)
- (modules/phase_field/test/tests/GrandPotentialPFM/GrandPotentialMultiphase.i)
- (modules/combined/examples/phase_field-mechanics/SimplePhaseTrans.i)
- (modules/phase_field/examples/kim-kim-suzuki/kks_example_ternary.i)
- (modules/phase_field/test/tests/MultiPhase/lagrangemult.i)
- (modules/phase_field/test/tests/phase_field_kernels/AllenCahn.i)
- (modules/combined/examples/publications/rapid_dev/fig7a.i)
- (modules/phase_field/examples/multiphase/GrandPotential3Phase.i)
- (modules/phase_field/test/tests/phase_field_kernels/AllenCahnVariableL.i)
- (modules/phase_field/test/tests/GrandPotentialPFM/GrandPotentialPFM.i)
- (modules/phase_field/test/tests/phase_field_kernels/CoupledCoefAllenCahn.i)
- (modules/phase_field/examples/rigidbodymotion/AC_CH_advection_constforce_rect.i)
- (modules/phase_field/test/tests/mobility_derivative/AC_mobility_derivative_test.i)
- (modules/phase_field/test/tests/phase_field_kernels/MatGradSquareCoupled.i)
- (modules/phase_field/test/tests/rigidbodymotion/update_orientation_verify.i)
- (modules/combined/examples/phase_field-mechanics/LandauPhaseTrans.i)
- (modules/phase_field/test/tests/KKS_system/lagrange_multiplier.i)
- (modules/phase_field/test/tests/rigidbodymotion/grain_motion_fauxGT.i)
- (modules/combined/examples/publications/rapid_dev/fig6.i)
- (modules/combined/examples/publications/rapid_dev/fig7b.i)
- (modules/phase_field/test/tests/rigidbodymotion/grain_forcedensity.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_multiphase_nested_damped.i)
- (modules/phase_field/test/tests/KKS_system/two_phase.i)
- (modules/phase_field/test/tests/MultiPhase/penalty.i)
- (modules/phase_field/test/tests/rigidbodymotion/grain_motion2.i)
- (modules/phase_field/test/tests/MultiPhase/barrierfunctionmaterial.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_split.i)
- (modules/phase_field/test/tests/KKS_system/auxkernel.i)
- (modules/phase_field/test/tests/slkks/full_solve.i)
- (modules/phase_field/test/tests/KKS_system/kks_multiphase.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_multiphase_nested.i)
- (modules/phase_field/test/tests/mobility_derivative/AC_mobility_derivative_coupled_test.i)
- (modules/phase_field/examples/slkks/CrFe.i)
- (modules/phase_field/test/tests/rigidbodymotion/update_orientation.i)
- (modules/combined/examples/phase_field-mechanics/kks_mechanics_VTS.i)
- (modules/phase_field/test/tests/KKS_system/kks_example.i)
- (modules/phase_field/examples/multiphase/GrandPotential3Phase_masscons.i)
- (modules/phase_field/test/tests/free_energy_material/CoupledValueFunctionFreeEnergy.i)
- (modules/phase_field/examples/kim-kim-suzuki/kks_example_noflux.i)
- (modules/phase_field/test/tests/phase_field_kernels/nonuniform_barrier_coefficient.i)
- (modules/phase_field/test/tests/TotalFreeEnergy/TotalFreeEnergy_2var_test.i)
- (modules/phase_field/test/tests/MultiPhase/switchingfunctionmultiphasematerial.i)
- (modules/phase_field/test/tests/MultiPhase/derivativetwophasematerial.i)
- (modules/phase_field/test/tests/rigidbodymotion/grain_motion.i)
- (modules/combined/test/tests/phase_field_fracture/crack2d_iso_wo_time.i)
- (modules/combined/examples/phase_field-mechanics/Nonconserved.i)
- (modules/phase_field/test/tests/KKS_system/kks_example_nested.i)
- (modules/phase_field/test/tests/MultiPhase/mixedswitchingfunctionmaterial.i)
- (modules/combined/test/tests/surface_tension_KKS/surface_tension_KKS.i)
Child Objects
(modules/phase_field/test/tests/feature_volume_vpp_test/centroid.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 25
  ny = 15
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [c]
  []
  [w]
  []
  [eta]
  []
[]
[ICs]
  [rect_c]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  []
  [rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    type = BoundingBoxIC
  []
[]
[Kernels]
  [c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  []
  [w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  []
  [time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  []
  [eta_dot]
    type = TimeDerivative
    variable = eta
  []
  [acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  []
  [acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  []
[]
[Materials]
  [pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '5.0  2.0      0.1'
  []
  [free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  []
[]
[Postprocessors]
  [grain_center]
    type = GrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'timestep_begin'
  []
[]
[VectorPostprocessors]
  [grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'timestep_begin'
    output_centroids = true
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  dt = 0.2
  num_steps = 4
[]
[Outputs]
  csv = true
[]
(modules/phase_field/test/tests/KKS_system/nonlinear.i)
#
# This test checks if the thwo phase and lagrange multiplier solutions can be replicated
# with a two order parameter approach, where the second order parameter eta2 is a
# nonlinear variable that is set as eta2 := 1 - eta1 (using Reaction, CoupledForce, and BodyForce)
# The solution is reproduced.
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 20
  xmax = 5
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # concentration
  [c]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = x/5
    []
  []
  # order parameter 1
  [eta1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # order parameter 2
  [eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # phase concentration 1
  [c1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.9
  []
  # phase concentration 2
  [c2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  []
[]
[Materials]
  # simple toy free energies
  [f1] # = fd
    type = DerivativeParsedMaterial
    property_name = F1
    coupled_variables = 'c1'
    expression = '(0.9-c1)^2'
  []
  [f2] # = fm
    type = DerivativeParsedMaterial
    property_name = F2
    coupled_variables = 'c2'
    expression = '(0.1-c2)^2'
  []
  # Switching functions for each phase
  [h1_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta1
    function_name = h1
  []
  [h2_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta2
    function_name = h2
  []
  # Coefficients for diffusion equation
  [Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1(eta1)'
    expression = D*h1
    property_name = Dh1
    coupled_variables = eta1
  []
  [Dh2]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2
    property_name = Dh2
    coupled_variables = eta2
  []
  # Barrier functions for each phase
  [g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  []
  [g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names  = 'D   L   kappa'
    prop_values = '0.7 0.7 0.2'
  []
[]
[Kernels]
  #Kernels for diffusion equation
  [diff_time]
    type = TimeDerivative
    variable = c
  []
  [diff_c1]
    type = MatDiffusion
    variable = c
    diffusivity = Dh1
    v = c1
    args = 'eta1'
  []
  [diff_c2]
    type = MatDiffusion
    variable = c
    diffusivity = Dh2
    v = c2
    args = 'eta2'
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = KKSMultiACBulkF
    variable = eta1
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gi_name = g1
    eta_i = eta1
    wi = 0.2
    coupled_variables = 'c1 c2 eta2'
  []
  [ACBulkC1]
    type = KKSMultiACBulkC
    variable = eta1
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    cj_names = 'c1 c2'
    eta_i = eta1
    coupled_variables = 'eta2'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  # Phase concentration constraints
  [chempot12]
    type = KKSPhaseChemicalPotential
    variable = c1
    cb = c2
    fa_name = F1
    fb_name = F2
  []
  [phaseconcentration]
    type = KKSMultiPhaseConcentration
    variable = c2
    cj = 'c1 c2'
    hj_names = 'h1 h2'
    etas = 'eta1 eta2'
    c = c
  []
  # equation for eta2 = 1 - eta1
  # 0 = eta2 + eta1 -1
  [constraint_eta1] #   eta2
    type = Reaction
    variable = eta2
  []
  [constraint_eta2] # + eta1
    type = CoupledForce
    variable = eta2
    coef = -1
    v = eta1
  []
  [constraint_one]  # - 1
    type = BodyForce
    variable = eta2
  []
[]
[AuxKernels]
  [Fglobal_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gj_names = 'g1 g2 '
    variable = Fglobal
    w = 0.2
    interfacial_vars = 'eta1  eta2 '
    kappa_names      = 'kappa kappa'
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -sub_pc_factor_shift_type'
  petsc_options_value = 'lu       nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  end_time = 350
  dt = 10
[]
[VectorPostprocessors]
  [c]
    type = LineValueSampler
    variable = c
    start_point = '0 0 0'
    end_point = '5 0 0'
    num_points = 21
    sort_by = x
  []
[]
[Outputs]
  csv = true
  execute_on = FINAL
[]
(modules/phase_field/examples/kim-kim-suzuki/kks_example_dirichlet.i)
#
# KKS simple example in the split form
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  elem_type = QUAD4
  nx = 50
  ny = 2
  nz = 0
  xmin = 0
  xmax = 20
  ymin = 0
  ymax = 0.4
  zmin = 0
  zmax = 0
[]
[AuxVariables]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # hydrogen concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # Liquid phase solute concentration
  [./cl]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  [../]
  # Solid phase solute concentration
  [./cs]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.9
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = 0.5*(1.0-tanh((x)/sqrt(2.0)))
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = '0.9*(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10)+0.1*(1-(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10))'
  [../]
[]
[ICs]
  [./eta]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
  [../]
  [./c]
    variable = c
    type = FunctionIC
    function = ic_func_c
  [../]
[]
[BCs]
  [./left_c]
    type = DirichletBC
    variable = 'c'
    boundary = 'left'
    value = 0.5
  [../]
  [./left_eta]
    type = DirichletBC
    variable = 'eta'
    boundary = 'left'
    value = 0.5
  [../]
[]
[Materials]
  # Free energy of the liquid
  [./fl]
    type = DerivativeParsedMaterial
    property_name = fl
    coupled_variables = 'cl'
    expression = '(0.1-cl)^2'
  [../]
  # Free energy of the solid
  [./fs]
    type = DerivativeParsedMaterial
    property_name = fs
    coupled_variables = 'cs'
    expression = '(0.9-cs)^2'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   eps_sq'
    prop_values = '0.7 0.7 1.0  '
  [../]
[]
[Kernels]
  # enforce c = (1-h(eta))*cl + h(eta)*cs
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cl
    variable = cs
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotSolute]
    type = KKSPhaseChemicalPotential
    variable = cl
    cb       = cs
    fa_name  = fl
    fb_name  = fs
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cl
    fa_name  = fl
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fl
    fb_name  = fs
    w        = 1.0
    coupled_variables = 'cl cs'
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cl
    cb       = cs
    fa_name  = fl
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = eps_sq
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fl
    fb_name = fs
    w = 1.0
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type'
  petsc_options_value = 'asm      ilu          nonzero'
  l_max_its = 100
  nl_max_its = 100
  nl_abs_tol = 1e-10
  end_time = 800
  dt = 4.0
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Postprocessors]
  [./dofs]
    type = NumDOFs
  [../]
  [./integral]
    type = ElementL2Error
    variable = eta
    function = ic_func_eta
  [../]
[]
[Outputs]
  exodus = true
  console = true
  gnuplot = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_offset.i)
#
# KKS toy problem in the split form
# This has an offset in the minima of the free energies so there will be a shift
# in equilibrium composition
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = -2.5
  xmax = 2.5
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # hydrogen concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # hydrogen phase concentration (matrix)
  [./cm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
  # hydrogen phase concentration (delta phase)
  [./cd]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
[]
[ICs]
  [./eta]
    variable = eta
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.2
    outvalue = 0.1
    int_width = 0.75
  [../]
  [./c]
    variable = c
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.6
    outvalue = 0.4
    int_width = 0.75
  [../]
[]
[BCs]
  [./Periodic]
    [./all]
      variable = 'eta w c cm cd'
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  # Free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '(0.1-cm)^2'
  [../]
  # Free energy of the delta phase
  [./fd]
    type = DerivativeParsedMaterial
    property_name = fd
    coupled_variables = 'cd'
    expression = '(0.9-cd)^2+0.5'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa'
    prop_values = '0.7 0.7 0.4  '
  [../]
[]
[Kernels]
  # full transient
  active = 'PhaseConc ChemPotVacancies CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  # enforce c = (1-h(eta))*cm + h(eta)*cd
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cm
    variable = cd
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb       = cd
    fa_name  = fm
    fb_name  = fd
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cm
    fa_name  = fm
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fm
    fb_name  = fd
    coupled_variables     = 'cm cd'
    w        = 0.4
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cm
    cb       = cd
    fa_name  = fm
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fd
    w = 0.4
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type -pc_factor_shift_type'
  petsc_options_value = ' asm    lu          nonzero                    nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 3
  dt = 0.1
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Outputs]
  file_base = kks_example_offset
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_nested_damped.i)
#
# Two-phase damped nested KKS with log-free energies
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = -2.5
  xmax = 2.5
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # order parameter
  [eta]
    order = FIRST
    family = LAGRANGE
  []
  # hydrogen concentration
  [c]
    order = FIRST
    family = LAGRANGE
  []
  # chemical potential
  [w]
    order = FIRST
    family = LAGRANGE
  []
[]
[ICs]
  [eta]
    variable = eta
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 1
    outvalue = 0.0
    int_width = 0.75
  []
  [c]
    variable = c
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.9
    outvalue = 0.1
    int_width = 0.75
  []
[]
[BCs]
  [Periodic]
    [all]
      variable = 'eta w c'
      auto_direction = 'x y'
    []
  []
[]
[Materials]
  # Free energy of the matrix
  [fm]
    type = DerivativeParsedMaterial
    property_name = fm
    expression = 'cm*log(cm/1e-4) + (1-cm)*log((1-cm)/(1-1e-4))'
    material_property_names = 'cm'
    additional_derivative_symbols = 'cm'
    compute = false
  []
  # Free energy of the delta phase
  [fd]
    type = DerivativeParsedMaterial
    property_name = fd
    expression = 'cd*log(cd/0.9999) + (1-cd)*log((1-cd)/(1-0.9999))'
    material_property_names = 'cd'
    additional_derivative_symbols = 'cd'
    compute = false
  []
  [C]
    type = DerivativeParsedMaterial
    property_name = 'C'
    material_property_names = 'cm cd'
    expression = '(cm>0)&(cm<1)&(cd>0)&(cd<1)'
    compute = false
  []
  # Compute phase concentrations
  [PhaseConcentrationMaterial]
    type = KKSPhaseConcentrationMaterial
    global_cs = 'c'
    ci_names = 'cm cd'
    ci_IC = '0.1 0.9'
    fa_name = fm
    fb_name = fd
    h_name = h
    min_iterations = 1
    max_iterations = 100
    absolute_tolerance = 1e-15
    relative_tolerance = 1e-8
    step_size_tolerance = 1e-05
    nested_iterations = iter
    outputs = exodus
    damped_Newton = true
    conditions = C
    damping_factor = 0.8
  []
  # Compute chain rule terms
  [PhaseConcentrationDerivatives]
    type = KKSPhaseConcentrationDerivatives
    global_cs = 'c'
    eta = eta
    ci_names = 'cm cd'
    fa_name = fm
    fb_name = fd
    h_name = h
  []
  # h(eta)
  [h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  []
  # g(eta)
  [g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'M   L   kappa'
    prop_values = '0.7 0.7 0.4  '
  []
[]
[Kernels]
  # full transient
  active = 'CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  #
  # Cahn-Hilliard Equation
  #
  [CHBulk]
    type = NestedKKSSplitCHCRes
    variable = c
    global_cs = 'c'
    w = w
    all_etas = eta
    ca_names = 'cm cd'
    fa_name = fm
    coupled_variables = 'eta w'
  []
  [dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  []
  [ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  []
  #
  # Allen-Cahn Equation
  #
  [ACBulkF]
    type = NestedKKSACBulkF
    variable = eta
    global_cs = 'c'
    ci_names = 'cm cd'
    fa_name = fm
    fb_name = fd
    g_name = g
    h_name = h
    mob_name = L
    w = 0.4
    coupled_variables = 'c'
  []
  [ACBulkC]
    type = NestedKKSACBulkC
    variable = eta
    global_cs = 'c'
    ci_names = 'cm cd'
    fa_name = fm
    h_name = h
    mob_name = L
    coupled_variables = 'c'
  []
  [ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  []
  [detadt]
    type = TimeDerivative
    variable = eta
  []
[]
[AuxKernels]
  [GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fd
    w = 0.4
  []
[]
[Executioner]
  type = Transient
  scheme = bdf2
    solve_type = 'PJFNK'
    petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type -pc_factor_shift_type'
    petsc_options_value = ' asm    lu          nonzero                    nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 3
  dt = 1e-5
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [full]
    type = SMP
    full = true
  []
[]
[Outputs]
  file_base = kks_example_nested_damped
  exodus = true
[]
(modules/phase_field/test/tests/phase_field_kernels/CoupledAllenCahn.i)
#
# Test the coupled Allen-Cahn Bulk kernel
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 10
  xmax = 12
  ymax = 12
  elem_type = QUAD4
[]
[Variables]
  [./w]
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 0.0
      y1 = 0.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = CoupledAllenCahn
    variable = w
    v = eta
    f_name = F
  [../]
  [./W]
    type = Reaction
    variable = w
  [../]
  [./CoupledBulk]
    type = MatReaction
    variable = eta
    v = w
    reaction_rate = L
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 1
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L'
    prop_values = '1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'eta'
    expression = '2 * eta^2 * (1-eta)^2 - 0.2*eta'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./smp]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'PJFNK'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 10
  nl_rel_tol = 1.0e-11
  start_time = 0.0
  num_steps = 2
  dt = 0.5
[]
[Debug]
  show_var_residual_norms = true
[]
[Outputs]
  hide = w
  file_base = AllenCahn_out
  exodus = true
[]
(modules/combined/examples/phase_field-mechanics/kks_mechanics_KHS.i)
# KKS phase-field model coupled with elasticity using Khachaturyan's scheme as
# described in L.K. Aagesen et al., Computational Materials Science, 140, 10-21 (2017)
# Original run #170403a
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 640
  ny = 1
  nz = 1
  xmin = -10
  xmax = 10
  ymin = 0
  ymax = 0.03125
  zmin = 0
  zmax = 0.03125
  elem_type = HEX8
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute phase concentration (matrix)
  [./cm]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute phase concentration (precipitate)
  [./cp]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_x]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_y]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_z]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[ICs]
  [./eta_ic]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
    block = 0
  [../]
  [./c_ic]
    variable = c
    type = FunctionIC
    function = ic_func_c
    block = 0
  [../]
  [./w_ic]
    variable = w
    type = ConstantIC
    value = 0.00991
    block = 0
  [../]
  [./cm_ic]
    variable = cm
    type = ConstantIC
    value = 0.131
    block = 0
  [../]
  [./cp_ic]
    variable = cp
    type = ConstantIC
    value = 0.236
    block = 0
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = '0.5*(1.0+tanh((x)/delta_eta/sqrt(2.0)))'
    symbol_names = 'delta_eta'
    symbol_values = '0.8034'
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = '0.2389*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^3*(6*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^2-15*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))+10)+0.1339*(1-(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^3*(6*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^2-15*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))+10))'
    symbol_names = 'delta'
    symbol_values = '0.8034'
  [../]
  [./psi_eq_int]
    type = ParsedFunction
    expression = 'volume*psi_alpha'
    symbol_names = 'volume psi_alpha'
    symbol_values = 'volume psi_alpha'
  [../]
  [./gamma]
    type = ParsedFunction
    expression = '(psi_int - psi_eq_int) / dy / dz'
    symbol_names = 'psi_int psi_eq_int dy       dz'
    symbol_values = 'psi_int psi_eq_int 0.03125  0.03125'
  [../]
[]
[AuxVariables]
  [./sigma11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./sigma22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./sigma33]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e12]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e33]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el12]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_el]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./eigen_strain00]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./psi]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./matl_sigma11]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 0
    index_j = 0
    variable = sigma11
  [../]
  [./matl_sigma22]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 1
    index_j = 1
    variable = sigma22
  [../]
  [./matl_sigma33]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 2
    index_j = 2
    variable = sigma33
  [../]
  [./matl_e11]
    type = RankTwoAux
    rank_two_tensor = total_strain
    index_i = 0
    index_j = 0
    variable = e11
  [../]
  [./f_el]
    type = MaterialRealAux
    variable = f_el
    property = f_el_mat
    execute_on = timestep_end
  [../]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fp
    w = 0.0264
    kappa_names = kappa
    interfacial_vars = eta
  [../]
  [./psi_potential]
    variable = psi
    type = ParsedAux
    coupled_variables = 'Fglobal w c f_el sigma11 e11'
    expression = 'Fglobal - w*c + f_el - sigma11*e11'
  [../]
[]
[BCs]
  [./left_x]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  [../]
  [./right_x]
    type = DirichletBC
    variable = disp_x
    boundary = right
    value = 0
  [../]
  [./front_y]
    type = DirichletBC
    variable = disp_y
    boundary = front
    value = 0
  [../]
  [./back_y]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0
  [../]
  [./top_z]
    type = DirichletBC
    variable = disp_z
    boundary = top
    value = 0
  [../]
  [./bottom_z]
    type = DirichletBC
    variable = disp_z
    boundary = bottom
    value = 0
  [../]
[]
[Materials]
  # Chemical free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '6.55*(cm-0.13)^2'
  [../]
  # Chemical Free energy of the precipitate phase
  [./fp]
    type = DerivativeParsedMaterial
    property_name = fp
    coupled_variables = 'cp'
    expression = '6.55*(cp-0.235)^2'
  [../]
# Elastic energy of the precipitate
  [./elastic_free_energy_p]
    type = ElasticEnergyMaterial
    f_name = f_el_mat
    coupled_variables = 'eta'
    outputs = exodus
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # 1- h(eta), putting in function explicitly
  [./one_minus_h_eta_explicit]
    type = DerivativeParsedMaterial
    property_name = one_minus_h_explicit
    coupled_variables = eta
    expression = 1-eta^3*(6*eta^2-15*eta+10)
    outputs = exodus
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa      misfit'
    prop_values = '0.7 0.7 0.01704    0.00377'
  [../]
  #Mechanical properties
  [./Stiffness_matrix]
    type = ComputeElasticityTensor
    base_name = C_matrix
    C_ijkl = '103.3 74.25 74.25 103.3 74.25 103.3 46.75 46.75 46.75'
    fill_method = symmetric9
  [../]
  [./Stiffness_ppt]
    type = ComputeElasticityTensor
    C_ijkl = '100.7 71.45 71.45 100.7 71.45 100.7 50.10 50.10 50.10'
    base_name = C_ppt
    fill_method = symmetric9
  [../]
  [./C]
    type = CompositeElasticityTensor
    coupled_variables = eta
    tensors = 'C_matrix               C_ppt'
    weights = 'one_minus_h_explicit   h'
  [../]
  [./stress]
    type = ComputeLinearElasticStress
  [../]
  [./strain]
    type = ComputeSmallStrain
    displacements = 'disp_x disp_y disp_z'
    eigenstrain_names = 'eigenstrain_ppt'
  [../]
  [./eigen_strain]
    type = ComputeVariableEigenstrain
    eigen_base = '0.00377 0.00377 0.00377 0 0 0'
    prefactor = h
    args = eta
    eigenstrain_name = 'eigenstrain_ppt'
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
  # enforce c = (1-h(eta))*cm + h(eta)*cp
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cm
    variable = cp
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb       = cp
    fa_name  = fm
    fb_name  = fp
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cm
    fa_name  = fm
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fm
    fb_name  = fp
    w        = 0.0264
    coupled_variables = 'cp cm'
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cm
    cb       = cp
    fa_name  = fm
  [../]
  [./ACBulk_el] #This adds df_el/deta for strain interpolation
    type = AllenCahn
    variable = eta
    f_name = f_el_mat
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-11
  num_steps = 200
  [./TimeStepper]
    type = SolutionTimeAdaptiveDT
    dt = 0.5
  [../]
[]
[Postprocessors]
  [./f_el_int]
    type = ElementIntegralMaterialProperty
    mat_prop = f_el_mat
  [../]
  [./c_alpha]
    type =  SideAverageValue
    boundary = left
    variable = c
  [../]
  [./c_beta]
    type =  SideAverageValue
    boundary = right
    variable = c
  [../]
  [./e11_alpha]
    type =  SideAverageValue
    boundary = left
    variable = e11
  [../]
  [./e11_beta]
    type =  SideAverageValue
    boundary = right
    variable = e11
  [../]
  [./s11_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma11
  [../]
  [./s22_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma22
  [../]
  [./s33_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma33
  [../]
  [./s11_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma11
  [../]
  [./s22_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma22
  [../]
  [./s33_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma33
  [../]
  [./f_el_alpha]
    type =  SideAverageValue
    boundary = left
    variable = f_el
  [../]
  [./f_el_beta]
    type =  SideAverageValue
    boundary = right
    variable = f_el
  [../]
  [./f_c_alpha]
    type =  SideAverageValue
    boundary = left
    variable = Fglobal
  [../]
  [./f_c_beta]
    type =  SideAverageValue
    boundary = right
    variable = Fglobal
  [../]
  [./chem_pot_alpha]
    type =  SideAverageValue
    boundary = left
    variable = w
  [../]
  [./chem_pot_beta]
    type =  SideAverageValue
    boundary = right
    variable = w
  [../]
  [./psi_alpha]
    type =  SideAverageValue
    boundary = left
    variable = psi
  [../]
  [./psi_beta]
    type =  SideAverageValue
    boundary = right
    variable = psi
  [../]
  [./total_energy]
    type = ElementIntegralVariablePostprocessor
    variable = Fglobal
  [../]
  # Get simulation cell size from postprocessor
  [./volume]
    type = ElementIntegralMaterialProperty
    mat_prop = 1
  [../]
  [./psi_eq_int]
    type = FunctionValuePostprocessor
    function = psi_eq_int
  [../]
  [./psi_int]
    type = ElementIntegralVariablePostprocessor
    variable = psi
  [../]
  [./gamma]
    type = FunctionValuePostprocessor
    function = gamma
  [../]
  [./int_position]
    type = FindValueOnLine
    start_point = '-10 0 0'
    end_point = '10 0 0'
    v = eta
    target = 0.5
  [../]
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Outputs]
  [./exodus]
    type = Exodus
    time_step_interval = 20
  [../]
  checkpoint = true
  [./csv]
    type = CSV
    execute_on = 'final'
  [../]
[]
(modules/combined/test/tests/surface_tension_KKS/surface_tension_VDWgas.i)
# Test for ComputeExtraStressVDWGas
# Gas bubble with r = 15 nm in a solid matrix
# The gas pressure is counterbalanced by the surface tension of the solid-gas interface,
# which is included with ComputeSurfaceTensionKKS
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 300
  xmin = 0
  xmax = 30
  coord_type = RSPHERICAL
[]
[GlobalParams]
  displacements = 'disp_x'
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # gas concentration
  [./cg]
    order = FIRST
    family = LAGRANGE
  [../]
  # vacancy concentration
  [./cv]
    order = FIRST
    family = LAGRANGE
  [../]
  # gas chemical potential
  [./wg]
    order = FIRST
    family = LAGRANGE
  [../]
  # vacancy chemical potential
  [./wv]
    order = FIRST
    family = LAGRANGE
  [../]
  # Matrix phase gas concentration
  [./cgm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 1.01e-31
  [../]
  # Matrix phase vacancy concentration
  [./cvm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 2.25e-11
  [../]
  # Bubble phase gas concentration
  [./cgb]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.2714
  [../]
  # Bubble phase vacancy concentration
  [./cvb]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.7286
  [../]
[]
[ICs]
  [./eta_ic]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
  [../]
  [./cv_ic]
    variable = cv
    type = FunctionIC
    function = ic_func_cv
  [../]
  [./cg_ic]
    variable = cg
    type = FunctionIC
    function = ic_func_cg
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2+z^2);0.5*(1.0-tanh((r-r0)/delta_eta/sqrt(2.0)))'
    symbol_names = 'delta_eta r0'
    symbol_values = '0.321     15'
  [../]
  [./ic_func_cv]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2+z^2);eta_an:=0.5*(1.0-tanh((r-r0)/delta/sqrt(2.0)));cvbubinit*eta_an^3*(6*eta_an^2-15*eta_an+10)+cvmatrixinit*(1-eta_an^3*(6*eta_an^2-15*eta_an+10))'
    symbol_names = 'delta r0  cvbubinit cvmatrixinit'
    symbol_values = '0.321 15  0.7286    2.25e-11'
  [../]
  [./ic_func_cg]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2+z^2);eta_an:=0.5*(1.0-tanh((r-r0)/delta/sqrt(2.0)));cgbubinit*eta_an^3*(6*eta_an^2-15*eta_an+10)+cgmatrixinit*(1-eta_an^3*(6*eta_an^2-15*eta_an+10))'
    symbol_names = 'delta r0  cgbubinit cgmatrixinit'
    symbol_values = '0.321 15  0.2714    1.01e-31'
  [../]
[]
[Physics/SolidMechanics/QuasiStatic]
  [./all]
    add_variables = true
    generate_output = 'hydrostatic_stress stress_xx stress_yy stress_zz'
  [../]
[]
[Kernels]
  # enforce cg = (1-h(eta))*cgm + h(eta)*cgb
  [./PhaseConc_g]
    type = KKSPhaseConcentration
    ca       = cgm
    variable = cgb
    c        = cg
    eta      = eta
  [../]
  # enforce cv = (1-h(eta))*cvm + h(eta)*cvb
  [./PhaseConc_v]
    type = KKSPhaseConcentration
    ca       = cvm
    variable = cvb
    c        = cv
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cvm
    cb       = cvb
    fa_name  = f_total_matrix
    fb_name  = f_total_bub
    args_a = 'cgm'
    args_b = 'cgb'
  [../]
  [./ChemPotGas]
    type = KKSPhaseChemicalPotential
    variable = cgm
    cb       = cgb
    fa_name  = f_total_matrix
    fb_name  = f_total_bub
    args_a = 'cvm'
    args_b = 'cvb'
  [../]
  #
  # Cahn-Hilliard Equations
  #
  [./CHBulk_g]
    type = KKSSplitCHCRes
    variable = cg
    ca       = cgm
    fa_name  = f_total_matrix
    w        = wg
    args_a   = 'cvm'
  [../]
  [./CHBulk_v]
    type = KKSSplitCHCRes
    variable = cv
    ca       = cvm
    fa_name  = f_total_matrix
    w        = wv
    args_a   = 'cgm'
  [../]
  [./dcgdt]
    type = CoupledTimeDerivative
    variable = wg
    v = cg
  [../]
  [./dcvdt]
    type = CoupledTimeDerivative
    variable = wv
    v = cv
  [../]
  [./wgkernel]
    type = SplitCHWRes
    mob_name = M
    variable = wg
  [../]
  [./wvkernel]
    type = SplitCHWRes
    mob_name = M
    variable = wv
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = f_total_matrix
    fb_name  = f_total_bub
    w        = 0.356
    coupled_variables = 'cvm cvb cgm cgb'
  [../]
  [./ACBulkCv]
    type = KKSACBulkC
    variable = eta
    ca       = cvm
    cb       = cvb
    fa_name  = f_total_matrix
    coupled_variables = 'cgm'
  [../]
  [./ACBulkCg]
    type = KKSACBulkC
    variable = eta
    ca       = cgm
    cb       = cgb
    fa_name  = f_total_matrix
    coupled_variables = 'cvm'
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Materials]
  # Chemical free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cvm cgm'
    material_property_names = 'kvmatrix kgmatrix cvmatrixeq cgmatrixeq'
    expression = '0.5*kvmatrix*(cvm-cvmatrixeq)^2 + 0.5*kgmatrix*(cgm-cgmatrixeq)^2'
  [../]
# Elastic energy of the matrix
  [./elastic_free_energy_m]
    type = ElasticEnergyMaterial
    base_name = matrix
    f_name = fe_m
    coupled_variables = ' '
  [../]
# Total free energy of the matrix
  [./Total_energy_matrix]
    type = DerivativeSumMaterial
    property_name = f_total_matrix
    sum_materials = 'fm fe_m'
    coupled_variables = 'cvm cgm'
  [../]
  # Free energy of the bubble phase
  [./fb]
    type = DerivativeParsedMaterial
    property_name = fb
    coupled_variables = 'cvb cgb'
    material_property_names = 'kToverV nQ Va b f0 kpen kgbub kvbub cvbubeq cgbubeq'
    expression = '0.5*kgbub*(cvb-cvbubeq)^2 + 0.5*kvbub*(cgb-cgbubeq)^2'
  [../]
# Elastic energy of the bubble
  [./elastic_free_energy_p]
    type = ElasticEnergyMaterial
    base_name = bub
    f_name = fe_b
    coupled_variables = ' '
  [../]
# Total free energy of the bubble
  [./Total_energy_bub]
    type = DerivativeSumMaterial
    property_name = f_total_bub
    sum_materials = 'fb fe_b'
    # sum_materials = 'fb'
    coupled_variables = 'cvb cgb'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa  Va      kvmatrix  kgmatrix  kgbub kvbub f0      kpen  cvbubeq cgbubeq b      T'
    prop_values = '0.7 0.7 0.0368 0.03629 223.16    223.16    2.23  2.23  0.0224  1.0   0.6076  0.3924  0.085  800'
  [../]
  [./cvmatrixeq]
    type = ParsedMaterial
    property_name = cvmatrixeq
    material_property_names = 'T'
    constant_names        = 'kB           Efv'
    constant_expressions  = '8.6173324e-5 1.69'
    expression = 'exp(-Efv/(kB*T))'
  [../]
  [./cgmatrixeq]
    type = ParsedMaterial
    property_name = cgmatrixeq
    material_property_names = 'T'
    constant_names        = 'kB           Efg'
    constant_expressions  = '8.6173324e-5 4.92'
    expression = 'exp(-Efg/(kB*T))'
  [../]
  [./kToverV]
    type = ParsedMaterial
    property_name = kToverV
    material_property_names = 'T Va'
    constant_names        = 'k          C44dim' #k in J/K and dimensional C44 in J/m^3
    constant_expressions  = '1.38e-23   63e9'
    expression = 'k*T*1e27/Va/C44dim'
  [../]
  [./nQ]
    type = ParsedMaterial
    property_name = nQ
    material_property_names = 'T'
    constant_names        = 'k          Pi      M         hbar' #k in J/K, M is Xe atomic mass in kg, hbar in J s
    constant_expressions  = '1.38e-23   3.14159 2.18e-25  1.05459e-34'
    expression = '(M*k*T/2/Pi/hbar^2)^1.5 * 1e-27' #1e-27 converts from #/m^3 to #/nm^3
  [../]
  #Mechanical properties
  [./Stiffness_matrix]
    type = ComputeElasticityTensor
    C_ijkl = '0.778 0.7935'
    fill_method = symmetric_isotropic
    base_name = matrix
  [../]
  [./Stiffness_bub]
    type = ComputeElasticityTensor
    C_ijkl = '0.0778 0.07935'
    fill_method = symmetric_isotropic
    base_name = bub
  [../]
  [./strain_matrix]
    type = ComputeRSphericalSmallStrain
    base_name = matrix
  [../]
  [./strain_bub]
    type = ComputeRSphericalSmallStrain
    base_name = bub
  [../]
  [./stress_matrix]
    type = ComputeLinearElasticStress
    base_name = matrix
  [../]
  [./stress_bub]
    type = ComputeLinearElasticStress
    base_name = bub
  [../]
  [./global_stress]
    type = TwoPhaseStressMaterial
    base_A = matrix
    base_B = bub
  [../]
  [./surface_tension]
    type = ComputeSurfaceTensionKKS
    v = eta
    kappa_name = kappa
    w = 0.356
  [../]
  [./gas_pressure]
    type = ComputeExtraStressVDWGas
    T = T
    b = b
    cg = cgb
    Va = Va
    nondim_factor = 63e9
    base_name = bub
    outputs = exodus
  [../]
[]
[BCs]
  [./left_r]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  [../]
[]
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       lu            nonzero'
  l_max_its = 30
  nl_max_its = 15
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1e-11
  num_steps = 2
  dt = 0.5
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/GrandPotentialPFM/GrandPotentialMultiphase.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  xmin = -20
  xmax = 20
  ymin = -20
  ymax = 20
[]
[GlobalParams]
  op_num = 2
  var_name_base = etab
[]
[Variables]
  [w]
  []
  [etaa0]
  []
  [etab0]
  []
  [etab1]
  []
[]
[AuxVariables]
  [bnds]
    order = FIRST
    family = LAGRANGE
  []
[]
[ICs]
  [IC_etaa0]
    type = FunctionIC
    variable = etaa0
    function = ic_func_etaa0
  []
  [IC_etab0]
    type = FunctionIC
    variable = etab0
    function = ic_func_etab0
  []
  [IC_etab1]
    type = FunctionIC
    variable = etab1
    function = ic_func_etab1
  []
  [IC_w]
    type = ConstantIC
    value = -0.05
    variable = w
  []
[]
[Functions]
  [ic_func_etaa0]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2);0.5*(1.0-tanh((r-10.0)/sqrt(2.0)))'
  []
  [ic_func_etab0]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2);0.5*(1.0+tanh((r-10)/sqrt(2.0)))*0.5*(1.0+tanh((y)/sqrt(2.0)))'
  []
  [ic_func_etab1]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2);0.5*(1.0+tanh((r-10)/sqrt(2.0)))*0.5*(1.0-tanh((y)/sqrt(2.0)))'
  []
[]
[BCs]
[]
[Kernels]
  # Order parameter eta_alpha0
  [ACa0_bulk]
    type = ACGrGrMulti
    variable = etaa0
    v = 'etab0 etab1'
    gamma_names = 'gab   gab'
  []
  [ACa0_sw]
    type = ACSwitching
    variable = etaa0
    Fj_names = 'omegaa omegab'
    hj_names = 'ha     hb'
    coupled_variables = 'etab0 etab1 w'
  []
  [ACa0_int]
    type = ACInterface
    variable = etaa0
    kappa_name = kappa
  []
  [ea0_dot]
    type = TimeDerivative
    variable = etaa0
  []
  # Order parameter eta_beta0
  [ACb0_bulk]
    type = ACGrGrMulti
    variable = etab0
    v = 'etaa0 etab1'
    gamma_names = 'gab   gbb'
  []
  [ACb0_sw]
    type = ACSwitching
    variable = etab0
    Fj_names = 'omegaa omegab'
    hj_names = 'ha     hb'
    coupled_variables = 'etaa0 etab1 w'
  []
  [ACb0_int]
    type = ACInterface
    variable = etab0
    kappa_name = kappa
  []
  [eb0_dot]
    type = TimeDerivative
    variable = etab0
  []
  # Order parameter eta_beta1
  [ACb1_bulk]
    type = ACGrGrMulti
    variable = etab1
    v = 'etaa0 etab0'
    gamma_names = 'gab   gbb'
  []
  [ACb1_sw]
    type = ACSwitching
    variable = etab1
    Fj_names = 'omegaa omegab'
    hj_names = 'ha     hb'
    coupled_variables = 'etaa0 etab0 w'
  []
  [ACb1_int]
    type = ACInterface
    variable = etab1
    kappa_name = kappa
  []
  [eb1_dot]
    type = TimeDerivative
    variable = etab1
  []
  #Chemical potential
  [w_dot]
    type = SusceptibilityTimeDerivative
    variable = w
    f_name = chi
    coupled_variables = '' # in this case chi (the susceptibility) is simply a constant
  []
  [Diffusion]
    type = MatDiffusion
    variable = w
    diffusivity = Dchi
    args = ''
  []
  [coupled_etaa0dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etaa0
    Fj_names = 'rhoa rhob'
    hj_names = 'ha   hb'
    coupled_variables = 'etaa0 etab0 etab1'
  []
  [coupled_etab0dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etab0
    Fj_names = 'rhoa rhob'
    hj_names = 'ha   hb'
    coupled_variables = 'etaa0 etab0 etab1'
  []
  [coupled_etab1dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etab1
    Fj_names = 'rhoa rhob'
    hj_names = 'ha   hb'
    coupled_variables = 'etaa0 etab0 etab1'
  []
[]
[AuxKernels]
  [BndsCalc]
    type = BndsCalcAux
    variable = bnds
    execute_on = timestep_end
  []
[]
# enable_jit set to false in many materials to make this test start up faster.
# It is recommended to set enable_jit = true or just remove these lines for
# production runs with this model
[Materials]
  [ha]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = ha
    all_etas = 'etaa0 etab0 etab1'
    phase_etas = 'etaa0'
  []
  [hb]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hb
    all_etas = 'etaa0 etab0 etab1'
    phase_etas = 'etab0 etab1'
  []
  [omegaa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegaa
    material_property_names = 'Vm ka caeq'
    expression = '-0.5*w^2/Vm^2/ka-w/Vm*caeq'
    derivative_order = 2
    enable_jit = false
  []
  [omegab]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegab
    material_property_names = 'Vm kb cbeq'
    expression = '-0.5*w^2/Vm^2/kb-w/Vm*cbeq'
    derivative_order = 2
    enable_jit = false
  []
  [rhoa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhoa
    material_property_names = 'Vm ka caeq'
    expression = 'w/Vm^2/ka + caeq/Vm'
    derivative_order = 2
    enable_jit = false
  []
  [rhob]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhob
    material_property_names = 'Vm kb cbeq'
    expression = 'w/Vm^2/kb + cbeq/Vm'
    derivative_order = 2
    enable_jit = false
  []
  [const]
    type = GenericConstantMaterial
    prop_names = 'kappa_c  kappa   L   D    chi  Vm   ka    caeq kb    cbeq  gab gbb mu'
    prop_values = '0        1       1.0 1.0  1.0  1.0  10.0  0.1  10.0  0.9   4.5 1.5 1.0'
  []
  [Mobility]
    type = DerivativeParsedMaterial
    property_name = Dchi
    material_property_names = 'D chi'
    expression = 'D*chi'
    derivative_order = 2
    enable_jit = false
  []
[]
[Preconditioning]
  [SMP]
    type = SMP
    full = true
  []
[]
[Executioner]
  type = Transient
  scheme = bdf2
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm      31                  lu           1'
  l_tol = 1.0e-3
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1e-8
  num_steps = 2
  [TimeStepper]
    type = TimeSequenceStepper
    time_sequence = '0.1 0.21'
  []
[]
[Outputs]
  exodus = true
[]
(modules/combined/examples/phase_field-mechanics/SimplePhaseTrans.i)
#
# Martensitic transformation
# One structural order parameter (SOP) governed by AllenCahn Eqn.
# Chemical driving force described by Landau Polynomial
# Coupled with elasticity (Mechanics)
# Eigenstrain as a function of SOP
#
[GlobalParams]
  displacements = 'disp_x disp_y'
[]
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 100
  ny = 100
  xmin = 0
  xmax = 100
  ymin = 0
  ymax = 100
  elem_type = QUAD4
[]
[Variables]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 50
      y1 = 50
      radius = 10.0
      invalue = 1.0
      outvalue = 0.0
      int_width = 5.0
    [../]
  [../]
[]
[Physics/SolidMechanics/QuasiStatic]
  [./all]
    add_variables = true
    generate_output = 'stress_xx stress_yy'
    eigenstrain_names = 'eigenstrain'
  [../]
[]
[Kernels]
  [./eta_bulk]
    type = AllenCahn
    variable = eta
    f_name = F
  [../]
  [./eta_interface]
    type = ACInterface
    variable = eta
    kappa_name = kappa_eta
  [../]
  [./time]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1 1'
  [../]
  [./chemical_free_energy]
    type = DerivativeParsedMaterial
    property_name = Fc
    coupled_variables = 'eta'
    constant_names = 'A2 A3 A4'
    constant_expressions = '0.2 -12.6 12.4'
    expression = A2/2*eta^2+A3/3*eta^3+A4/4*eta^4
    enable_jit = true
    derivative_order = 2
  [../]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    C_ijkl = '70 30 30 70 30 70 30 30 30'
    fill_method = symmetric9
  [../]
  [./stress]
    type = ComputeLinearElasticStress
  [../]
  [./var_dependence]
    type = DerivativeParsedMaterial
    expression = eta
    coupled_variables = 'eta'
    property_name = var_dep
    enable_jit = true
    derivative_order = 2
  [../]
  [./eigenstrain]
    type = ComputeVariableEigenstrain
    eigen_base = '0.1 0.1 0 0 0 0'
    prefactor = var_dep
    #outputs = exodus
    coupled_variables = 'eta'
    eigenstrain_name = eigenstrain
  [../]
  [./elastic_free_energy]
    type = ElasticEnergyMaterial
    f_name = Fe
    coupled_variables = 'eta'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeSumMaterial
    property_name = F
    sum_materials = 'Fc Fe'
    coupled_variables = 'eta'
    derivative_order = 2
  [../]
[]
[BCs]
  [./all_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'top bottom left right'
    value = 0
  [../]
  [./all_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'top bottom left right'
    value = 0
  [../]
[]
[Preconditioning]
  # active = ' '
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  # this gives best performance on 4 cores
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type  -sub_pc_type '
  petsc_options_value = 'asm       lu'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-10
  start_time = 0.0
  num_steps = 10
  [./TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 9
    iteration_window = 2
    growth_factor = 1.1
    cutback_factor = 0.75
    dt = 0.3
  [../]
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/examples/kim-kim-suzuki/kks_example_ternary.i)
#
# KKS ternary (3 chemical component) system example in the split form
# We track c1 and c2 only, since c1 + c2 + c3 = 1
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 150
  ny = 15
  nz = 0
  xmin = -25
  xmax = 25
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute 1 concentration
  [./c1]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute 2 concentration
  [./c2]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential solute 1
  [./w1]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential solute 2
  [./w2]
    order = FIRST
    family = LAGRANGE
  [../]
  # Liquid phase solute 1 concentration
  [./c1l]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  [../]
  # Liquid phase solute 2 concentration
  [./c2l]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.05
  [../]
  # Solid phase solute 1 concentration
  [./c1s]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.8
  [../]
  # Solid phase solute 2 concentration
  [./c2s]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = '0.5*(1.0-tanh((x)/sqrt(2.0)))'
  [../]
  [./ic_func_c1]
    type = ParsedFunction
    expression = '0.8*(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10)+0.1*(1-(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10))'
  [../]
  [./ic_func_c2]
    type = ParsedFunction
    expression = '0.1*(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10)+0.05*(1-(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10))'
  [../]
[]
[ICs]
  [./eta]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
  [../]
  [./c1]
    variable = c1
    type = FunctionIC
    function = ic_func_c1
  [../]
  [./c2]
    variable = c2
    type = FunctionIC
    function = ic_func_c2
  [../]
[]
[Materials]
  # Free energy of the liquid
  [./fl]
    type = DerivativeParsedMaterial
    property_name = fl
    coupled_variables = 'c1l c2l'
    expression = '(0.1-c1l)^2+(0.05-c2l)^2'
  [../]
  # Free energy of the solid
  [./fs]
    type = DerivativeParsedMaterial
    property_name = fs
    coupled_variables = 'c1s c2s'
    expression = '(0.8-c1s)^2+(0.1-c2s)^2'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   eps_sq'
    prop_values = '0.7 0.7 1.0  '
  [../]
[]
[Kernels]
  # enforce c1 = (1-h(eta))*c1l + h(eta)*c1s
  [./PhaseConc1]
    type = KKSPhaseConcentration
    ca       = c1l
    variable = c1s
    c        = c1
    eta      = eta
  [../]
  # enforce c2 = (1-h(eta))*c2l + h(eta)*c2s
  [./PhaseConc2]
    type = KKSPhaseConcentration
    ca       = c2l
    variable = c2s
    c        = c2
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotSolute1]
    type = KKSPhaseChemicalPotential
    variable = c1l
    cb       = c1s
    fa_name  = fl
    fb_name  = fs
    args_a   = 'c2l'
    args_b   = 'c2s'
  [../]
  [./ChemPotSolute2]
    type = KKSPhaseChemicalPotential
    variable = c2l
    cb       = c2s
    fa_name  = fl
    fb_name  = fs
    args_a   = 'c1l'
    args_b   = 'c1s'
  [../]
  #
  # Cahn-Hilliard Equations
  #
  [./CHBulk1]
    type = KKSSplitCHCRes
    variable = c1
    ca       = c1l
    fa_name  = fl
    w        = w1
    args_a   = 'c2l'
  [../]
  [./CHBulk2]
    type = KKSSplitCHCRes
    variable = c2
    ca       = c2l
    fa_name  = fl
    w        = w2
    args_a   = 'c1l'
  [../]
  [./dc1dt]
    type = CoupledTimeDerivative
    variable = w1
    v = c1
  [../]
  [./dc2dt]
    type = CoupledTimeDerivative
    variable = w2
    v = c2
  [../]
  [./w1kernel]
    type = SplitCHWRes
    mob_name = M
    variable = w1
  [../]
  [./w2kernel]
    type = SplitCHWRes
    mob_name = M
    variable = w2
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fl
    fb_name  = fs
    w        = 1.0
    coupled_variables = 'c1l c1s c2l c2s'
  [../]
  [./ACBulkC1]
    type = KKSACBulkC
    variable = eta
    ca       = c1l
    cb       = c1s
    fa_name  = fl
    coupled_variables = 'c2l'
  [../]
  [./ACBulkC2]
    type = KKSACBulkC
    variable = eta
    ca       = c2l
    cb       = c2s
    fa_name  = fl
    coupled_variables = 'c1l'
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = eps_sq
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fl
    fb_name = fs
    w = 1.0
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type'
  petsc_options_value = 'asm      ilu          nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 50
  dt = 0.1
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/MultiPhase/lagrangemult.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 14
  ny = 10
  nz = 0
  xmin = 10
  xmax = 40
  ymin = 15
  ymax = 35
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 25.0
      y1 = 25.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta1]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 30.0
      y1 = 25.0
      radius = 4.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 2.0
    [../]
  [../]
  [./eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  [../]
  [./lambda]
    order = FIRST
    family = LAGRANGE
    initial_condition = 1.0
  [../]
[]
[Kernels]
  [./deta1dt]
    type = TimeDerivative
    variable = eta1
  [../]
  [./ACBulk1]
    type = AllenCahn
    variable = eta1
    coupled_variables = 'c eta2'
    f_name = F
  [../]
  [./ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa_eta
  [../]
  [./lagrange1]
    type = SwitchingFunctionConstraintEta
    variable = eta1
    h_name   = h1
    lambda = lambda
  [../]
  [./deta2dt]
    type = TimeDerivative
    variable = eta2
  [../]
  [./ACBulk2]
    type = AllenCahn
    variable = eta2
    coupled_variables = 'c eta1'
    f_name = F
  [../]
  [./ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa_eta
  [../]
  [./lagrange2]
    type = SwitchingFunctionConstraintEta
    variable = eta2
    h_name   = h2
    lambda = lambda
  [../]
  [./lagrange]
    type = SwitchingFunctionConstraintLagrange
    variable = lambda
    etas    = 'eta1 eta2'
    h_names = 'h1   h2'
    epsilon = 0
  [../]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = 'eta1 eta2'
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time1]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
[]
[BCs]
  [./Periodic]
    [./All]
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1 1        '
  [../]
  [./consts2]
    type = GenericConstantMaterial
    prop_names  = 'M kappa_c'
    prop_values = '1 1'
  [../]
  [./switching1]
    type = SwitchingFunctionMaterial
    function_name = h1
    eta = eta1
    h_order = SIMPLE
    outputs = exodus
  [../]
  [./switching2]
    type = SwitchingFunctionMaterial
    function_name = h2
    eta = eta2
    h_order = SIMPLE
    outputs = exodus
  [../]
  [./barrier]
    type = MultiBarrierFunctionMaterial
    etas = 'eta1 eta2'
  [../]
  [./free_energy_A]
    type = DerivativeParsedMaterial
    property_name = Fa
    coupled_variables = 'c'
    expression = '(c-0.1)^2'
    derivative_order = 2
    enable_jit = true
  [../]
  [./free_energy_B]
    type = DerivativeParsedMaterial
    property_name = Fb
    coupled_variables = 'c'
    expression = '(c-0.9)^2'
    derivative_order = 2
    enable_jit = true
  [../]
  [./free_energy]
    type = DerivativeMultiPhaseMaterial
    property_name = F
    fi_names = 'Fa   Fb'
    hi_names = 'h1   h2'
    etas     = 'eta1 eta2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'PJFNK'
  #petsc_options = '-snes_ksp -snes_ksp_ew'
  #petsc_options = '-ksp_monitor_snes_lg-snes_ksp_ew'
  #petsc_options_iname = '-ksp_gmres_restart'
  #petsc_options_value = '1000              '
  l_max_its = 15
  l_tol = 1.0e-6
  nl_max_its = 50
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-10
  start_time = 0.0
  num_steps = 1
  dt = 0.01
  dtmin = 0.01
[]
[Debug]
  # show_var_residual_norms = true
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/phase_field_kernels/AllenCahn.i)
#
# Test the parsed function free enery Allen-Cahn Bulk kernel
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 10
  xmax = 12
  ymax = 12
  elem_type = QUAD4
[]
[Variables]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 0.0
      y1 = 0.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = AllenCahn
    variable = eta
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 1
    variable_L = false
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L'
    prop_values = '1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'eta'
    expression = '2 * eta^2 * (1-eta)^2 - 0.2*eta'
    derivative_order = 2
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'NEWTON'
  num_steps = 2
  dt = 0.5
[]
[Outputs]
  exodus = true
[]
(modules/combined/examples/publications/rapid_dev/fig7a.i)
#
# Fig. 7 input for 10.1016/j.commatsci.2017.02.017
# D. Schwen et al./Computational Materials Science 132 (2017) 36-45
# Solid gray curve (1)
# Eigenstrain and elastic energies ar computed per phase and then interpolated.
# Supply the RADIUS parameter (10-35) on the command line to generate data
# for all curves in the plot.
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 32
  xmin = 0
  xmax = 100
  second_order = true
  coord_type = RSPHERICAL
[]
[GlobalParams]
  displacements = 'disp_r'
[]
[Functions]
  [./diff]
    type = ParsedFunction
    expression = '${RADIUS}-pos_c'
    symbol_names = pos_c
    symbol_values = pos_c
  [../]
[]
# AuxVars to compute the free energy density for outputting
[AuxVariables]
  [./local_energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./cross_energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./local_free_energy]
    type = TotalFreeEnergy
    variable = local_energy
    interfacial_vars = 'c'
    kappa_names = 'kappa_c'
    execute_on = 'INITIAL TIMESTEP_END'
  [../]
[]
[Variables]
  # Solute concentration variable
  [./c]
    [./InitialCondition]
      type = SmoothCircleIC
      invalue = 1
      outvalue = 0
      x1 = 0
      y1 = 0
      radius = ${RADIUS}
      int_width = 3
    [../]
  [../]
  [./w]
  [../]
  # Phase order parameter
  [./eta]
    [./InitialCondition]
      type = SmoothCircleIC
      invalue = 1
      outvalue = 0
      x1 = 0
      y1 = 0
      radius = ${RADIUS}
      int_width = 3
    [../]
  [../]
  # Mesh displacement
  [./disp_r]
    order = SECOND
  [../]
  [./Fe_fit]
    order = SECOND
  [../]
[]
[Kernels]
  # Set up stress divergence kernels
  [./TensorMechanics]
  [../]
  # Split Cahn-Hilliard kernels
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    coupled_variables = 'eta'
    kappa_name = kappa_c
    w = w
  [../]
  [./wres]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  # Allen-Cahn and Lagrange-multiplier constraint kernels for order parameter 1
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk1]
    type = AllenCahn
    variable = eta
    coupled_variables = 'c'
    mob_name = L
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    mob_name = L
    kappa_name = kappa_eta
  [../]
  [./Fe]
    type = MaterialPropertyValue
    prop_name = Fe
    variable = Fe_fit
  [../]
  [./autoadjust]
    type = MaskedBodyForce
    variable = w
    function = diff
    mask = mask
  [../]
[]
[Materials]
  # declare a few constants, such as mobilities (L,M) and interface gradient prefactors (kappa*)
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa_c kappa_eta'
    prop_values = '1.0 1.0 0.5     1'
  [../]
  # forcing function mask
  [./mask]
    type = ParsedMaterial
    property_name = mask
    expression = grad/dt
    material_property_names = 'grad dt'
  [../]
  [./grad]
    type = VariableGradientMaterial
    variable = c
    prop = grad
  [../]
  [./time]
    type = TimeStepMaterial
  [../]
  # global mechanical properties
  [./elasticity_tensor_1]
    type = ComputeElasticityTensor
    C_ijkl = '1 1'
    base_name = phase1
    fill_method = symmetric_isotropic
  [../]
  [./elasticity_tensor_2]
    type = ComputeElasticityTensor
    C_ijkl = '1 1'
    base_name = phase2
    fill_method = symmetric_isotropic
  [../]
  [./strain_1]
    type = ComputeRSphericalSmallStrain
    base_name = phase1
  [../]
  [./strain_2]
    type = ComputeRSphericalSmallStrain
    base_name = phase2
    eigenstrain_names = eigenstrain
  [../]
  [./stress_1]
    type = ComputeLinearElasticStress
    base_name = phase1
  [../]
  [./stress_2]
    type = ComputeLinearElasticStress
    base_name = phase2
  [../]
  # eigenstrain per phase
  [./eigenstrain2]
    type = ComputeEigenstrain
    eigen_base = '0.05 0.05 0.05 0 0 0'
    base_name = phase2
    eigenstrain_name = eigenstrain
  [../]
  # switching functions
  [./switching]
    type = SwitchingFunctionMaterial
    function_name = h
    eta = eta
    h_order = SIMPLE
  [../]
  [./barrier]
    type = BarrierFunctionMaterial
    eta = eta
  [../]
  # chemical free energies
  [./chemical_free_energy_1]
    type = DerivativeParsedMaterial
    property_name = Fc1
    expression = 'c^2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  [./chemical_free_energy_2]
    type = DerivativeParsedMaterial
    property_name = Fc2
    expression = '(1-c)^2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  # elastic free energies
  [./elastic_free_energy_1]
    type = ElasticEnergyMaterial
    f_name = Fe1
    coupled_variables = ''
    base_name = phase1
    derivative_order = 2
  [../]
  [./elastic_free_energy_2]
    type = ElasticEnergyMaterial
    f_name = Fe2
    coupled_variables = ''
    base_name = phase2
    derivative_order = 2
  [../]
  # per phase free energies
  [./free_energy_1]
    type = DerivativeSumMaterial
    property_name = F1
    sum_materials = 'Fc1 Fe1'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  [./free_energy_2]
    type = DerivativeSumMaterial
    property_name = F2
    sum_materials = 'Fc2 Fe2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  # global chemical free energy
  [./global_free_energy]
    type = DerivativeTwoPhaseMaterial
    f_name = F
    fa_name = F1
    fb_name = F2
    eta = eta
    coupled_variables = 'c'
    W = 4
  [../]
  # global stress
  [./global_stress]
    type = TwoPhaseStressMaterial
    base_A = phase1
    base_B = phase2
  [../]
  [./elastic_free_energy]
    type = DerivativeTwoPhaseMaterial
    f_name = Fe
    fa_name = Fe1
    fb_name = Fe2
    eta = eta
    coupled_variables = 'c'
    W = 0
  [../]
[]
[BCs]
  [./left_r]
    type = DirichletBC
    variable = disp_r
    boundary = 'left'
    value = 0
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
# We monitor the total free energy and the total solute concentration (should be constant)
[Postprocessors]
  [./total_free_energy]
    type = ElementIntegralVariablePostprocessor
    variable = local_energy
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./total_solute]
    type = ElementIntegralVariablePostprocessor
    variable = c
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./pos_c]
    type = FindValueOnLine
    start_point = '0 0 0'
    end_point = '100 0 0'
    v = c
    target = 0.582
    tol = 1e-8
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./pos_eta]
    type = FindValueOnLine
    start_point = '0 0 0'
    end_point = '100 0 0'
    v = eta
    target = 0.5
    tol = 1e-8
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./c_min]
    type = ElementExtremeValue
    value_type = min
    variable = c
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
[]
[VectorPostprocessors]
  [./line]
    type = LineValueSampler
    variable = 'Fe_fit c w'
    start_point = '0 0 0'
    end_point =   '100 0 0'
    num_points = 5000
    sort_by = x
    outputs = vpp
    execute_on = 'INITIAL TIMESTEP_END'
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type'
  petsc_options_value = 'asm      lu'
  l_max_its = 30
  nl_max_its = 15
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 2.0e-9
  start_time = 0.0
  end_time = 100000.0
  [./TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 7
    iteration_window = 1
    dt = 1
  [../]
  [./Adaptivity]
    initial_adaptivity = 5
    interval = 10
    max_h_level = 5
    refine_fraction = 0.9
    coarsen_fraction = 0.1
  [../]
[]
[Outputs]
  print_linear_residuals = false
  perf_graph = true
  execute_on = 'INITIAL TIMESTEP_END'
  [./table]
    type = CSV
    delimiter = ' '
    file_base = radius_${RADIUS}/energy_pp
  [../]
  [./vpp]
    type = CSV
    delimiter = ' '
    sync_times = '10 50 100 500 1000 5000 10000 50000 100000'
    sync_only = true
    time_data = true
    file_base = radius_${RADIUS}/energy_vpp
  [../]
[]
(modules/phase_field/examples/multiphase/GrandPotential3Phase.i)
# This is an example of implementation of the multi-phase, multi-order parameter
# grand potential based phase-field model described in Phys. Rev. E, 98, 023309
# (2018). It includes 3 phases with 1 grain of each phase. This example was used
# to generate the results shown in Fig. 3 of the paper.
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 60
  xmin = -15
  xmax = 15
[]
[Variables]
  [./w]
  [../]
  [./etaa0]
  [../]
  [./etab0]
  [../]
  [./etad0]
  [../]
[]
[ICs]
  [./IC_etaa0]
    type = FunctionIC
    variable = etaa0
    function = ic_func_etaa0
  [../]
  [./IC_etab0]
    type = FunctionIC
    variable = etab0
    function = ic_func_etab0
  [../]
  [./IC_etad0]
    type = ConstantIC
    variable = etad0
    value = 0.1
  [../]
  [./IC_w]
    type = FunctionIC
    variable = w
    function = ic_func_w
  [../]
[]
[Functions]
  [./ic_func_etaa0]
    type = ParsedFunction
    expression = '0.9*0.5*(1.0-tanh((x)/sqrt(2.0)))'
  [../]
  [./ic_func_etab0]
    type = ParsedFunction
    expression = '0.9*0.5*(1.0+tanh((x)/sqrt(2.0)))'
  [../]
  [./ic_func_w]
    type = ParsedFunction
    expression = 0
  [../]
[]
[Kernels]
# Order parameter eta_alpha0
  [./ACa0_bulk]
    type = ACGrGrMulti
    variable = etaa0
    v =           'etab0 etad0'
    gamma_names = 'gab   gad'
  [../]
  [./ACa0_sw]
    type = ACSwitching
    variable = etaa0
    Fj_names  = 'omegaa omegab omegad'
    hj_names  = 'ha     hb     hd'
    coupled_variables = 'etab0 etad0 w'
  [../]
  [./ACa0_int]
    type = ACInterface
    variable = etaa0
    kappa_name = kappa
  [../]
  [./ea0_dot]
    type = TimeDerivative
    variable = etaa0
  [../]
# Order parameter eta_beta0
  [./ACb0_bulk]
    type = ACGrGrMulti
    variable = etab0
    v =           'etaa0 etad0'
    gamma_names = 'gab   gbd'
  [../]
  [./ACb0_sw]
    type = ACSwitching
    variable = etab0
    Fj_names  = 'omegaa omegab omegad'
    hj_names  = 'ha     hb     hd'
    coupled_variables = 'etaa0 etad0 w'
  [../]
  [./ACb0_int]
    type = ACInterface
    variable = etab0
    kappa_name = kappa
  [../]
  [./eb0_dot]
    type = TimeDerivative
    variable = etab0
  [../]
# Order parameter eta_delta0
  [./ACd0_bulk]
    type = ACGrGrMulti
    variable = etad0
    v =           'etaa0 etab0'
    gamma_names = 'gad   gbd'
  [../]
  [./ACd0_sw]
    type = ACSwitching
    variable = etad0
    Fj_names  = 'omegaa omegab omegad'
    hj_names  = 'ha     hb     hd'
    coupled_variables = 'etaa0 etab0 w'
  [../]
  [./ACd0_int]
    type = ACInterface
    variable = etad0
    kappa_name = kappa
  [../]
  [./ed0_dot]
    type = TimeDerivative
    variable = etad0
  [../]
#Chemical potential
  [./w_dot]
    type = SusceptibilityTimeDerivative
    variable = w
    f_name = chi
    coupled_variables = 'etaa0 etab0 etad0'
  [../]
  [./Diffusion]
    type = MatDiffusion
    variable = w
    diffusivity = Dchi
    args = ''
  [../]
  [./coupled_etaa0dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etaa0
    Fj_names = 'rhoa rhob rhod'
    hj_names = 'ha   hb   hd'
    coupled_variables = 'etaa0 etab0 etad0'
  [../]
  [./coupled_etab0dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etab0
    Fj_names = 'rhoa rhob rhod'
    hj_names = 'ha   hb   hd'
    coupled_variables = 'etaa0 etab0 etad0'
  [../]
  [./coupled_etad0dot]
    type = CoupledSwitchingTimeDerivative
    variable = w
    v = etad0
    Fj_names = 'rhoa rhob rhod'
    hj_names = 'ha   hb   hd'
    coupled_variables = 'etaa0 etab0 etad0'
  [../]
[]
[Materials]
  [./ha_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = ha
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etaa0'
  [../]
  [./hb_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hb
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etab0'
  [../]
  [./hd_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hd
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etad0'
  [../]
  [./omegaa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegaa
    material_property_names = 'Vm ka caeq'
    expression = '-0.5*w^2/Vm^2/ka-w/Vm*caeq'
    derivative_order = 2
  [../]
  [./omegab]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegab
    material_property_names = 'Vm kb cbeq'
    expression = '-0.5*w^2/Vm^2/kb-w/Vm*cbeq'
    derivative_order = 2
  [../]
  [./omegad]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegad
    material_property_names = 'Vm kd cdeq'
    expression = '-0.5*w^2/Vm^2/kd-w/Vm*cdeq'
    derivative_order = 2
  [../]
  [./rhoa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhoa
    material_property_names = 'Vm ka caeq'
    expression = 'w/Vm^2/ka + caeq/Vm'
    derivative_order = 2
  [../]
  [./rhob]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhob
    material_property_names = 'Vm kb cbeq'
    expression = 'w/Vm^2/kb + cbeq/Vm'
    derivative_order = 2
  [../]
  [./rhod]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhod
    material_property_names = 'Vm kd cdeq'
    expression = 'w/Vm^2/kd + cdeq/Vm'
    derivative_order = 2
  [../]
  [./c]
    type = ParsedMaterial
    material_property_names = 'Vm rhoa rhob rhod ha hb hd'
    expression = 'Vm * (ha * rhoa + hb * rhob + hd * rhod)'
    property_name = c
  [../]
  [./const]
    type = GenericConstantMaterial
    prop_names =  'kappa_c  kappa   L   D    Vm   ka    caeq kb    cbeq  kd    cdeq  gab gad gbd  mu  tgrad_corr_mult'
    prop_values = '0        1       1.0 1.0  1.0  10.0  0.1  10.0  0.9   10.0  0.5   1.5 1.5 1.5  1.0 0.0'
  [../]
  [./Mobility]
    type = DerivativeParsedMaterial
    property_name = Dchi
    material_property_names = 'D chi'
    expression = 'D*chi'
    derivative_order = 2
  [../]
  [./chi]
    type = DerivativeParsedMaterial
    property_name = chi
    material_property_names = 'Vm ha(etaa0,etab0,etad0) ka hb(etaa0,etab0,etad0) kb hd(etaa0,etab0,etad0) kd'
    expression = '(ha/ka + hb/kb + hd/kd) / Vm^2'
    coupled_variables = 'etaa0 etab0 etad0'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[VectorPostprocessors]
  [./etaa0]
    type = LineValueSampler
    variable = etaa0
    start_point = '-15 0 0'
    end_point = '15 0 0'
    num_points = 61
    sort_by = x
    execute_on = 'initial timestep_end final'
  [../]
  [./etab0]
    type = LineValueSampler
    variable = etab0
    start_point = '-15 0 0'
    end_point = '15 0 0'
    num_points = 61
    sort_by = x
    execute_on = 'initial timestep_end final'
  [../]
  [./etad0]
    type = LineValueSampler
    variable = etad0
    start_point = '-15 0 0'
    end_point = '15 0 0'
    num_points = 61
    sort_by = x
    execute_on = 'initial timestep_end final'
  [../]
[]
[Executioner]
  type = Transient
  nl_max_its = 15
  scheme = bdf2
  solve_type = PJFNK
  petsc_options_iname = -pc_type
  petsc_options_value = asm
  l_max_its = 15
  l_tol = 1.0e-3
  nl_rel_tol = 1.0e-8
  start_time = 0.0
  num_steps = 20
  nl_abs_tol = 1e-10
  dt = 1.0
[]
[Outputs]
  [./exodus]
    type = Exodus
    execute_on = 'initial timestep_end final'
    time_step_interval = 1
  [../]
  [./csv]
    type = CSV
    execute_on = 'initial timestep_end final'
    time_step_interval = 1
  [../]
[]
(modules/phase_field/test/tests/phase_field_kernels/AllenCahnVariableL.i)
#
# Test the parsed function free enery Allen-Cahn Bulk kernel
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 10
  xmax = 12
  ymax = 12
  elem_type = QUAD4
[]
[AuxVariables]
  [./chi]
    [./InitialCondition]
      type = FunctionIC
      function = 'x/24+0.5'
    [../]
  [../]
[]
[Variables]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 0.0
      y1 = 0.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = AllenCahn
    variable = eta
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 1
    variable_L = true
    coupled_variables = chi
  [../]
[]
[Materials]
  [./L]
    type = DerivativeParsedMaterial
    property_name = L
    coupled_variables = 'eta chi'
    expression = '0.1 * eta^2 + chi^2'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'eta'
    expression = '2 * eta^2 * (1-eta)^2 - 0.2*eta'
    derivative_order = 2
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'NEWTON'
  num_steps = 2
  dt = 1
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/GrandPotentialPFM/GrandPotentialPFM.i)
# this input file test the implementation of the grand-potential phase-field model based on M.Plapp PRE 84,031601(2011)
# in this simple example, the liquid and solid free energies are parabola with the same curvature and the material properties are constant
# Note that this example also test The SusceptibilityTimeDerivative kernels
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 16
  ny = 16
  xmax = 32
  ymax = 32
[]
[GlobalParams]
  radius = 20.0
  int_width = 4.0
  x1 = 0
  y1 = 0
[]
[Variables]
  [./w]
  [../]
  [./eta]
  [../]
[]
[ICs]
  [./w]
    type = SmoothCircleIC
    variable = w
    # note w = A*(c-cleq), A = 1.0, cleq = 0.0 ,i.e., w = c (in the matrix/liquid phase)
    outvalue = -0.2
    invalue = 0.2
  [../]
  [./eta]
    type = SmoothCircleIC
    variable = eta
    outvalue = 0.0
    invalue = 1.0
  [../]
[]
[Kernels]
  [./w_dot]
    type = SusceptibilityTimeDerivative
    variable = w
    f_name = chi
    coupled_variables = '' # in this case chi (the susceptibility) is simply a constant
  [../]
  [./Diffusion]
    type = MatDiffusion
    variable = w
    diffusivity = D
    args = ''
  [../]
  [./coupled_etadot]
    type = CoupledSusceptibilityTimeDerivative
    variable = w
    v = eta
    f_name = ft
    coupled_variables = 'eta'
  [../]
  [./AC_bulk]
    type = AllenCahn
    variable = eta
    f_name = F
    coupled_variables = 'w'
  [../]
  [./AC_int]
    type = ACInterface
    variable = eta
  [../]
  [./e_dot]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Materials]
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'kappa_op  D    L    chi  cseq   cleq   A'
    prop_values = '4.0       1.0  1.0  1.0  0.0  1.0  1.0'
  [../]
  [./liquid_GrandPotential]
    type = DerivativeParsedMaterial
    expression = '-0.5 * w^2/A - cleq * w'
    coupled_variables = 'w'
    property_name = f1
    material_property_names = 'cleq A'
  [../]
  [./solid_GrandPotential]
    type = DerivativeParsedMaterial
    expression = '-0.5 * w^2/A - cseq * w'
    coupled_variables = 'w'
    property_name = f2
    material_property_names = 'cseq A'
  [../]
  [./switching_function]
    type = SwitchingFunctionMaterial
    eta = eta
    h_order = HIGH
  [../]
  [./barrier_function]
    type = BarrierFunctionMaterial
    eta = eta
  [../]
  [./cs]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = cs
    material_property_names = 'A cseq'
    expression = 'w/A + cseq' # since w = A*(c-cseq)
    derivative_order = 2
  [../]
  [./cl]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = cl
    material_property_names = 'A cleq'
    expression = 'w/A + cleq' # since w = A*(c-cleq)
    derivative_order = 2
  [../]
  [./total_GrandPotential]
    type = DerivativeTwoPhaseMaterial
    coupled_variables = 'w'
    eta = eta
    fa_name = f1
    fb_name = f2
    derivative_order = 2
    W = 1.0
  [../]
  [./coupled_eta_function]
    type = DerivativeParsedMaterial
    expression = '(cs - cl) * dh'
    coupled_variables = 'eta w'
    property_name = ft
    material_property_names = 'cs cl dh:=D[h,eta]'
    derivative_order = 1
    outputs = exodus
  [../]
  [./concentration]
    type = ParsedMaterial
    property_name = c
    material_property_names = 'dF:=D[F,w]'
    expression = '-dF'
    outputs = exodus
  [../]
[]
[Postprocessors]
  [./C]
    type = ElementIntegralMaterialProperty
    mat_prop = c
    execute_on = 'initial timestep_end'
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  l_max_its = 15
  l_tol = 1e-3
  nl_max_its = 15
  nl_rel_tol = 1e-8
  nl_abs_tol = 1e-8
  num_steps = 5
  dt = 10.0
[]
[Outputs]
  exodus = true
  csv = true
  execute_on = 'TIMESTEP_END'
[]
(modules/phase_field/test/tests/phase_field_kernels/CoupledCoefAllenCahn.i)
#
# Test the CoefReaction kernel (which adds -L*v to the residual) for the case
# where v is a coupled variable
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = 0
  xmax = 50
  ymin = 0
  ymax = 50
  zmin = 0
  zmax = 50
  elem_type = QUAD4
[]
[Variables]
  [./w]
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 25.0
      y1 = 25.0
      radius = 6.0
      invalue = 1.0
      outvalue = 0.0
      int_width = 3.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = CoupledAllenCahn
    variable = w
    v = eta
    f_name = F
    mob_name = 1
  [../]
  [./W]
    type = MatReaction
    variable = w
    reaction_rate = -1
  [../]
  [./CoupledBulk]
    type = MatReaction
    variable = eta
    v = w
    reaction_rate = L
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 1
    mob_name = L
    coupled_variables = w
  [../]
[]
[Materials]
  [./mobility]
    type = DerivativeParsedMaterial
    property_name  = L
    coupled_variables = 'eta w'
    expression = '(1.5-eta)^2+(1.5-w)^2'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'eta'
    expression = 'eta^2 * (1-eta)^2'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./smp]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'PJFNK'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 10
  nl_rel_tol = 1.0e-11
  start_time = 0.0
  num_steps = 2
  dt = 0.5
[]
[Outputs]
  hide = w
  exodus = true
[]
(modules/phase_field/examples/rigidbodymotion/AC_CH_advection_constforce_rect.i)
#
# Tests the Rigid Body Motion of grains due to applied forces.
# Concenterated forces and torques have been applied and corresponding
# advection velocities are calculated.
# Grain motion kernels make the grains translate and rotate as a rigidbody,
# applicable to grain movement in porous media
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 50
  ny = 25
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[AuxVariables]
  [./vadvx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadvy]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    # advection kernel corrsponding to CH equation
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./eta_dot]
    type = TimeDerivative
    variable = eta
  [../]
  [./vadv_eta]
    # advection kernel corrsponding to AC equation
    type = SingleGrainRigidBodyMotion
    variable = eta
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  [../]
[]
[AuxKernels]
  [./vadv_x]
    type = GrainAdvectionAux
    component = x
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
    variable = vadvx
  [../]
  [./vadv_y]
    type = GrainAdvectionAux
    component = y
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
    variable = vadvy
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '1.0  2.0      0.1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  [../]
[]
[VectorPostprocessors]
  [./forces]
    # VectorPostprocessor for outputting grain forces and torques
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = GrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ConstantGrainForceAndTorque
    execute_on = 'linear nonlinear'
    force = '0.2 0.0 0.0 ' # size should be 3 * no. of grains
    torque = '0.0 0.0 5.0 ' # size should be 3 * no. of grains
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  nl_max_its = 30
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  dt = 0.1
  end_time = 10
[]
[Outputs]
  exodus = true
[]
[ICs]
  [./rect_c]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  [../]
  [./rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    type = BoundingBoxIC
  [../]
[]
(modules/phase_field/test/tests/mobility_derivative/AC_mobility_derivative_test.i)
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 40
  xmax = 25
[]
[Variables]
  [./op]
  [../]
[]
[ICs]
  [./op_IC]
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 6.0
    invalue = 1
    outvalue = 0
    int_width = 3.0
    variable = op
  [../]
[]
[Kernels]
  [./op_dot]
    type = TimeDerivative
    variable = op
  [../]
  [./op_bulk]
    type = AllenCahn
    variable = op
    f_name = F
    mob_name = L
  [../]
  [./op_interface]
    type = ACInterface
    variable = op
    kappa_name = 1
    mob_name = L
  [../]
[]
[Materials]
  [./consts]
    type = DerivativeParsedMaterial
    property_name  = L
    expression = 'if(op<0, 0.01, if(op>1, 0.01, 1*op^2*(1-op)^2+0.01))'
    coupled_variables = 'op'
    outputs = exodus
    output_properties = 'L dL/dop dL/dv'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'op'
    expression = '2*op^2*(1-op)^2 - 0.2*op'
    derivative_order = 2
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'NEWTON'
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 15
  nl_rel_tol = 1.0e-9
  start_time = 0.0
  num_steps = 20
  dt = 2.0
[]
[Outputs]
  exodus = true
  print_linear_residuals = false
[]
(modules/phase_field/test/tests/phase_field_kernels/MatGradSquareCoupled.i)
#
# Test the MatGradSquareCoupled kernel
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = 0
  xmax = 50
  ymin = 0
  ymax = 50
  zmin = 0
  zmax = 50
  elem_type = QUAD4
[]
[Variables]
  [./w]
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 25.0
      y1 = 25.0
      radius = 6.0
      invalue = 1.0
      outvalue = 0.0
      int_width = 3.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = CoupledAllenCahn
    variable = w
    v = eta
    f_name = F
    mob_name = 1
  [../]
  [./W]
    type = MatReaction
    variable = w
    reaction_rate = -1
  [../]
  [./CoupledBulk]
    type = MatReaction
    variable = eta
    v = w
    reaction_rate = L
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 1
    mob_name = L
    coupled_variables = w
  [../]
# MatGradSquareCoupled kernel
  [./nabla_eta]
    type = MatGradSquareCoupled
    variable = w
    elec_potential = eta
    prefactor = 0.5
  [../]
[]
[Materials]
  [./mobility]
    type = DerivativeParsedMaterial
    property_name  = L
    coupled_variables = 'eta w'
    expression = '(1.5-eta)^2+(1.5-w)^2'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'eta'
    expression = 'eta^2 * (1-eta)^2'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./smp]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'PJFNK'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 10
  nl_rel_tol = 1.0e-11
  start_time = 0.0
  num_steps = 2
  dt = 0.5
[]
[Outputs]
  hide = w
  exodus = true
  console = true
[]
(modules/phase_field/test/tests/rigidbodymotion/update_orientation_verify.i)
# test file for applyting advection term and observing rigid body motion of grains
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 14
  ny = 7
  nz = 7
  xmax = 40
  ymax = 25
  zmax = 25
  elem_type = HEX8
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./eta_dot]
    type = TimeDerivative
    variable = eta
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '5.0  2.0      0.1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  [../]
[]
[AuxVariables]
  [./unique_grains]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./var_indices]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./centroids]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadv_x]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadv_y]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./angle_initial]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./euler_angle]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./unique_grains]
    type = FeatureFloodCountAux
    variable = unique_grains
    flood_counter = grain_center
    field_display = UNIQUE_REGION
    execute_on = timestep_begin
  [../]
  [./var_indices]
    type = FeatureFloodCountAux
    variable = var_indices
    flood_counter = grain_center
    field_display = VARIABLE_COLORING
    execute_on = timestep_begin
  [../]
  [./centroids]
    type = FeatureFloodCountAux
    variable = centroids
    execute_on = timestep_begin
    field_display = CENTROID
    flood_counter = grain_center
  [../]
  [./vadv_x]
    type = GrainAdvectionAux
    grain_force = grain_force
    grain_volumes = grain_volumes
    grain_tracker_object = grain_center
    execute_on = timestep_begin
    component = x
    variable = vadv_x
  [../]
  [./vadv_y]
    type = GrainAdvectionAux
    grain_force = grain_force
    grain_volumes = grain_volumes
    grain_tracker_object = grain_center
    execute_on = timestep_begin
    component = y
    variable = vadv_y
  [../]
  [./angle_initial]
    type = OutputEulerAngles
    variable = angle_initial
    euler_angle_provider = euler_angle_initial
    grain_tracker = grain_center
    output_euler_angle = phi2
    execute_on = timestep_begin
  [../]
  [./angle]
    type = OutputEulerAngles
    variable = euler_angle
    euler_angle_provider = euler_angle
    grain_tracker = grain_center
    output_euler_angle = phi2
    execute_on = timestep_begin
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
  [./angle_check]
    type = EulerAngleUpdaterCheck
    grain_tracker_object = grain_center
    euler_angle_updater = euler_angle
    grain_torques_object = grain_force
    grain_volumes = grain_volumes
    execute_on = timestep_begin
  [../]
[]
[UserObjects]
  [./grain_center]
    type = GrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ConstantGrainForceAndTorque
    execute_on = 'initial timestep_begin linear nonlinear'
    force = '0.5 0.0 0.0 '
    torque = '-200.0 -120.0 1000.0'
  [../]
  [./euler_angle_initial]
    type = RandomEulerAngleProvider
    grain_tracker_object = grain_center
    seed = 12356
    execute_on = 'initial timestep_begin'
  [../]
  [./euler_angle]
    type = EulerAngleUpdater
    grain_tracker_object = grain_center
    euler_angle_provider = euler_angle_initial
    grain_torques_object = grain_force
    grain_volumes = grain_volumes
    execute_on = timestep_begin
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  nl_max_its = 30
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  dt = 0.2
  num_steps = 2
[]
[Outputs]
  csv = true
  exodus = true
[]
[ICs]
  [./rect_c]
    y2 = 20.0
    y1 = 5.0
    z1 = 5.0
    z2 = 20.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  [../]
  [./rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    z1 = 5.0
    z2 = 20.0
    type = BoundingBoxIC
  [../]
[]
(modules/combined/examples/phase_field-mechanics/LandauPhaseTrans.i)
#
# Martensitic transformation
# Chemical driving force described by Landau Polynomial
# Coupled with elasticity (Mechanics)
#
[GlobalParams]
  displacements = 'disp_x disp_y'
[]
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 100
  ny = 100
  xmin = 0
  xmax = 100
  ymin = 0
  ymax = 100
  elem_type = QUAD4
[]
[Variables]
  [./eta1]
    [./InitialCondition]
      type = RandomIC
      min = 0
      max = 0.1
    [../]
  [../]
  [./eta2]
    [./InitialCondition]
      type = RandomIC
      min = 0
      max = 0.1
    [../]
  [../]
[]
[Physics/SolidMechanics/QuasiStatic]
  [./all]
    add_variables = true
    generate_output = 'stress_xx stress_yy'
    eigenstrain_names = 'eigenstrain1 eigenstrain2'
  [../]
[]
[Kernels]
  [./eta_bulk1]
    type = AllenCahn
    variable = eta1
    coupled_variables = 'eta2'
    f_name = F
  [../]
  [./eta_bulk2]
    type = AllenCahn
    variable = eta2
    coupled_variables = 'eta1'
    f_name = F
  [../]
  [./eta_interface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa_eta
  [../]
  [./eta_interface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa_eta
  [../]
  [./deta1dt]
    type = TimeDerivative
    variable = eta1
  [../]
  [./deta2dt]
    type = TimeDerivative
    variable = eta2
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1 1'
  [../]
  [./chemical_free_energy]
    type = DerivativeParsedMaterial
    property_name = Fc
    coupled_variables = 'eta1 eta2'
    constant_names = 'A2 A3 A4'
    constant_expressions = '0.2 -12.6 12.4'
    expression = 'A2/2*(eta1^2+eta2^2) + A3/3*(eta1^3+eta2^3) + A4/4*(eta1^2+eta2^2)^2'
    enable_jit = true
    derivative_order = 2
  [../]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    C_ijkl = '700 300 300 700 300 700 300 300 300'
    fill_method = symmetric9
  [../]
  [./stress]
    type = ComputeLinearElasticStress
  [../]
  [./var_dependence1]
    type = DerivativeParsedMaterial
    property_name = var_dep1
    coupled_variables = 'eta1'
    expression = eta1
    enable_jit = true
    derivative_order = 2
  [../]
  [./var_dependence2]
    type = DerivativeParsedMaterial
    property_name = var_dep2
    coupled_variables = 'eta2'
    expression = eta2
    enable_jit = true
    derivative_order = 2
  [../]
  [./eigenstrain1]
    type = ComputeVariableEigenstrain
    eigen_base = '0.1 -0.1 0 0 0 0'
    prefactor = var_dep1
    args = 'eta1'
    eigenstrain_name = eigenstrain1
  [../]
  [./eigenstrain2]
    type = ComputeVariableEigenstrain
    eigen_base = '-0.1 0.1 0 0 0 0'
    prefactor = var_dep2
    args = 'eta2'
    eigenstrain_name = eigenstrain2
  [../]
  [./elastic_free_energy]
    type = ElasticEnergyMaterial
    f_name = Fe
    coupled_variables = 'eta1 eta2'
    derivative_order = 2
  [../]
  [./totol_free_energy]
    type = DerivativeSumMaterial
    property_name = F
    sum_materials = 'Fc Fe'
    coupled_variables = 'eta1 eta2'
    derivative_order = 2
  [../]
[]
[BCs]
  [./all_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'top bottom left right'
    value = 0
  [../]
  [./all_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'top bottom left right'
    value = 0
  [../]
[]
[Preconditioning]
  # active = ' '
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  # this gives best performance on 4 cores
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type  -sub_pc_type '
  petsc_options_value = 'asm       lu'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-10
  start_time = 0.0
  num_steps = 10
  [./TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 9
    iteration_window = 2
    growth_factor = 1.1
    cutback_factor = 0.75
    dt = 0.3
  [../]
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/lagrange_multiplier.i)
#
# This test ensures that the equilibrium solution using two order parameters with a
# Lagrange multiplier constraint is identical to the dedicated two phase formulation
# in two_phase.i
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 20
  xmax = 5
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # concentration
  [c]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = x/5
    []
  []
  # order parameter 1
  [eta1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # order parameter 2
  [eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # phase concentration 1
  [c1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.2
  []
  # phase concentration 2
  [c2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # Lagrange multiplier
  [lambda]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
[]
[Materials]
  # simple toy free energies
  [f1] # = fd
    type = DerivativeParsedMaterial
    property_name = F1
    coupled_variables = 'c1'
    expression = '(0.9-c1)^2'
  []
  [f2] # = fm
    type = DerivativeParsedMaterial
    property_name = F2
    coupled_variables = 'c2'
    expression = '(0.1-c2)^2'
  []
  # Switching functions for each phase
  [h1_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta1
    function_name = h1
  []
  [h2_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta2
    function_name = h2
  []
  # Coefficients for diffusion equation
  [Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1'
    expression = D*h1
    property_name = Dh1
  []
  [Dh2]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2'
    expression = D*h2
    property_name = Dh2
  []
  # Barrier functions for each phase
  [g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  []
  [g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names  = 'D   L   kappa'
    prop_values = '0.7 0.7 0.2'
  []
[]
[Kernels]
  #Kernels for diffusion equation
  [diff_time]
    type = TimeDerivative
    variable = c
  []
  [diff_c1]
    type = MatDiffusion
    variable = c
    diffusivity = Dh1
    v = c1
  []
  [diff_c2]
    type = MatDiffusion
    variable = c
    diffusivity = Dh2
    v = c2
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = KKSMultiACBulkF
    variable = eta1
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gi_name = g1
    eta_i = eta1
    wi = 0.2
    coupled_variables = 'c1 c2 eta2'
  []
  [ACBulkC1]
    type = KKSMultiACBulkC
    variable = eta1
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    cj_names = 'c1 c2'
    eta_i = eta1
    coupled_variables = 'eta2'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  [multipler1]
    type = MatReaction
    variable = eta1
    v = lambda
    reaction_rate = L
  []
  # Kernels for the Lagrange multiplier equation
  [mult_lambda]
    type = MatReaction
    variable = lambda
    reaction_rate = 2
  []
  [mult_ACBulkF_1]
    type = KKSMultiACBulkF
    variable = lambda
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gi_name = g1
    eta_i = eta1
    wi = 0.2
    mob_name = 1
    coupled_variables = 'c1 c2 eta2 '
  []
  [mult_ACBulkC_1]
    type = KKSMultiACBulkC
    variable = lambda
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    cj_names = 'c1 c2'
    eta_i = eta1
    coupled_variables = 'eta2 '
    mob_name = 1
  []
  [mult_CoupledACint_1]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta1
    kappa_name = kappa
    mob_name = 1
  []
  [mult_ACBulkF_2]
    type = KKSMultiACBulkF
    variable = lambda
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gi_name = g2
    eta_i = eta2
    wi = 0.2
    mob_name = 1
    coupled_variables = 'c1 c2 eta1 '
  []
  [mult_ACBulkC_2]
    type = KKSMultiACBulkC
    variable = lambda
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    cj_names = 'c1 c2'
    eta_i = eta2
    coupled_variables = 'eta1 '
    mob_name = 1
  []
  [mult_CoupledACint_2]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta2
    kappa_name = kappa
    mob_name = 1
  []
  # Kernels for constraint equation eta1 + eta2 = 1
  # eta2 is the nonlinear variable for the constraint equation
  [eta2reaction]
    type = MatReaction
    variable = eta2
    reaction_rate = 1
  []
  [eta1reaction]
    type = MatReaction
    variable = eta2
    v = eta1
    reaction_rate = 1
  []
  [one]
    type = BodyForce
    variable = eta2
    value = -1.0
  []
  # Phase concentration constraints
  [chempot12]
    type = KKSPhaseChemicalPotential
    variable = c1
    cb = c2
    fa_name = F1
    fb_name = F2
  []
  [phaseconcentration]
    type = KKSMultiPhaseConcentration
    variable = c2
    cj = 'c1 c2'
    hj_names = 'h1 h2'
    etas = 'eta1 eta2'
    c = c
  []
[]
[AuxKernels]
  [Fglobal_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gj_names = 'g1 g2 '
    variable = Fglobal
    w = 0.2
    interfacial_vars = 'eta1  eta2 '
    kappa_names      = 'kappa kappa'
  []
[]
[Executioner]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -pc_factor_shift_type'
  petsc_options_value = 'lu       nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 35
  dt = 10
[]
[VectorPostprocessors]
  [c]
    type = LineValueSampler
    variable = c
    start_point = '0 0 0'
    end_point = '5 0 0'
    num_points = 21
    sort_by = x
  []
[]
[Outputs]
  csv = true
  execute_on = FINAL
[]
(modules/phase_field/test/tests/rigidbodymotion/grain_motion_fauxGT.i)
# test file for showing reaction forces between particles
[GlobalParams]
  var_name_base = eta
  op_num = 2
[]
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 5
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
  uniform_refine = 1
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta0]
  [../]
  [./eta1]
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    coupled_variables = 'eta0 eta1'
    w = w
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = 'eta0 eta1'
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
  [../]
  [./eta0_dot]
    type = TimeDerivative
    variable = eta0
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta0
    c = c
    v = 'eta0 eta1'
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
    op_index = 0
  [../]
  [./acint_eta0]
    type = ACInterface
    variable = eta0
    mob_name = M
    #coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta0]
    type = AllenCahn
    variable = eta0
    mob_name = M
    f_name = F
    coupled_variables = 'c eta1'
  [../]
  [./eta1_dot]
    type = TimeDerivative
    variable = eta1
  [../]
  [./vadv_eta1]
    type = SingleGrainRigidBodyMotion
    variable = eta1
    c = c
    v = 'eta0 eta1'
    op_index = 1
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
  [../]
  [./acint_eta1]
    type = ACInterface
    variable = eta1
    mob_name = M
    #coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta1]
    type = AllenCahn
    variable = eta1
    mob_name = M
    f_name = F
    coupled_variables = 'c eta0'
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '1.0  0.5      0.5'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'c eta0 eta1'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+eta0*(1-eta0)*c+eta1*(1-eta1)*c
    derivative_order = 2
  [../]
  [./force_density]
    type = ForceDensityMaterial
    c = c
    etas ='eta0 eta1'
  [../]
[]
[AuxVariables]
  [./bnds]
  [../]
  [./df00]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df01]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df10]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./unique_grains]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./var_indices]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./centroids]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./bnds]
    type = BndsCalcAux
    variable = bnds
    var_name_base = eta
    op_num = 2
    v = 'eta0 eta1'
  [../]
  [./df01]
    type = MaterialStdVectorRealGradientAux
    variable = df01
    index = 0
    component = 1
    property = force_density
  [../]
  [./df11]
    type = MaterialStdVectorRealGradientAux
    variable = df11
    index = 1
    component = 1
    property = force_density
  [../]
  [./df00]
    type = MaterialStdVectorRealGradientAux
    variable = df00
    index = 0
    component = 0
    property = force_density
  [../]
  [./df10]
    type = MaterialStdVectorRealGradientAux
    variable = df10
    index = 1
    component = 0
    property = force_density
  [../]
  [./unique_grains]
    type = FeatureFloodCountAux
    variable = unique_grains
    flood_counter = grain_center
    field_display = UNIQUE_REGION
    execute_on = 'initial timestep_end'
  [../]
  [./var_indices]
    type = FeatureFloodCountAux
    variable = var_indices
    flood_counter = grain_center
    field_display = VARIABLE_COLORING
    execute_on = 'initial timestep_end'
  [../]
  [./centroids]
    type = FeatureFloodCountAux
    variable = centroids
    execute_on = 'initial timestep_end'
    field_display = CENTROID
    flood_counter = grain_center
  [../]
[]
[ICs]
  [./ic_eta0]
    int_width = 1.0
    x1 = 20.0
    y1 = 0.0
    radius = 14.0
    outvalue = 0.0
    variable = eta0
    invalue = 1.0
    type = SmoothCircleIC
  [../]
  [./IC_eta1]
    int_width = 1.0
    x1 = 30.0
    y1 = 25.0
    radius = 14.0
    outvalue = 0.0
    variable = eta1
    invalue = 1.0
    type = SmoothCircleIC
  [../]
  [./ic_c]
    type = SpecifiedSmoothCircleIC
    invalue = 1.0
    outvalue = 0.1
    int_width = 1.0
    x_positions = '20.0 30.0 '
    z_positions = '0.0 0.0 '
    y_positions = '0.0 25.0 '
    radii = '14.0 14.0'
    3D_spheres = false
    variable = c
    block = 0
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = FauxGrainTracker
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
    variable = 'eta0 eta1'
  [../]
  [./grain_force]
    type = ComputeGrainForceAndTorque
    execute_on = 'linear nonlinear'
    grain_data = grain_center
    force_density = force_density
    c = c
    etas = 'eta0 eta1'
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  num_steps = 1
  dt = 0.1
[]
[Outputs]
  exodus = true
  csv = true
[]
(modules/combined/examples/publications/rapid_dev/fig6.i)
#
# Fig. 6 input for 10.1016/j.commatsci.2017.02.017
# D. Schwen et al./Computational Materials Science 132 (2017) 36-45
# Three phase interface simulation demonstrating the interfacial stability
# w.r.t. formation of a tspurious third phase
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 120
  ny = 120
  nz = 0
  xmin = 0
  xmax = 40
  ymin = 0
  ymax = 40
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  # concentration
  [./c]
  [../]
  # order parameter 1
  [./eta1]
  [../]
  # order parameter 2
  [./eta2]
  [../]
  # order parameter 3
  [./eta3]
  [../]
  # phase concentration 1
  [./c1]
    initial_condition = 0.4
  [../]
  # phase concentration 2
  [./c2]
    initial_condition = 0.5
  [../]
  # phase concentration 3
  [./c3]
    initial_condition = 0.8
  [../]
  # Lagrange multiplier
  [./lambda]
    initial_condition = 0.0
  [../]
[]
[AuxVariables]
  [./T]
    [./InitialCondition]
      type = FunctionIC
      function = 'x-10'
    [../]
  [../]
[]
[Functions]
  [./ic_func_eta1]
    type = ParsedFunction
    expression = '0.5*(1.0+tanh((x-10)/sqrt(2.0))) * 0.5*(1.0+tanh((y-10)/sqrt(2.0)))'
  [../]
  [./ic_func_eta2]
    type = ParsedFunction
    expression = '0.5*(1.0-tanh((x-10)/sqrt(2.0)))'
  [../]
  [./ic_func_eta3]
    type = ParsedFunction
    expression = '1 - 0.5*(1.0-tanh((x-10)/sqrt(2.0)))
              - 0.5*(1.0+tanh((x-10)/sqrt(2.0))) * 0.5*(1.0+tanh((y-10)/sqrt(2.0)))'
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = '0.5 * 0.5*(1.0-tanh((x-10)/sqrt(2.0)))
              + 0.4 * 0.5*(1.0+tanh((x-10)/sqrt(2.0))) * 0.5*(1.0+tanh((y-10)/sqrt(2.0)))
              + 0.8 * (1 - 0.5*(1.0-tanh((x-10)/sqrt(2.0)))
                        - 0.5*(1.0+tanh((x-10)/sqrt(2.0))) * 0.5*(1.0+tanh((y-10)/sqrt(2.0))))'
  [../]
[]
[ICs]
  [./eta1]
    variable = eta1
    type = FunctionIC
    function = ic_func_eta1
  [../]
  [./eta2]
    variable = eta2
    type = FunctionIC
    function = ic_func_eta2
  [../]
  [./eta3]
    variable = eta3
    type = FunctionIC
    function = ic_func_eta3
  [../]
  [./c]
    variable = c
    type = FunctionIC
    function = ic_func_c
  [../]
[]
[Materials]
  # simple toy free energies
  [./f1]
    type = DerivativeParsedMaterial
    property_name = F1
    coupled_variables = 'c1'
    expression = '20*(c1-0.4)^2'
  [../]
  [./f2]
    type = DerivativeParsedMaterial
    property_name = F2
    coupled_variables = 'c2 T'
    expression = '20*(c2-0.5)^2 + 0.01*T'
  [../]
  [./f3]
    type = DerivativeParsedMaterial
    property_name = F3
    coupled_variables = 'c3'
    expression = '20*(c3-0.8)^2'
  [../]
  # Switching functions for each phase
  # h1(eta1, eta2, eta3)
  [./h1]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta1
    eta_j = eta2
    eta_k = eta3
    f_name = h1
  [../]
  # h2(eta1, eta2, eta3)
  [./h2]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta2
    eta_j = eta3
    eta_k = eta1
    f_name = h2
  [../]
  # h3(eta1, eta2, eta3)
  [./h3]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta3
    eta_j = eta1
    eta_k = eta2
    f_name = h3
  [../]
  # Coefficients for diffusion equation
  [./Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1'
    expression = D*h1
    property_name = Dh1
  [../]
  [./Dh2]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2'
    expression = D*h2
    property_name = Dh2
  [../]
  [./Dh3]
    type = DerivativeParsedMaterial
    material_property_names = 'D h3'
    expression = D*h3
    property_name = Dh3
  [../]
  # Barrier functions for each phase
  [./g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  [../]
  [./g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  [../]
  [./g3]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta3
    function_name = g3
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'L   kappa  D'
    prop_values = '1.0 1.0    1'
  [../]
[]
[Kernels]
  #Kernels for diffusion equation
  [./diff_time]
    type = TimeDerivative
    variable = c
  [../]
  [./diff_c1]
    type = MatDiffusion
    variable = c
    diffusivity = Dh1
    v = c1
  [../]
  [./diff_c2]
    type = MatDiffusion
    variable = c
    diffusivity = Dh2
    v = c2
  [../]
  [./diff_c3]
    type = MatDiffusion
    variable = c
    diffusivity = Dh3
    v = c3
  [../]
  # Kernels for Allen-Cahn equation for eta1
  [./deta1dt]
    type = TimeDerivative
    variable = eta1
  [../]
  [./ACBulkF1]
    type = KKSMultiACBulkF
    variable  = eta1
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g1
    eta_i     = eta1
    wi        = 1.0
    coupled_variables = 'c1 c2 c3 eta2 eta3'
  [../]
  [./ACBulkC1]
    type = KKSMultiACBulkC
    variable  = eta1
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta1
    coupled_variables = 'eta2 eta3'
  [../]
  [./ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  [../]
  [./multipler1]
    type = MatReaction
    variable = eta1
    v = lambda
    reaction_rate = L
  [../]
  # Kernels for Allen-Cahn equation for eta2
  [./deta2dt]
    type = TimeDerivative
    variable = eta2
  [../]
  [./ACBulkF2]
    type = KKSMultiACBulkF
    variable  = eta2
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g2
    eta_i     = eta2
    wi        = 1.0
    coupled_variables = 'c1 c2 c3 eta1 eta3'
  [../]
  [./ACBulkC2]
    type = KKSMultiACBulkC
    variable  = eta2
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta2
    coupled_variables = 'eta1 eta3'
  [../]
  [./ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  [../]
  [./multipler2]
    type = MatReaction
    variable = eta2
    v = lambda
    reaction_rate = L
  [../]
  # Kernels for the Lagrange multiplier equation
  [./mult_lambda]
    type = MatReaction
    variable = lambda
    reaction_rate = 3
  [../]
  [./mult_ACBulkF_1]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g1
    eta_i     = eta1
    wi        = 1.0
    mob_name  = 1
    coupled_variables = 'c1 c2 c3 eta2 eta3'
  [../]
  [./mult_ACBulkC_1]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta1
    coupled_variables = 'eta2 eta3'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_1]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta1
    kappa_name = kappa
    mob_name = 1
  [../]
  [./mult_ACBulkF_2]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g2
    eta_i     = eta2
    wi        = 1.0
    mob_name  = 1
    coupled_variables = 'c1 c2 c3 eta1 eta3'
  [../]
  [./mult_ACBulkC_2]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta2
    coupled_variables = 'eta1 eta3'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_2]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta2
    kappa_name = kappa
    mob_name = 1
  [../]
  [./mult_ACBulkF_3]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g3
    eta_i     = eta3
    wi        = 1.0
    mob_name  = 1
    coupled_variables = 'c1 c2 c3 eta1 eta2'
  [../]
  [./mult_ACBulkC_3]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta3
    coupled_variables = 'eta1 eta2'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_3]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta3
    kappa_name = kappa
    mob_name = 1
  [../]
  # Kernels for constraint equation eta1 + eta2 + eta3 = 1
  # eta3 is the nonlinear variable for the constraint equation
  [./eta3reaction]
    type = MatReaction
    variable = eta3
    reaction_rate = 1
  [../]
  [./eta1reaction]
    type = MatReaction
    variable = eta3
    v = eta1
    reaction_rate = 1
  [../]
  [./eta2reaction]
    type = MatReaction
    variable = eta3
    v = eta2
    reaction_rate = 1
  [../]
  [./one]
    type = BodyForce
    variable = eta3
    value = -1.0
  [../]
  # Phase concentration constraints
  [./chempot12]
    type = KKSPhaseChemicalPotential
    variable = c1
    cb       = c2
    fa_name  = F1
    fb_name  = F2
  [../]
  [./chempot23]
    type = KKSPhaseChemicalPotential
    variable = c2
    cb       = c3
    fa_name  = F2
    fb_name  = F3
  [../]
  [./phaseconcentration]
    type = KKSMultiPhaseConcentration
    variable = c3
    cj = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    etas = 'eta1 eta2 eta3'
    c = c
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 1000
  [./TimeStepper]
    type = IterationAdaptiveDT
    dt = 0.2
    optimal_iterations = 10
    iteration_window = 2
  [../]
[]
[Preconditioning]
  active = 'full'
  [./full]
    type = SMP
    full = true
  [../]
  [./mydebug]
    type = FDP
    full = true
  [../]
[]
[Outputs]
  exodus = true
  checkpoint = true
  print_linear_residuals = false
  [./csv]
    type = CSV
    execute_on = 'final'
  [../]
[]
#[VectorPostprocessors]
#  [./c]
#    type =  LineValueSampler
#    start_point = '-25 0 0'
#    end_point = '25 0 0'
#    variable = c
#    num_points = 151
#    sort_by =  id
#    execute_on = timestep_end
#  [../]
#  [./eta1]
#    type =  LineValueSampler
#    start_point = '-25 0 0'
#    end_point = '25 0 0'
#    variable = eta1
#    num_points = 151
#    sort_by =  id
#    execute_on = timestep_end
#  [../]
#  [./eta2]
#    type =  LineValueSampler
#    start_point = '-25 0 0'
#    end_point = '25 0 0'
#    variable = eta2
#    num_points = 151
#    sort_by =  id
#    execute_on = timestep_end
#  [../]
#  [./eta3]
#    type =  LineValueSampler
#    start_point = '-25 0 0'
#    end_point = '25 0 0'
#    variable = eta3
#    num_points = 151
#    sort_by =  id
#    execute_on = timestep_end
#  [../]
#[]
(modules/combined/examples/publications/rapid_dev/fig7b.i)
#
# Fig. 7 input for 10.1016/j.commatsci.2017.02.017
# D. Schwen et al./Computational Materials Science 132 (2017) 36-45
# Dashed black curve (2)
# Eigenstrain is globally applied. Single global elastic free energies.
# Supply the RADIUS parameter (10-35) on the command line to generate data
# for all curves in the plot.
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 32
  xmin = 0
  xmax = 100
  second_order = true
  coord_type = RSPHERICAL
[]
[GlobalParams]
  displacements = 'disp_r'
[]
[Functions]
  [./diff]
    type = ParsedFunction
    expression = '${RADIUS}-pos_c'
    symbol_names = pos_c
    symbol_values = pos_c
  [../]
[]
# AuxVars to compute the free energy density for outputting
[AuxVariables]
  [./local_energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./cross_energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./local_free_energy]
    type = TotalFreeEnergy
    variable = local_energy
    interfacial_vars = 'c'
    kappa_names = 'kappa_c'
    execute_on = 'INITIAL TIMESTEP_END'
  [../]
[]
[Variables]
  # Solute concentration variable
  [./c]
    [./InitialCondition]
      type = SmoothCircleIC
      invalue = 1
      outvalue = 0
      x1 = 0
      y1 = 0
      radius = ${RADIUS}
      int_width = 3
    [../]
  [../]
  [./w]
  [../]
  # Phase order parameter
  [./eta]
    [./InitialCondition]
      type = SmoothCircleIC
      invalue = 1
      outvalue = 0
      x1 = 0
      y1 = 0
      radius = ${RADIUS}
      int_width = 3
    [../]
  [../]
  [./Fe_fit]
    order = SECOND
  [../]
[]
[Physics/SolidMechanics/QuasiStatic/all]
  add_variables = true
  eigenstrain_names = eigenstrain
[]
[Kernels]
  # Split Cahn-Hilliard kernels
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    coupled_variables = 'eta'
    kappa_name = kappa_c
    w = w
  [../]
  [./wres]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  # Allen-Cahn and Lagrange-multiplier constraint kernels for order parameter 1
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk1]
    type = AllenCahn
    variable = eta
    coupled_variables = 'c'
    mob_name = L
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    mob_name = L
    kappa_name = kappa_eta
  [../]
  [./Fe]
    type = MaterialPropertyValue
    prop_name = Fe
    variable = Fe_fit
  [../]
  [./autoadjust]
    type = MaskedBodyForce
    variable = w
    function = diff
    mask = mask
  [../]
[]
[Materials]
  # declare a few constants, such as mobilities (L,M) and interface gradient prefactors (kappa*)
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa_c kappa_eta'
    prop_values = '1.0 1.0 0.5     1'
  [../]
  # forcing function mask
  [./mask]
    type = ParsedMaterial
    property_name = mask
    expression = grad/dt
    material_property_names = 'grad dt'
  [../]
  [./grad]
    type = VariableGradientMaterial
    variable = c
    prop = grad
  [../]
  [./time]
    type = TimeStepMaterial
  [../]
  # global mechanical properties
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    C_ijkl = '1 1'
    fill_method = symmetric_isotropic
  [../]
  [./stress]
    type = ComputeLinearElasticStress
  [../]
  # eigenstrain as a function of phase
  [./eigenstrain]
    type = ComputeVariableEigenstrain
    eigen_base = '0.05 0.05 0.05 0 0 0'
    prefactor = h
    args = eta
    eigenstrain_name = eigenstrain
  [../]
  # switching functions
  [./switching]
    type = SwitchingFunctionMaterial
    function_name = h
    eta = eta
    h_order = SIMPLE
  [../]
  [./barrier]
    type = BarrierFunctionMaterial
    eta = eta
  [../]
  # chemical free energies
  [./chemical_free_energy_1]
    type = DerivativeParsedMaterial
    property_name = Fc1
    expression = 'c^2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  [./chemical_free_energy_2]
    type = DerivativeParsedMaterial
    property_name = Fc2
    expression = '(1-c)^2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
  # global chemical free energy
  [./chemical_free_energy]
    type = DerivativeTwoPhaseMaterial
    f_name = Fc
    fa_name = Fc1
    fb_name = Fc2
    eta = eta
    coupled_variables = 'c'
    W = 4
  [../]
  # global elastic free energy
  [./elastic_free_energy]
    type = ElasticEnergyMaterial
    f_name = Fe
    coupled_variables = 'eta'
    output_properties = Fe
    outputs = 'all'
    derivative_order = 2
  [../]
  # free energy
  [./free_energy]
    type = DerivativeSumMaterial
    property_name = F
    sum_materials = 'Fc Fe'
    coupled_variables = 'c eta'
    derivative_order = 2
  [../]
[]
[BCs]
  [./left_r]
    type = DirichletBC
    variable = disp_r
    boundary = 'left'
    value = 0
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
# We monitor the total free energy and the total solute concentration (should be constant)
[Postprocessors]
  [./total_free_energy]
    type = ElementIntegralVariablePostprocessor
    variable = local_energy
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./total_solute]
    type = ElementIntegralVariablePostprocessor
    variable = c
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./pos_c]
    type = FindValueOnLine
    start_point = '0 0 0'
    end_point = '100 0 0'
    v = c
    target = 0.582
    tol = 1e-8
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./pos_eta]
    type = FindValueOnLine
    start_point = '0 0 0'
    end_point = '100 0 0'
    v = eta
    target = 0.5
    tol = 1e-8
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
  [./c_min]
    type = ElementExtremeValue
    value_type = min
    variable = c
    execute_on = 'INITIAL TIMESTEP_END'
    outputs = 'table console'
  [../]
[]
[VectorPostprocessors]
  [./line]
    type = LineValueSampler
    variable = 'Fe_fit c w'
    start_point = '0 0 0'
    end_point =   '100 0 0'
    num_points = 5000
    sort_by = x
    outputs = vpp
    execute_on = 'INITIAL TIMESTEP_END'
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type'
  petsc_options_value = 'asm      lu'
  l_max_its = 30
  nl_max_its = 15
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 2.0e-9
  start_time = 0.0
  end_time = 100000.0
  [./TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 8
    iteration_window = 1
    dt = 1
  [../]
  [./Adaptivity]
    initial_adaptivity = 5
    interval = 10
    max_h_level = 5
    refine_fraction = 0.9
    coarsen_fraction = 0.1
  [../]
[]
[Outputs]
  print_linear_residuals = false
  perf_graph = true
  execute_on = 'INITIAL TIMESTEP_END'
  [./table]
    type = CSV
    delimiter = ' '
    file_base = radius_${RADIUS}/eigenstrain_pp
  [../]
  [./vpp]
    type = CSV
    delimiter = ' '
    sync_times = '10 50 100 500 1000 5000 10000 50000 100000'
    sync_only = true
    time_data = true
    file_base = radius_${RADIUS}/eigenstrain_vpp
  [../]
[]
(modules/phase_field/test/tests/rigidbodymotion/grain_forcedensity.i)
# test file for showing reaction forces between particles
[GlobalParams]
  var_name_base = eta
  op_num = 2
[]
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 5
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
  uniform_refine = 1
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta0]
  [../]
  [./eta1]
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    coupled_variables = 'eta0 eta1'
    w = w
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = 'eta0 eta1'
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
  [../]
  [./eta0_dot]
    type = TimeDerivative
    variable = eta0
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta0
    c = c
    v = 'eta0 eta1'
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
    op_index = 0
  [../]
  [./acint_eta0]
    type = ACInterface
    variable = eta0
    mob_name = M
    #coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta0]
    type = AllenCahn
    variable = eta0
    mob_name = M
    f_name = F
    coupled_variables = 'c eta1'
  [../]
  [./eta1_dot]
    type = TimeDerivative
    variable = eta1
  [../]
  [./vadv_eta1]
    type = SingleGrainRigidBodyMotion
    variable = eta1
    c = c
    v = 'eta0 eta1'
    op_index = 1
    grain_force = grain_force
    grain_tracker_object = grain_center
    grain_volumes = grain_volumes
  [../]
  [./acint_eta1]
    type = ACInterface
    variable = eta1
    mob_name = M
    #coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta1]
    type = AllenCahn
    variable = eta1
    mob_name = M
    f_name = F
    coupled_variables = 'c eta0'
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '1.0  0.5      0.5'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'c eta0 eta1'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+eta0*(1-eta0)*c+eta1*(1-eta1)*c
    derivative_order = 2
  [../]
  [./force_density]
    type = ForceDensityMaterial
    c = c
    etas ='eta0 eta1'
  [../]
[]
[AuxVariables]
  [./bnds]
  [../]
  [./df00]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df01]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df10]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./df11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./unique_grains]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./var_indices]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./centroids]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./bnds]
    type = BndsCalcAux
    variable = bnds
    var_name_base = eta
    op_num = 2
    v = 'eta0 eta1'
  [../]
  [./df01]
    type = MaterialStdVectorRealGradientAux
    variable = df01
    index = 0
    component = 1
    property = force_density
  [../]
  [./df11]
    type = MaterialStdVectorRealGradientAux
    variable = df11
    index = 1
    component = 1
    property = force_density
  [../]
  [./df00]
    type = MaterialStdVectorRealGradientAux
    variable = df00
    index = 0
    component = 0
    property = force_density
  [../]
  [./df10]
    type = MaterialStdVectorRealGradientAux
    variable = df10
    index = 1
    component = 0
    property = force_density
  [../]
  [./unique_grains]
    type = FeatureFloodCountAux
    variable = unique_grains
    flood_counter = grain_center
    field_display = UNIQUE_REGION
    execute_on = timestep_begin
  [../]
  [./var_indices]
    type = FeatureFloodCountAux
    variable = var_indices
    flood_counter = grain_center
    field_display = VARIABLE_COLORING
    execute_on = timestep_begin
  [../]
  [./centroids]
    type = FeatureFloodCountAux
    variable = centroids
    execute_on = timestep_begin
    field_display = CENTROID
    flood_counter = grain_center
  [../]
[]
[ICs]
  [./ic_eta0]
    int_width = 1.0
    x1 = 20.0
    y1 = 0.0
    radius = 14.0
    outvalue = 0.0
    variable = eta0
    invalue = 1.0
    type = SmoothCircleIC
  [../]
  [./IC_eta1]
    int_width = 1.0
    x1 = 30.0
    y1 = 25.0
    radius = 14.0
    outvalue = 0.0
    variable = eta1
    invalue = 1.0
    type = SmoothCircleIC
  [../]
  [./ic_c]
    type = SpecifiedSmoothCircleIC
    invalue = 1.0
    outvalue = 0.1
    int_width = 1.0
    x_positions = '20.0 30.0 '
    z_positions = '0.0 0.0 '
    y_positions = '0.0 25.0 '
    radii = '14.0 14.0'
    3D_spheres = false
    variable = c
    block = 0
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = GrainTracker
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ComputeGrainForceAndTorque
    execute_on = 'linear nonlinear'
    grain_data = grain_center
    force_density = force_density
    c = c
    etas = 'eta0 eta1'
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  num_steps = 1
  dt = 0.1
[]
[Outputs]
  exodus = true
  csv = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_multiphase_nested_damped.i)
#
# This test is for the damped nested solve of 3-phase KKS model, and uses log-based free energies.
# The split-form of the Cahn-Hilliard equation instead of the Fick's diffusion equation is solved
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  nz = 0
  xmin = 0
  xmax = 40
  ymin = 0
  ymax = 40
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[BCs]
  [Periodic]
    [all]
      auto_direction = 'x y'
    []
  []
[]
[AuxVariables]
  [Energy]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # concentration
  [c]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 1
  [eta1]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 2
  [eta2]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 3
  [eta3]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
  # chemical potential
  [mu]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
  # Lagrange multiplier
  [lambda]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
[]
[ICs]
  [eta1]
    variable = eta1
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.9
    outvalue = 0.1
    int_width = 4
  []
  [eta2]
    variable = eta2
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.1
    outvalue = 0.9
    int_width = 4
  []
  [c]
    variable = c
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.2
    outvalue = 0.5
    int_width = 2
  []
[]
[Materials]
  # simple toy free energies
  [F1]
    type = DerivativeParsedMaterial
    property_name = F1
    expression = 'c1*log(c1/1e-4) + (1-c1)*log((1-c1)/(1-1e-4))'
    material_property_names = 'c1'
    additional_derivative_symbols = 'c1'
    compute = false
  []
  [F2]
    type = DerivativeParsedMaterial
    property_name = F2
    expression = 'c2*log(c2/0.5) + (1-c2)*log((1-c2)/(1-0.5))'
    material_property_names = 'c2'
    additional_derivative_symbols = 'c2'
    compute = false
  []
  [F3]
    type = DerivativeParsedMaterial
    property_name = F3
    expression = 'c3*log(c3/0.9999) + (1-c3)*log((1-c3)/(1-0.9999))'
    material_property_names = 'c3'
    additional_derivative_symbols = 'c3'
    compute = false
  []
  [C]
    type = DerivativeParsedMaterial
    property_name = 'C'
    material_property_names = 'c1 c2 c3'
    expression = '(c1>0)&(c1<1)&(c2>0)&(c2<1)&(c3>0)&(c3<1)'
    compute = false
  []
  [KKSPhaseConcentrationMultiPhaseMaterial]
    type = KKSPhaseConcentrationMultiPhaseMaterial
    global_cs = 'c'
    all_etas = 'eta1 eta2 eta3'
    hj_names = 'h1 h2 h3'
    ci_names = 'c1 c2 c3'
    ci_IC = '0.2 0.5 0.8'
    Fj_names = 'F1 F2 F3'
    min_iterations = 1
    max_iterations = 1000
    absolute_tolerance = 1e-15
    relative_tolerance = 1e-8
    step_size_tolerance = 1e-05
    damped_Newton = true
    conditions = C
    damping_factor = 0.8
  []
  [KKSPhaseConcentrationMultiPhaseDerivatives]
    type = KKSPhaseConcentrationMultiPhaseDerivatives
    global_cs = 'c'
    all_etas = 'eta1 eta2 eta3'
    Fj_names = 'F1 F2 F3'
    hj_names = 'h1 h2 h3'
    ci_names = 'c1 c2 c3'
  []
  # Switching functions for each phase
  # h1(eta1, eta2, eta3)
  [h1]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta1
    eta_j = eta2
    eta_k = eta3
    property_name = h1
  []
  # h2(eta1, eta2, eta3)
  [h2]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta2
    eta_j = eta3
    eta_k = eta1
    property_name = h2
  []
  # h3(eta1, eta2, eta3)
  [h3]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta3
    eta_j = eta1
    eta_k = eta2
    property_name = h3
  []
  # Barrier functions for each phase
  [g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  []
  [g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  []
  [g3]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta3
    function_name = g3
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'L   kappa  M'
    prop_values = '0.7 1.0    0.025'
  []
[]
[Kernels]
  [lambda_lagrange]
    type = SwitchingFunctionConstraintLagrange
    variable = lambda
    etas = 'eta1 eta2 eta3'
    h_names = 'h1   h2   h3'
    epsilon = 1e-04
  []
  [eta1_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta1
    h_name = h1
    lambda = lambda
    coupled_variables = 'eta2 eta3'
  []
  [eta2_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta2
    h_name = h2
    lambda = lambda
    coupled_variables = 'eta1 eta3'
  []
  [eta3_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta3
    h_name = h3
    lambda = lambda
    coupled_variables = 'eta1 eta2'
  []
  #Kernels for Cahn-Hilliard equation
  [diff_time]
    type = CoupledTimeDerivative
    variable = mu
    v = c
  []
  [CHBulk]
    type = NestedKKSMultiSplitCHCRes
    variable = c
    all_etas = 'eta1 eta2 eta3'
    global_cs = 'c'
    w = mu
    c1_names = 'c1'
    F1_name = F1
    coupled_variables = 'eta1 eta2 eta3 mu'
  []
  [ckernel]
    type = SplitCHWRes
    variable = mu
    mob_name = M
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = NestedKKSMultiACBulkF
    variable = eta1
    global_cs = 'c'
    eta_i = eta1
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g1
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta2 eta3'
  []
  [ACBulkC1]
    type = NestedKKSMultiACBulkC
    variable = eta1
    global_cs = 'c'
    eta_i = eta1
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta2 eta3'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  # Kernels for Allen-Cahn equation for eta2
  [deta2dt]
    type = TimeDerivative
    variable = eta2
  []
  [ACBulkF2]
    type = NestedKKSMultiACBulkF
    variable = eta2
    global_cs = 'c'
    eta_i = eta2
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g2
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta1 eta3'
  []
  [ACBulkC2]
    type = NestedKKSMultiACBulkC
    variable = eta2
    global_cs = 'c'
    eta_i = eta2
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta1 eta3'
  []
  [ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  []
  # Kernels for Allen-Cahn equation for eta3
  [deta3dt]
    type = TimeDerivative
    variable = eta3
  []
  [ACBulkF3]
    type = NestedKKSMultiACBulkF
    variable = eta3
    global_cs = 'c'
    eta_i = eta3
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g3
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta1 eta2'
  []
  [ACBulkC3]
    type = NestedKKSMultiACBulkC
    variable = eta3
    global_cs = 'c'
    eta_i = eta3
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta1 eta2'
  []
  [ACInterface3]
    type = ACInterface
    variable = eta3
    kappa_name = kappa
  []
[]
[AuxKernels]
  [Energy_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 F3'
    hj_names = 'h1 h2 h3'
    gj_names = 'g1 g2 g3'
    variable = Energy
    w = 1
    interfacial_vars = 'eta1  eta2  eta3'
    kappa_names = 'kappa kappa kappa'
  []
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 2
  dt = 0.01
[]
[Preconditioning]
  active = 'full'
  [full]
    type = SMP
    full = true
  []
  [mydebug]
    type = FDP
    full = true
  []
[]
[Outputs]
  file_base = kks_example_multiphase_nested_damped
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/two_phase.i)
#
# This test ensures that the equilibrium solution using the dedicated two phase
# formulation is identical to the two order parameters with a Lagrange multiplier
# constraint in lagrange_multiplier.i
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 20
  xmax = 5
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # order parameter
  [eta]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # hydrogen concentration
  [c]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = x/5
    []
  []
  # chemical potential
  [w]
    order = FIRST
    family = LAGRANGE
  []
  # hydrogen phase concentration (matrix)
  [cm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.2
  []
  # hydrogen phase concentration (delta phase)
  [cd]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
[]
[Materials]
  # Free energy of the matrix
  [fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '(0.1-cm)^2'
  []
  # Free energy of the delta phase
  [fd]
    type = DerivativeParsedMaterial
    property_name = fd
    coupled_variables = 'cd'
    expression = '(0.9-cd)^2'
  []
  # h(eta)
  [h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  []
  # g(eta)
  [g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa'
    prop_values = '0.7 0.7 0.4  '
  []
[]
[Kernels]
  # full transient
  active = 'PhaseConc ChemPotVacancies CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  # enforce c = (1-h(eta))*cm + h(eta)*cd
  [PhaseConc]
    type = KKSPhaseConcentration
    ca = cm
    variable = cd
    c = c
    eta = eta
  []
  # enforce pointwise equality of chemical potentials
  [ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb = cd
    fa_name = fm
    fb_name = fd
  []
  #
  # Cahn-Hilliard Equation
  #
  [CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca = cm
    fa_name = fm
    w = w
  []
  [dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  []
  [ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  []
  #
  # Allen-Cahn Equation
  #
  [ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name = fm
    fb_name = fd
    coupled_variables = 'cm cd'
    w = 0.4
  []
  [ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca = cm
    cb = cd
    fa_name = fm
    mob_name = L
  []
  [ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
    mob_name = L
  []
  [detadt]
    type = TimeDerivative
    variable = eta
  []
[]
[AuxKernels]
  [GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fd
    w = 0.4
  []
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type -pc_factor_shift_type'
  petsc_options_value = ' asm    lu          nonzero                    nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 35
  dt = 10
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [full]
    type = SMP
    full = true
  []
[]
[VectorPostprocessors]
  [c]
    type = LineValueSampler
    variable = c
    start_point = '0 0 0'
    end_point = '5 0 0'
    num_points = 21
    sort_by = x
  []
[]
[Outputs]
  csv = true
  execute_on = FINAL
[]
(modules/phase_field/test/tests/MultiPhase/penalty.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 14
  ny = 10
  nz = 0
  xmin = 10
  xmax = 40
  ymin = 15
  ymax = 35
  elem_type = QUAD4
[]
[GlobalParams]
  penalty = 5
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 25.0
      y1 = 25.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta1]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 30.0
      y1 = 25.0
      radius = 4.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 2.0
    [../]
  [../]
  [./eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  [../]
[]
[Kernels]
  [./deta1dt]
    type = TimeDerivative
    variable = eta1
  [../]
  [./ACBulk1]
    type = AllenCahn
    variable = eta1
    coupled_variables = 'c eta2'
    f_name = F
  [../]
  [./ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa_eta
  [../]
  [./penalty1]
    type = SwitchingFunctionPenalty
    variable = eta1
    etas    = 'eta1 eta2'
    h_names = 'h1   h2'
  [../]
  [./deta2dt]
    type = TimeDerivative
    variable = eta2
  [../]
  [./ACBulk2]
    type = AllenCahn
    variable = eta2
    coupled_variables = 'c eta1'
    f_name = F
  [../]
  [./ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa_eta
  [../]
  [./penalty2]
    type = SwitchingFunctionPenalty
    variable = eta2
    etas    = 'eta1 eta2'
    h_names = 'h1   h2'
  [../]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = 'eta1 eta2'
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time1]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
[]
[BCs]
  [./Periodic]
    [./All]
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1 1        '
  [../]
  [./consts2]
    type = GenericConstantMaterial
    prop_names  = 'M kappa_c'
    prop_values = '1 1'
  [../]
  [./hsum]
    type = ParsedMaterial
    expression = h1+h2
    property_name = hsum
    material_property_names = 'h1 h2'
    coupled_variables = 'c'
    outputs = exodus
  [../]
  [./switching1]
    type = SwitchingFunctionMaterial
    function_name = h1
    eta = eta1
    h_order = SIMPLE
  [../]
  [./switching2]
    type = SwitchingFunctionMaterial
    function_name = h2
    eta = eta2
    h_order = SIMPLE
  [../]
  [./barrier]
    type = MultiBarrierFunctionMaterial
    etas = 'eta1 eta2'
  [../]
  [./free_energy_A]
    type = DerivativeParsedMaterial
    property_name = Fa
    coupled_variables = 'c'
    expression = '(c-0.1)^2'
    derivative_order = 2
  [../]
  [./free_energy_B]
    type = DerivativeParsedMaterial
    property_name = Fb
    coupled_variables = 'c'
    expression = '(c-0.9)^2'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeMultiPhaseMaterial
    property_name = F
    fi_names = 'Fa   Fb'
    hi_names = 'h1   h2'
    etas     = 'eta1 eta2'
    coupled_variables = 'c'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type'
  petsc_options_value = 'asm       lu'
  l_max_its = 15
  l_tol = 1.0e-6
  nl_max_its = 50
  nl_rel_tol = 1.0e-7
  nl_abs_tol = 1.0e-9
  start_time = 0.0
  num_steps = 2
  dt = 0.05
  dtmin = 0.01
[]
[Debug]
  # show_var_residual_norms = true
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/rigidbodymotion/grain_motion2.i)
# test file for applyting advection term and observing rigid body motion of grains
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 25
  ny = 15
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[AuxVariables]
  [./vadvx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadvy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./unique_grains]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./centroids]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./eta_dot]
    type = TimeDerivative
    variable = eta
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  [../]
[]
[AuxKernels]
  [./vadv_x]
    type = GrainAdvectionAux
    component = x
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
    variable = vadvx
  [../]
  [./vadv_y]
    type = GrainAdvectionAux
    component = y
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
    variable = vadvy
  [../]
  [./unique_grains]
    type = FeatureFloodCountAux
    variable = unique_grains
    flood_counter = grain_center
    field_display = UNIQUE_REGION
    execute_on = 'initial timestep_begin'
  [../]
  [./centroids]
    type = FeatureFloodCountAux
    variable = centroids
    execute_on = 'initial timestep_begin'
    field_display = CENTROID
    flood_counter = grain_center
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '5.0  2.0      0.1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = FauxGrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ConstantGrainForceAndTorque
    execute_on = 'initial linear nonlinear'
    force = '0.5 0.0 0.0 '
    torque = '0.0 0.0 10.0 '
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  nl_max_its = 30
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  dt = 0.5
  num_steps = 1
[]
[Outputs]
  exodus = true
[]
[ICs]
  [./rect_c]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  [../]
  [./rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    type = BoundingBoxIC
  [../]
[]
(modules/phase_field/test/tests/MultiPhase/barrierfunctionmaterial.i)
# This is a test of the BarrierFunctionMaterial option = HIGH
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  xmin = 0
  xmax = 20
  ymin = 0
  ymax = 20
  elem_type = QUAD4
[]
[Variables]
  [./eta]
  [../]
[]
[ICs]
  [./IC_eta]
    type = SmoothCircleIC
    variable = eta
    x1 = 10
    y1 = 10
    radius = 5
    invalue = 1
    outvalue = 0
    int_width = 1
  [../]
[]
[Kernels]
  [./eta_bulk]
    type = AllenCahn
    variable = eta
    f_name = 0
    mob_name = 1
  [../]
  [./eta_interface]
    type = ACInterface
    variable = eta
    kappa_name = 1
    mob_name = 1
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Materials]
  [./barrier]
    type = BarrierFunctionMaterial
    eta = eta
    g_order = HIGH
    outputs = exodus
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  num_steps = 2
[]
[Problem]
  solve = false
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_split.i)
#
# KKS toy problem in the split form
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = -2.5
  xmax = 2.5
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # hydrogen concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # hydrogen phase concentration (matrix)
  [./cm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
  # hydrogen phase concentration (delta phase)
  [./cd]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
[]
[ICs]
  [./eta]
    variable = eta
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.2
    outvalue = 0.1
    int_width = 0.75
  [../]
  [./c]
    variable = c
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.6
    outvalue = 0.4
    int_width = 0.75
  [../]
[]
[BCs]
  [./Periodic]
    [./all]
      variable = 'eta w c cm cd'
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  # Free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '(0.1-cm)^2'
  [../]
  # Free energy of the delta phase
  [./fd]
    type = DerivativeParsedMaterial
    property_name = fd
    coupled_variables = 'cd'
    expression = '(0.9-cd)^2'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa'
    prop_values = '0.7 0.7 0.4  '
  [../]
[]
[Kernels]
  # full transient
  active = 'PhaseConc ChemPotVacancies CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  # enforce c = (1-h(eta))*cm + h(eta)*cd
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cm
    variable = cd
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb       = cd
    fa_name  = fm
    fb_name  = fd
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cm
    fa_name  = fm
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fm
    fb_name  = fd
    coupled_variables     = 'cm cd'
    w        = 0.4
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cm
    cb       = cd
    fa_name  = fm
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fd
    w = 0.4
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type -pc_factor_shift_type'
  petsc_options_value = ' asm    lu          nonzero                    nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 3
  dt = 0.1
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Outputs]
  file_base = kks_example_split
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/auxkernel.i)
#
# This test checks if the two phase and lagrange multiplier solutions can be replicated
# with a two order parameter approach, where the second order parameter eta2 is an
# auxiliary variable that is set as eta2 := 1 - eta1
# The solution is reproduced, but convergence is suboptimal, as important Jacobian
# terms for eta1 (that should come indirectly from eta2) are missing.
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 20
  xmax = 5
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
  # order parameter 2
  [eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
[]
#
# With this approach the derivative w.r.t. eta1 is lost in all terms depending on
# eta2 a potential fix would be to make eta2 a material property with derivatives.
# This would require a major rewrite of the phase field kernels, though.
#
[AuxKernels]
  [eta2]
    type = ParsedAux
    variable = eta2
    expression = '1-eta1'
    coupled_variables = eta1
  []
[]
[Variables]
  # concentration
  [c]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = x/5
    []
  []
  # order parameter 1
  [eta1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # phase concentration 1
  [c1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.9
  []
  # phase concentration 2
  [c2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  []
[]
[Materials]
  # simple toy free energies
  [f1] # = fd
    type = DerivativeParsedMaterial
    property_name = F1
    coupled_variables = 'c1'
    expression = '(0.9-c1)^2'
  []
  [f2] # = fm
    type = DerivativeParsedMaterial
    property_name = F2
    coupled_variables = 'c2'
    expression = '(0.1-c2)^2'
  []
  # Switching functions for each phase
  [h1_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta1
    function_name = h1
  []
  [h2_eta]
    type = DerivativeParsedMaterial
    material_property_names = 'h1(eta1)'
    expression = '1-h1'
    property_name = h2
    coupled_variables = eta1
  []
  # Coefficients for diffusion equation
  [Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1(eta1)'
    expression = D*h1
    property_name = Dh1
    coupled_variables = eta1
  []
  [Dh2]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta1)'
    expression = 'D*h2'
    property_name = Dh2
    coupled_variables = eta1
  []
  # Barrier functions for each phase
  [g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  []
  [g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names  = 'D   L   kappa'
    prop_values = '0.7 0.7 0.2'
  []
[]
[Kernels]
  #Kernels for diffusion equation
  [diff_time]
    type = TimeDerivative
    variable = c
  []
  [diff_c1]
    type = MatDiffusion
    variable = c
    diffusivity = Dh1
    v = c1
    args = eta1
  []
  [diff_c2]
    type = MatDiffusion
    variable = c
    diffusivity = Dh2
    v = c2
    args = eta1
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = KKSMultiACBulkF
    variable = eta1
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    gi_name = g1
    eta_i = eta1
    wi = 0.2
    coupled_variables = 'c1 c2 eta2'
  []
  [ACBulkC1]
    type = KKSMultiACBulkC
    variable = eta1
    Fj_names = 'F1 F2'
    hj_names = 'h1 h2'
    cj_names = 'c1 c2'
    eta_i = eta1
    coupled_variables = 'eta2'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  # Phase concentration constraints
  [chempot12]
    type = KKSPhaseChemicalPotential
    variable = c1
    cb = c2
    fa_name = F1
    fb_name = F2
  []
  [phaseconcentration]
    type = KKSMultiPhaseConcentration
    variable = c2
    cj = 'c1 c2'
    hj_names = 'h1 h2'
    etas = 'eta1 eta2'
    c = c
  []
[]
[AuxKernels]
  [Fglobal_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 '
    hj_names = 'h1 h2 '
    gj_names = 'g1 g2 '
    variable = Fglobal
    w = 0.2
    interfacial_vars = 'eta1  eta2 '
    kappa_names      = 'kappa kappa'
  []
[]
[Executioner]
  type = Transient
  solve_type = PJFNK
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu      '
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  end_time = 350
  dt = 10
[]
[Preconditioning]
  [full]
    type = SMP
    full = true
  []
[]
[VectorPostprocessors]
  [c]
    type = LineValueSampler
    variable = c
    start_point = '0 0 0'
    end_point = '5 0 0'
    num_points = 21
    sort_by = x
  []
[]
[Outputs]
  csv = true
  execute_on = FINAL
[]
(modules/phase_field/test/tests/slkks/full_solve.i)
#
# SLKKS two phase example for the BCC and SIGMA phases. The sigma phase contains
# multiple sublattices. Free energy from
# Jacob, Aurelie, Erwin Povoden-Karadeniz, and Ernst Kozeschnik. "Revised thermodynamic
# description of the Fe-Cr system based on an improved sublattice model of the sigma phase."
# Calphad 60 (2018): 16-28.
#
# In this simulation we consider diffusion (Cahn-Hilliard) and phase transformation.
#
[Mesh]
  [gen]
    type = GeneratedMeshGenerator
    dim = 1
    nx = 30
    ny = 1
    xmin = -25
    xmax = 25
  []
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # order parameters
  [eta1]
    initial_condition = 0.5
  []
  [eta2]
    initial_condition = 0.5
  []
  # solute concentration
  [cCr]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.5+0.1'
    []
  []
  # sublattice concentrations (good guesses are needed here! - they can be obtained
  # form a static solve like in sublattice_concentrations.i)
  [BCC_CR]
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.5+0.1'
    []
  []
  [SIGMA_0CR]
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.17+0.01'
    []
  []
  [SIGMA_1CR]
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.36+0.02'
    []
  []
  [SIGMA_2CR]
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.33+0.20'
    []
  []
  # Lagrange multiplier
  [lambda]
  []
[]
[Materials]
  # CALPHAD free energies
  [F_BCC_A2]
    type = DerivativeParsedMaterial
    property_name = F_BCC_A2
    outputs = exodus
    output_properties = F_BCC_A2
    expression = 'BCC_FE:=1-BCC_CR; G := 8.3145*T*(1.0*if(BCC_CR > 1.0e-15,BCC_CR*log(BCC_CR),0) + '
               '1.0*if(BCC_FE > 1.0e-15,BCC_FE*plog(BCC_FE,eps),0) + 3.0*if(BCC_VA > '
               '1.0e-15,BCC_VA*log(BCC_VA),0))/(BCC_CR + BCC_FE) + 8.3145*T*if(T < '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - '
               '1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(0.525599232981783*BCC_CR*BCC_FE*BCC_'
               'VA*(BCC_CR - BCC_FE) - 0.894055608820709*BCC_CR*BCC_FE*BCC_VA + '
               '0.298657718120805*BCC_CR*BCC_VA - BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
               '4.65558036243985e-30*T^9/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
               '1.3485349181899e-10*T^3/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
               '0.905299382744392*(548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA + '
               '1.0e-9)/T,if(T < -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + '
               '1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(-0.525599232981783*BCC_CR*BCC_FE*BCC'
               '_VA*(BCC_CR - BCC_FE) + 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - '
               '0.298657718120805*BCC_CR*BCC_VA + BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
               '4.65558036243985e-30*T^9/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) '
               '+ 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
               '1.3485349181899e-10*T^3/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
               '0.905299382744392*(-548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA + '
               '1.0e-9)/T,if(T > -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA & '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA < '
               '0,-79209031311018.7*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
               '3.83095660520737e+42*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
               '1.22565886734485e+72*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,if(T > '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA & 548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - '
               'BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA > '
               '0,-79209031311018.7*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
               '3.83095660520737e+42*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
               '1.22565886734485e+72*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,0))))*log((2.15*BCC_CR*BCC_FE*BCC_VA - '
               '0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA)*if(2.15*BCC_CR*BCC_FE*BCC_VA - '
               '0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA <= 0,-1.0,1.0) + 1)/(BCC_CR + BCC_FE) + '
               '1.0*(BCC_CR*BCC_VA*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + '
               'BCC_FE*BCC_VA*if(T >= 298.15 & T < 1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T '
               '- 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < '
               '6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - 25383.581,0)))/(BCC_CR '
               '+ BCC_FE) + 1.0*(BCC_CR*BCC_FE*BCC_VA*(500.0 - 1.5*T)*(BCC_CR - BCC_FE) + '
               'BCC_CR*BCC_FE*BCC_VA*(24600.0 - 14.98*T) + BCC_CR*BCC_FE*BCC_VA*(9.15*T - '
               '14000.0)*(BCC_CR - BCC_FE)^2)/(BCC_CR + BCC_FE); G/100000'
    coupled_variables = 'BCC_CR'
    constant_names = 'BCC_VA T eps'
    constant_expressions = '1 1000 0.01'
  []
  [F_SIGMA]
    type = DerivativeParsedMaterial
    property_name = F_SIGMA
    outputs = exodus
    output_properties = F_SIGMA
    expression = 'SIGMA_0FE := 1-SIGMA_0CR; SIGMA_1FE := 1-SIGMA_1CR; SIGMA_2FE := 1-SIGMA_2CR; G := '
               '8.3145*T*(10.0*if(SIGMA_0CR > 1.0e-15,SIGMA_0CR*plog(SIGMA_0CR,eps),0) + '
               '10.0*if(SIGMA_0FE > 1.0e-15,SIGMA_0FE*plog(SIGMA_0FE,eps),0) + 4.0*if(SIGMA_1CR > '
               '1.0e-15,SIGMA_1CR*plog(SIGMA_1CR,eps),0) + 4.0*if(SIGMA_1FE > '
               '1.0e-15,SIGMA_1FE*plog(SIGMA_1FE,eps),0) + 16.0*if(SIGMA_2CR > '
               '1.0e-15,SIGMA_2CR*plog(SIGMA_2CR,eps),0) + 16.0*if(SIGMA_2FE > '
               '1.0e-15,SIGMA_2FE*plog(SIGMA_2FE,eps),0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + '
               '4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
               '(SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*SIGMA_2FE*(-70.0*T - 170400.0) + '
               'SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*SIGMA_2FE*(-10.0*T - 330839.0))/(10.0*SIGMA_0CR + '
               '10.0*SIGMA_0FE + 4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
               '(SIGMA_0CR*SIGMA_1CR*SIGMA_2CR*(30.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - '
               '26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= '
               '2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) '
               '+ 132000.0) + SIGMA_0CR*SIGMA_1CR*SIGMA_2FE*(-110.0*T + 16.0*if(T >= 298.15 & T < '
               '1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - '
               '5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - '
               '46.0*T*log(T) + 299.31255*T - 25383.581,0)) + 14.0*if(T >= 298.15 & T < '
               '2180.0,139250.0*1/T - 26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - '
               '1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - '
               '50.0*T*log(T) + 344.18*T - 34869.344,0)) + 123500.0) + '
               'SIGMA_0CR*SIGMA_1FE*SIGMA_2CR*(4.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 26.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 140486.0) '
               '+ SIGMA_0CR*SIGMA_1FE*SIGMA_2FE*(20.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 10.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 148800.0) '
               '+ SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*(10.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 20.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 56200.0) + '
               'SIGMA_0FE*SIGMA_1CR*SIGMA_2FE*(26.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 4.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 152700.0) '
               '+ SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*(14.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 16.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 46200.0) + '
               'SIGMA_0FE*SIGMA_1FE*SIGMA_2FE*(30.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 173333.0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + 4.0*SIGMA_1CR + '
               '4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE); G/100000'
    coupled_variables = 'SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    constant_names = 'T eps'
    constant_expressions = '1000 0.01'
  []
  # h(eta)
  [h1]
    type = SwitchingFunctionMaterial
    function_name = h1
    h_order = HIGH
    eta = eta1
  []
  [h2]
    type = SwitchingFunctionMaterial
    function_name = h2
    h_order = HIGH
    eta = eta2
  []
  # g(eta)
  [g1]
    type = BarrierFunctionMaterial
    function_name = g1
    g_order = SIMPLE
    eta = eta1
  []
  [g2]
    type = BarrierFunctionMaterial
    function_name = g2
    g_order = SIMPLE
    eta = eta2
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'D   L   kappa'
    prop_values = '10  1   0.1  '
  []
  # Coefficients for diffusion equation
  [Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1(eta1)'
    expression = D*h1
    property_name = Dh1
    coupled_variables = eta1
    derivative_order = 1
  []
  [Dh2a]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*10/30
    property_name = Dh2a
    coupled_variables = eta2
    derivative_order = 1
  []
  [Dh2b]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*4/30
    property_name = Dh2b
    coupled_variables = eta2
    derivative_order = 1
  []
  [Dh2c]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*16/30
    property_name = Dh2c
    coupled_variables = eta2
    derivative_order = 1
  []
[]
[Kernels]
  #Kernels for diffusion equation
  [diff_time]
    type = TimeDerivative
    variable = cCr
  []
  [diff_c1]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh1
    v = BCC_CR
    args = eta1
  []
  [diff_c2a]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2a
    v = SIGMA_0CR
    args = eta2
  []
  [diff_c2b]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2b
    v = SIGMA_1CR
    args = eta2
  []
  [diff_c2c]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2c
    v = SIGMA_2CR
    args = eta2
  []
  # enforce pointwise equality of chemical potentials
  [chempot1a2a]
    # The BCC phase has only one sublattice
    # we tie it to the first sublattice with site fraction 10/(10+4+16) in the sigma phase
    type = KKSPhaseChemicalPotential
    variable = BCC_CR
    cb = SIGMA_0CR
    kb = '${fparse 10/30}'
    fa_name = F_BCC_A2
    fb_name = F_SIGMA
    args_b = 'SIGMA_1CR SIGMA_2CR'
  []
  [chempot2a2b]
    # This kernel ties the first two sublattices in the sigma phase together
    type = SLKKSChemicalPotential
    variable = SIGMA_0CR
    a = 10
    cs = SIGMA_1CR
    as = 4
    F = F_SIGMA
    coupled_variables = 'SIGMA_2CR'
  []
  [chempot2b2c]
    # This kernel ties the remaining two sublattices in the sigma phase together
    type = SLKKSChemicalPotential
    variable = SIGMA_1CR
    a = 4
    cs = SIGMA_2CR
    as = 16
    F = F_SIGMA
    coupled_variables = 'SIGMA_0CR'
  []
  [phaseconcentration]
    # This kernel ties the sum of the sublattice concentrations to the global concentration cCr
    type = SLKKSMultiPhaseConcentration
    variable = SIGMA_2CR
    c = cCr
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = KKSMultiACBulkF
    variable = eta1
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1    h2'
    gi_name = g1
    eta_i = eta1
    wi = 0.1
    coupled_variables = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR eta2'
  []
  [ACBulkC1]
    type = SLKKSMultiACBulkC
    variable = eta1
    F = F_BCC_A2
    c = BCC_CR
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  [lagrange1]
    type = SwitchingFunctionConstraintEta
    variable = eta1
    h_name = h1
    lambda = lambda
    coupled_variables = 'eta2'
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta2dt]
    type = TimeDerivative
    variable = eta2
  []
  [ACBulkF2]
    type = KKSMultiACBulkF
    variable = eta2
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1    h2'
    gi_name = g2
    eta_i = eta2
    wi = 0.1
    coupled_variables = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR eta1'
  []
  [ACBulkC2]
    type = SLKKSMultiACBulkC
    variable = eta2
    F = F_BCC_A2
    c = BCC_CR
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  [ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  []
  [lagrange2]
    type = SwitchingFunctionConstraintEta
    variable = eta2
    h_name = h2
    lambda = lambda
    coupled_variables = 'eta1'
  []
  # Lagrange-multiplier constraint kernel for lambda
  [lagrange]
    type = SwitchingFunctionConstraintLagrange
    variable = lambda
    h_names = 'h1   h2'
    etas = 'eta1 eta2'
    epsilon = 1e-6
  []
[]
[AuxKernels]
  [GlobalFreeEnergy]
    type = KKSMultiFreeEnergy
    variable = Fglobal
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1 h2'
    gj_names = 'g1 g2'
    interfacial_vars = 'eta1 eta2'
    kappa_names = 'kappa kappa'
    w = 0.1
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  line_search = none
  petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type -ksp_gmres_restart'
  petsc_options_value = 'asm      lu          nonzero                    30'
  l_max_its = 100
  nl_max_its = 20
  nl_abs_tol = 1e-10
  end_time = 1000
  [TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 12
    iteration_window = 2
    growth_factor = 2
    cutback_factor = 0.5
    dt = 0.1
  []
[]
[Postprocessors]
  [F]
    type = ElementIntegralVariablePostprocessor
    variable = Fglobal
  []
  [cmin]
    type = NodalExtremeValue
    value_type = min
    variable = cCr
  []
  [cmax]
    type = NodalExtremeValue
    value_type = max
    variable = cCr
  []
[]
[Outputs]
  exodus = true
  print_linear_residuals = false
  # exclude lagrange multiplier from output, it can diff more easily
  hide = lambda
[]
(modules/phase_field/test/tests/KKS_system/kks_multiphase.i)
#
# This test is for the 3-phase KKS model
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  nz = 0
  xmin = 0
  xmax = 40
  ymin = 0
  ymax = 40
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[BCs]
  [./Periodic]
    [./all]
      auto_direction = 'x y'
    [../]
  [../]
[]
[AuxVariables]
  [./Energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # order parameter 1
  [./eta1]
    order = FIRST
    family = LAGRANGE
  [../]
  # order parameter 2
  [./eta2]
    order = FIRST
    family = LAGRANGE
  [../]
  # order parameter 3
  [./eta3]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
  # phase concentration 1
  [./c1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.2
  [../]
  # phase concentration 2
  [./c2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  [../]
  # phase concentration 3
  [./c3]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.8
  [../]
  # Lagrange multiplier
  [./lambda]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  [../]
[]
[ICs]
  [./eta1]
    variable = eta1
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.9
    outvalue = 0.1
    int_width = 4
  [../]
  [./eta2]
    variable = eta2
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.1
    outvalue = 0.9
    int_width = 4
  [../]
  [./c]
    variable = c
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.2
    outvalue = 0.5
    int_width = 2
  [../]
[]
[Materials]
  # simple toy free energies
  [./f1]
    type = DerivativeParsedMaterial
    property_name = F1
    coupled_variables = 'c1'
    expression = '20*(c1-0.2)^2'
  [../]
  [./f2]
    type = DerivativeParsedMaterial
    property_name = F2
    coupled_variables = 'c2'
    expression = '20*(c2-0.5)^2'
  [../]
  [./f3]
    type = DerivativeParsedMaterial
    property_name = F3
    coupled_variables = 'c3'
    expression = '20*(c3-0.8)^2'
  [../]
  # Switching functions for each phase
  # h1(eta1, eta2, eta3)
  [./h1]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta1
    eta_j = eta2
    eta_k = eta3
    property_name = h1
  [../]
  # h2(eta1, eta2, eta3)
  [./h2]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta2
    eta_j = eta3
    eta_k = eta1
    property_name = h2
  [../]
  # h3(eta1, eta2, eta3)
  [./h3]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta3
    eta_j = eta1
    eta_k = eta2
    property_name = h3
  [../]
  # Coefficients for diffusion equation
  [./Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1'
    expression = D*h1
    property_name = Dh1
  [../]
  [./Dh2]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2'
    expression = D*h2
    property_name = Dh2
  [../]
  [./Dh3]
    type = DerivativeParsedMaterial
    material_property_names = 'D h3'
    expression = D*h3
    property_name = Dh3
  [../]
  # Barrier functions for each phase
  [./g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  [../]
  [./g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  [../]
  [./g3]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta3
    function_name = g3
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'L   kappa  D'
    prop_values = '0.7 1.0    1'
  [../]
[]
[Kernels]
  #Kernels for diffusion equation
  [./diff_time]
    type = TimeDerivative
    variable = c
  [../]
  [./diff_c1]
    type = MatDiffusion
    variable = c
    diffusivity = Dh1
    v = c1
  [../]
  [./diff_c2]
    type = MatDiffusion
    variable = c
    diffusivity = Dh2
    v = c2
  [../]
  [./diff_c3]
    type = MatDiffusion
    variable = c
    diffusivity = Dh3
    v = c3
  [../]
  # Kernels for Allen-Cahn equation for eta1
  [./deta1dt]
    type = TimeDerivative
    variable = eta1
  [../]
  [./ACBulkF1]
    type = KKSMultiACBulkF
    variable  = eta1
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g1
    eta_i     = eta1
    wi        = 1.0
    coupled_variables      = 'c1 c2 c3 eta2 eta3'
  [../]
  [./ACBulkC1]
    type = KKSMultiACBulkC
    variable  = eta1
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta1
    coupled_variables      = 'eta2 eta3'
  [../]
  [./ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  [../]
  [./multipler1]
    type = MatReaction
    variable = eta1
    v = lambda
    reaction_rate = L
  [../]
  # Kernels for Allen-Cahn equation for eta2
  [./deta2dt]
    type = TimeDerivative
    variable = eta2
  [../]
  [./ACBulkF2]
    type = KKSMultiACBulkF
    variable  = eta2
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g2
    eta_i     = eta2
    wi        = 1.0
    coupled_variables      = 'c1 c2 c3 eta1 eta3'
  [../]
  [./ACBulkC2]
    type = KKSMultiACBulkC
    variable  = eta2
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta2
    coupled_variables      = 'eta1 eta3'
  [../]
  [./ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  [../]
  [./multipler2]
    type = MatReaction
    variable = eta2
    v = lambda
    reaction_rate = L
  [../]
  # Kernels for the Lagrange multiplier equation
  [./mult_lambda]
    type = MatReaction
    variable = lambda
    reaction_rate = 3
  [../]
  [./mult_ACBulkF_1]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g1
    eta_i     = eta1
    wi        = 1.0
    mob_name  = 1
    coupled_variables      = 'c1 c2 c3 eta2 eta3'
  [../]
  [./mult_ACBulkC_1]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta1
    coupled_variables      = 'eta2 eta3'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_1]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta1
    kappa_name = kappa
    mob_name = 1
  [../]
  [./mult_ACBulkF_2]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g2
    eta_i     = eta2
    wi        = 1.0
    mob_name  = 1
    coupled_variables      = 'c1 c2 c3 eta1 eta3'
  [../]
  [./mult_ACBulkC_2]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta2
    coupled_variables      = 'eta1 eta3'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_2]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta2
    kappa_name = kappa
    mob_name = 1
  [../]
  [./mult_ACBulkF_3]
    type = KKSMultiACBulkF
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    gi_name   = g3
    eta_i     = eta3
    wi        = 1.0
    mob_name  = 1
    coupled_variables      = 'c1 c2 c3 eta1 eta2'
  [../]
  [./mult_ACBulkC_3]
    type = KKSMultiACBulkC
    variable  = lambda
    Fj_names  = 'F1 F2 F3'
    hj_names  = 'h1 h2 h3'
    cj_names  = 'c1 c2 c3'
    eta_i     = eta3
    coupled_variables      = 'eta1 eta2'
    mob_name  = 1
  [../]
  [./mult_CoupledACint_3]
    type = SimpleCoupledACInterface
    variable = lambda
    v = eta3
    kappa_name = kappa
    mob_name = 1
  [../]
  # Kernels for constraint equation eta1 + eta2 + eta3 = 1
  # eta3 is the nonlinear variable for the constraint equation
  [./eta3reaction]
    type = MatReaction
    variable = eta3
    reaction_rate = 1
  [../]
  [./eta1reaction]
    type = MatReaction
    variable = eta3
    v = eta1
    reaction_rate = 1
  [../]
  [./eta2reaction]
    type = MatReaction
    variable = eta3
    v = eta2
    reaction_rate = 1
  [../]
  [./one]
    type = BodyForce
    variable = eta3
    value = -1.0
  [../]
  # Phase concentration constraints
  [./chempot12]
    type = KKSPhaseChemicalPotential
    variable = c1
    cb       = c2
    fa_name  = F1
    fb_name  = F2
  [../]
  [./chempot23]
    type = KKSPhaseChemicalPotential
    variable = c2
    cb       = c3
    fa_name  = F2
    fb_name  = F3
  [../]
  [./phaseconcentration]
    type = KKSMultiPhaseConcentration
    variable = c3
    cj = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    etas = 'eta1 eta2 eta3'
    c = c
  [../]
[]
[AuxKernels]
  [./Energy_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 F3'
    hj_names = 'h1 h2 h3'
    gj_names = 'g1 g2 g3'
    variable = Energy
    w = 1
    interfacial_vars =  'eta1  eta2  eta3'
    kappa_names =       'kappa kappa kappa'
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 2
  dt = 0.5
[]
[Preconditioning]
  active = 'full'
  [./full]
    type = SMP
    full = true
  [../]
  [./mydebug]
    type = FDP
    full = true
  [../]
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_multiphase_nested.i)
#
# This test is for the nested solve of 3-phase KKS model
# The split-form of the Cahn-Hilliard equation instead of the Fick's diffusion equation is solved
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  nz = 0
  xmin = 0
  xmax = 40
  ymin = 0
  ymax = 40
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[BCs]
  [Periodic]
    [all]
      auto_direction = 'x y'
    []
  []
[]
[AuxVariables]
  [Energy]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # concentration
  [c]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 1
  [eta1]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 2
  [eta2]
    order = FIRST
    family = LAGRANGE
  []
  # order parameter 3
  [eta3]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
  # chemical potential
  [mu]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
  # Lagrange multiplier
  [lambda]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.0
  []
[]
[ICs]
  [eta1]
    variable = eta1
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.9
    outvalue = 0.1
    int_width = 4
  []
  [eta2]
    variable = eta2
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.1
    outvalue = 0.9
    int_width = 4
  []
  [c]
    variable = c
    type = SmoothCircleIC
    x1 = 20.0
    y1 = 20.0
    radius = 10
    invalue = 0.2
    outvalue = 0.5
    int_width = 2
  []
[]
[Materials]
  # simple toy free energies
  [F1]
    type = DerivativeParsedMaterial
    property_name = F1
    expression = '20*(c1-0.2)^2'
    material_property_names = 'c1'
    additional_derivative_symbols = 'c1'
    compute = false
  []
  [F2]
    type = DerivativeParsedMaterial
    property_name = F2
    expression = '20*(c2-0.5)^2'
    material_property_names = 'c2'
    additional_derivative_symbols = 'c2'
    compute = false
  []
  [F3]
    type = DerivativeParsedMaterial
    property_name = F3
    expression = '20*(c3-0.8)^2'
    material_property_names = 'c3'
    additional_derivative_symbols = 'c3'
    compute = false
  []
  [KKSPhaseConcentrationMultiPhaseMaterial]
    type = KKSPhaseConcentrationMultiPhaseMaterial
    global_cs = 'c'
    all_etas = 'eta1 eta2 eta3'
    hj_names = 'h1 h2 h3'
    ci_names = 'c1 c2 c3'
    ci_IC = '0.2 0.5 0.8'
    Fj_names = 'F1 F2 F3'
    min_iterations = 1
    max_iterations = 1000
    absolute_tolerance = 1e-11
    relative_tolerance = 1e-10
  []
  [KKSPhaseConcentrationMultiPhaseDerivatives]
    type = KKSPhaseConcentrationMultiPhaseDerivatives
    global_cs = 'c'
    all_etas = 'eta1 eta2 eta3'
    Fj_names = 'F1 F2 F3'
    hj_names = 'h1 h2 h3'
    ci_names = 'c1 c2 c3'
  []
  # Switching functions for each phase
  # h1(eta1, eta2, eta3)
  [h1]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta1
    eta_j = eta2
    eta_k = eta3
    property_name = h1
  []
  # h2(eta1, eta2, eta3)
  [h2]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta2
    eta_j = eta3
    eta_k = eta1
    property_name = h2
  []
  # h3(eta1, eta2, eta3)
  [h3]
    type = SwitchingFunction3PhaseMaterial
    eta_i = eta3
    eta_j = eta1
    eta_k = eta2
    property_name = h3
  []
  # Barrier functions for each phase
  [g1]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta1
    function_name = g1
  []
  [g2]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta2
    function_name = g2
  []
  [g3]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta3
    function_name = g3
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'L   kappa  M'
    prop_values = '0.7 1.0    0.025'
  []
[]
[Kernels]
  [lambda_lagrange]
    type = SwitchingFunctionConstraintLagrange
    variable = lambda
    etas = 'eta1 eta2 eta3'
    h_names = 'h1   h2   h3'
    epsilon = 1e-04
  []
  [eta1_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta1
    h_name = h1
    lambda = lambda
    coupled_variables = 'eta2 eta3'
  []
  [eta2_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta2
    h_name = h2
    lambda = lambda
    coupled_variables = 'eta1 eta3'
  []
  [eta3_lagrange]
    type = SwitchingFunctionConstraintEta
    variable = eta3
    h_name = h3
    lambda = lambda
    coupled_variables = 'eta1 eta2'
  []
  #Kernels for Cahn-Hilliard equation
  [diff_time]
    type = CoupledTimeDerivative
    variable = mu
    v = c
  []
  [CHBulk]
    type = NestedKKSMultiSplitCHCRes
    variable = c
    all_etas = 'eta1 eta2 eta3'
    global_cs = 'c'
    w = mu
    c1_names = 'c1'
    F1_name = F1
    coupled_variables = 'eta1 eta2 eta3 mu'
  []
  [ckernel]
    type = SplitCHWRes
    variable = mu
    mob_name = M
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = NestedKKSMultiACBulkF
    variable = eta1
    global_cs = 'c'
    eta_i = eta1
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g1
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta2 eta3'
  []
  [ACBulkC1]
    type = NestedKKSMultiACBulkC
    variable = eta1
    global_cs = 'c'
    eta_i = eta1
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta2 eta3'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  # Kernels for Allen-Cahn equation for eta2
  [deta2dt]
    type = TimeDerivative
    variable = eta2
  []
  [ACBulkF2]
    type = NestedKKSMultiACBulkF
    variable = eta2
    global_cs = 'c'
    eta_i = eta2
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g2
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta1 eta3'
  []
  [ACBulkC2]
    type = NestedKKSMultiACBulkC
    variable = eta2
    global_cs = 'c'
    eta_i = eta2
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta1 eta3'
  []
  [ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  []
  # Kernels for Allen-Cahn equation for eta3
  [deta3dt]
    type = TimeDerivative
    variable = eta3
  []
  [ACBulkF3]
    type = NestedKKSMultiACBulkF
    variable = eta3
    global_cs = 'c'
    eta_i = eta3
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    gi_name = g3
    mob_name = L
    wi = 1.0
    coupled_variables = 'c eta1 eta2'
  []
  [ACBulkC3]
    type = NestedKKSMultiACBulkC
    variable = eta3
    global_cs = 'c'
    eta_i = eta3
    all_etas = 'eta1 eta2 eta3'
    ci_names = 'c1 c2 c3'
    hj_names = 'h1 h2 h3'
    Fj_names = 'F1 F2 F3'
    coupled_variables = 'c eta1 eta2'
  []
  [ACInterface3]
    type = ACInterface
    variable = eta3
    kappa_name = kappa
  []
[]
[AuxKernels]
  [Energy_total]
    type = KKSMultiFreeEnergy
    Fj_names = 'F1 F2 F3'
    hj_names = 'h1 h2 h3'
    gj_names = 'g1 g2 g3'
    variable = Energy
    w = 1
    interfacial_vars = 'eta1  eta2  eta3'
    kappa_names = 'kappa kappa kappa'
  []
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-11
  num_steps = 2
  dt = 0.5
[]
[Preconditioning]
  active = 'full'
  [full]
    type = SMP
    full = true
  []
  [mydebug]
    type = FDP
    full = true
  []
[]
[Outputs]
  file_base = kks_example_multiphase_nested
  exodus = true
[]
(modules/phase_field/test/tests/mobility_derivative/AC_mobility_derivative_coupled_test.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 10
  xmax = 50
  ymin = 25
  ymax = 50
[]
[Variables]
  [./op]
  [../]
  [./v]
  [../]
[]
[ICs]
  [./op_IC]
    type = SmoothCircleIC
    x1 = 25.0
    y1 = 25.0
    radius = 15.0
    invalue = 0.9
    outvalue = 0.1
    int_width = 3.0
    variable = op
  [../]
  [./v_IC]
    type = BoundingBoxIC
    x1 = 0.0
    x2 = 25.0
    y1 = 0.0
    y2 = 50.0
    inside = 1.0
    outside = 0.0
    variable = v
  [../]
[]
[Kernels]
  [./op_dot]
    type = TimeDerivative
    variable = op
  [../]
  [./op_bulk]
    type = AllenCahn
    variable = op
    f_name = F
    mob_name = L
    coupled_variables = v
  [../]
  [./op_interface]
    type = ACInterface
    variable = op
    kappa_name = 1
    mob_name = L
    coupled_variables = v
  [../]
  [./v_dot]
    type = TimeDerivative
    variable = v
  [../]
  [./v_diff]
    type = MatDiffusion
    variable = v
    diffusivity = 50.0
  [../]
[]
[Materials]
  [./consts]
    type = DerivativeParsedMaterial
    property_name  = L
    expression = 'l:=0.1+1*(v+op)^2; if(l<0.01, 0.01, l)'
    coupled_variables = 'op v'
    outputs = exodus
    output_properties = 'L dL/dop dL/dv'
    derivative_order = 2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    property_name = F
    coupled_variables = 'op'
    expression = '2*op^2*(1-op)^2 - 0.2*op'
    derivative_order = 2
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'NEWTON'
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 15
  nl_rel_tol = 1.0e-9
  start_time = 0.0
  num_steps = 10
  dt = 0.2
[]
[Outputs]
  time_step_interval = 5
  print_linear_residuals = false
  exodus = true
[]
(modules/phase_field/examples/slkks/CrFe.i)
#
# SLKKS two phase example for the BCC and SIGMA phases. The sigma phase contains
# multiple sublattices. Free energy from
# Jacob, Aurelie, Erwin Povoden-Karadeniz, and Ernst Kozeschnik. "Revised thermodynamic
# description of the Fe-Cr system based on an improved sublattice model of the sigma phase."
# Calphad 60 (2018): 16-28.
#
# In this simulation we consider diffusion (Cahn-Hilliard) and phase transformation.
#
# This example requires CrFe_sigma_out_var_0001.csv file, which generated by first
# running the CrFe_sigma.i input file.
[Mesh]
  [gen]
    type = GeneratedMeshGenerator
    dim = 2
    nx = 160
    ny = 1
    nz = 0
    xmin = -25
    xmax = 25
    ymin = -2.5
    ymax = 2.5
    elem_type = QUAD4
  []
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Functions]
  [sigma_cr0]
    type = PiecewiseLinear
    data_file = CrFe_sigma_out_var_0001.csv
    format = columns
    x_index_in_file = 5
    y_index_in_file = 2
    xy_in_file_only = false
  []
  [sigma_cr1]
    type = PiecewiseLinear
    data_file = CrFe_sigma_out_var_0001.csv
    format = columns
    x_index_in_file = 5
    y_index_in_file = 3
    xy_in_file_only = false
  []
  [sigma_cr2]
    type = PiecewiseLinear
    data_file = CrFe_sigma_out_var_0001.csv
    format = columns
    x_index_in_file = 5
    y_index_in_file = 4
    xy_in_file_only = false
  []
[]
[Variables]
  # order parameters
  [eta1]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  [eta2]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.5
  []
  # solute concentration
  [cCr]
    order = FIRST
    family = LAGRANGE
    [InitialCondition]
      type = FunctionIC
      function = '(x+25)/50*0.5+0.1'
    []
  []
  # sublattice concentrations
  [BCC_CR]
    initial_condition = 0.45
  []
  [SIGMA_0CR]
    [InitialCondition]
      type = CoupledValueFunctionIC
      function = sigma_cr0
      v = cCr
      variable = SIGMA_0CR
    []
  []
  [SIGMA_1CR]
    [InitialCondition]
      type = CoupledValueFunctionIC
      function = sigma_cr1
      v = cCr
      variable = SIGMA_1CR
    []
  []
  [SIGMA_2CR]
    [InitialCondition]
      type = CoupledValueFunctionIC
      function = sigma_cr2
      v = cCr
      variable = SIGMA_2CR
    []
  []
  # Lagrange multiplier
  [lambda]
  []
[]
[Materials]
  # CALPHAD free energies
  [F_BCC_A2]
    type = DerivativeParsedMaterial
    property_name = F_BCC_A2
    outputs = exodus
    output_properties = F_BCC_A2
    expression = 'BCC_FE:=1-BCC_CR; G := 8.3145*T*(1.0*if(BCC_CR > 1.0e-15,BCC_CR*log(BCC_CR),0) + '
               '1.0*if(BCC_FE > 1.0e-15,BCC_FE*plog(BCC_FE,eps),0) + 3.0*if(BCC_VA > '
               '1.0e-15,BCC_VA*log(BCC_VA),0))/(BCC_CR + BCC_FE) + 8.3145*T*if(T < '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - '
               '1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(0.525599232981783*BCC_CR*BCC_FE*BCC_'
               'VA*(BCC_CR - BCC_FE) - 0.894055608820709*BCC_CR*BCC_FE*BCC_VA + '
               '0.298657718120805*BCC_CR*BCC_VA - BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
               '4.65558036243985e-30*T^9/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
               '1.3485349181899e-10*T^3/(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
               '0.905299382744392*(548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA + '
               '1.0e-9)/T,if(T < -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + '
               '1043.0*BCC_FE*BCC_VA,-8.13674105561218e-49*T^15/(-0.525599232981783*BCC_CR*BCC_FE*BCC'
               '_VA*(BCC_CR - BCC_FE) + 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - '
               '0.298657718120805*BCC_CR*BCC_VA + BCC_FE*BCC_VA + 9.58772770853308e-13)^15 - '
               '4.65558036243985e-30*T^9/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) '
               '+ 0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^9 - '
               '1.3485349181899e-10*T^3/(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^3 + 1 - '
               '0.905299382744392*(-548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA + '
               '1.0e-9)/T,if(T > -548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '932.5*BCC_CR*BCC_FE*BCC_VA - 311.5*BCC_CR*BCC_VA + 1043.0*BCC_FE*BCC_VA & '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA < '
               '0,-79209031311018.7*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
               '3.83095660520737e+42*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
               '1.22565886734485e+72*(-0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) + '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA - 0.298657718120805*BCC_CR*BCC_VA + '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,if(T > '
               '548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + '
               '311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA & 548.2*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - '
               'BCC_FE) - 932.5*BCC_CR*BCC_FE*BCC_VA + 311.5*BCC_CR*BCC_VA - 1043.0*BCC_FE*BCC_VA > '
               '0,-79209031311018.7*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^5/T^5 - '
               '3.83095660520737e+42*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^15/T^15 - '
               '1.22565886734485e+72*(0.525599232981783*BCC_CR*BCC_FE*BCC_VA*(BCC_CR - BCC_FE) - '
               '0.894055608820709*BCC_CR*BCC_FE*BCC_VA + 0.298657718120805*BCC_CR*BCC_VA - '
               'BCC_FE*BCC_VA + 9.58772770853308e-13)^25/T^25,0))))*log((2.15*BCC_CR*BCC_FE*BCC_VA - '
               '0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA)*if(2.15*BCC_CR*BCC_FE*BCC_VA - '
               '0.008*BCC_CR*BCC_VA + 2.22*BCC_FE*BCC_VA <= 0,-1.0,1.0) + 1)/(BCC_CR + BCC_FE) + '
               '1.0*(BCC_CR*BCC_VA*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + '
               'BCC_FE*BCC_VA*if(T >= 298.15 & T < 1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T '
               '- 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < '
               '6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - 25383.581,0)))/(BCC_CR '
               '+ BCC_FE) + 1.0*(BCC_CR*BCC_FE*BCC_VA*(500.0 - 1.5*T)*(BCC_CR - BCC_FE) + '
               'BCC_CR*BCC_FE*BCC_VA*(24600.0 - 14.98*T) + BCC_CR*BCC_FE*BCC_VA*(9.15*T - '
               '14000.0)*(BCC_CR - BCC_FE)^2)/(BCC_CR + BCC_FE); G/100000'
    coupled_variables = 'BCC_CR'
    constant_names = 'BCC_VA T eps'
    constant_expressions = '1 1000 0.01'
  []
  [F_SIGMA]
    type = DerivativeParsedMaterial
    property_name = F_SIGMA
    outputs = exodus
    output_properties = F_SIGMA
    expression = 'SIGMA_0FE := 1-SIGMA_0CR; SIGMA_1FE := 1-SIGMA_1CR; SIGMA_2FE := 1-SIGMA_2CR; G := '
               '8.3145*T*(10.0*if(SIGMA_0CR > 1.0e-15,SIGMA_0CR*plog(SIGMA_0CR,eps),0) + '
               '10.0*if(SIGMA_0FE > 1.0e-15,SIGMA_0FE*plog(SIGMA_0FE,eps),0) + 4.0*if(SIGMA_1CR > '
               '1.0e-15,SIGMA_1CR*plog(SIGMA_1CR,eps),0) + 4.0*if(SIGMA_1FE > '
               '1.0e-15,SIGMA_1FE*plog(SIGMA_1FE,eps),0) + 16.0*if(SIGMA_2CR > '
               '1.0e-15,SIGMA_2CR*plog(SIGMA_2CR,eps),0) + 16.0*if(SIGMA_2FE > '
               '1.0e-15,SIGMA_2FE*plog(SIGMA_2FE,eps),0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + '
               '4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
               '(SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*SIGMA_2FE*(-70.0*T - 170400.0) + '
               'SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*SIGMA_2FE*(-10.0*T - 330839.0))/(10.0*SIGMA_0CR + '
               '10.0*SIGMA_0FE + 4.0*SIGMA_1CR + 4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE) + '
               '(SIGMA_0CR*SIGMA_1CR*SIGMA_2CR*(30.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - '
               '26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= '
               '2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) '
               '+ 132000.0) + SIGMA_0CR*SIGMA_1CR*SIGMA_2FE*(-110.0*T + 16.0*if(T >= 298.15 & T < '
               '1811.0,77358.5*1/T - 23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - '
               '5.89269e-8*T^3.0 + 1225.7,if(T >= 1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - '
               '46.0*T*log(T) + 299.31255*T - 25383.581,0)) + 14.0*if(T >= 298.15 & T < '
               '2180.0,139250.0*1/T - 26.908*T*log(T) + 157.48*T + 0.00189435*T^2.0 - '
               '1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < 6000.0,-2.88526e+32*T^(-9.0) - '
               '50.0*T*log(T) + 344.18*T - 34869.344,0)) + 123500.0) + '
               'SIGMA_0CR*SIGMA_1FE*SIGMA_2CR*(4.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 26.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 140486.0) '
               '+ SIGMA_0CR*SIGMA_1FE*SIGMA_2FE*(20.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 10.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 148800.0) '
               '+ SIGMA_0FE*SIGMA_1CR*SIGMA_2CR*(10.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 20.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 56200.0) + '
               'SIGMA_0FE*SIGMA_1CR*SIGMA_2FE*(26.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 4.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 152700.0) '
               '+ SIGMA_0FE*SIGMA_1FE*SIGMA_2CR*(14.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 16.0*if(T >= 298.15 & T < 2180.0,139250.0*1/T - 26.908*T*log(T) + '
               '157.48*T + 0.00189435*T^2.0 - 1.47721e-6*T^3.0 - 8856.94,if(T >= 2180.0 & T < '
               '6000.0,-2.88526e+32*T^(-9.0) - 50.0*T*log(T) + 344.18*T - 34869.344,0)) + 46200.0) + '
               'SIGMA_0FE*SIGMA_1FE*SIGMA_2FE*(30.0*if(T >= 298.15 & T < 1811.0,77358.5*1/T - '
               '23.5143*T*log(T) + 124.134*T - 0.00439752*T^2.0 - 5.89269e-8*T^3.0 + 1225.7,if(T >= '
               '1811.0 & T < 6000.0,2.2960305e+31*T^(-9.0) - 46.0*T*log(T) + 299.31255*T - '
               '25383.581,0)) + 173333.0))/(10.0*SIGMA_0CR + 10.0*SIGMA_0FE + 4.0*SIGMA_1CR + '
               '4.0*SIGMA_1FE + 16.0*SIGMA_2CR + 16.0*SIGMA_2FE); G/100000'
    coupled_variables = 'SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    constant_names = 'T eps'
    constant_expressions = '1000 0.01'
  []
  # h(eta)
  [h1]
    type = SwitchingFunctionMaterial
    function_name = h1
    h_order = HIGH
    eta = eta1
  []
  [h2]
    type = SwitchingFunctionMaterial
    function_name = h2
    h_order = HIGH
    eta = eta2
  []
  # g(eta)
  [g1]
    type = BarrierFunctionMaterial
    function_name = g1
    g_order = SIMPLE
    eta = eta1
  []
  [g2]
    type = BarrierFunctionMaterial
    function_name = g2
    g_order = SIMPLE
    eta = eta2
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'D   L   kappa'
    prop_values = '10  1   0.1  '
  []
  # Coefficients for diffusion equation
  [Dh1]
    type = DerivativeParsedMaterial
    material_property_names = 'D h1(eta1)'
    expression = D*h1
    property_name = Dh1
    coupled_variables = eta1
    derivative_order = 1
  []
  [Dh2a]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*10/30
    property_name = Dh2a
    coupled_variables = eta2
    derivative_order = 1
  []
  [Dh2b]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*4/30
    property_name = Dh2b
    coupled_variables = eta2
    derivative_order = 1
  []
  [Dh2c]
    type = DerivativeParsedMaterial
    material_property_names = 'D h2(eta2)'
    expression = D*h2*16/30
    property_name = Dh2c
    coupled_variables = eta2
    derivative_order = 1
  []
[]
[Kernels]
  #Kernels for diffusion equation
  [diff_time]
    type = TimeDerivative
    variable = cCr
  []
  [diff_c1]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh1
    v = BCC_CR
    args = eta1
  []
  [diff_c2a]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2a
    v = SIGMA_0CR
    args = eta2
  []
  [diff_c2b]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2b
    v = SIGMA_1CR
    args = eta2
  []
  [diff_c2c]
    type = MatDiffusion
    variable = cCr
    diffusivity = Dh2c
    v = SIGMA_2CR
    args = eta2
  []
  # enforce pointwise equality of chemical potentials
  [chempot1a2a]
    # The BCC phase has only one sublattice
    # we tie it to the first sublattice with site fraction 10/(10+4+16) in the sigma phase
    type = KKSPhaseChemicalPotential
    variable = BCC_CR
    cb = SIGMA_0CR
    kb = '${fparse 10/30}'
    fa_name = F_BCC_A2
    fb_name = F_SIGMA
    args_b = 'SIGMA_1CR SIGMA_2CR'
  []
  [chempot2a2b]
    # This kernel ties the first two sublattices in the sigma phase together
    type = SLKKSChemicalPotential
    variable = SIGMA_0CR
    a = 10
    cs = SIGMA_1CR
    as = 4
    F = F_SIGMA
    coupled_variables = 'SIGMA_2CR'
  []
  [chempot2b2c]
    # This kernel ties the remaining two sublattices in the sigma phase together
    type = SLKKSChemicalPotential
    variable = SIGMA_1CR
    a = 4
    cs = SIGMA_2CR
    as = 16
    F = F_SIGMA
    coupled_variables = 'SIGMA_0CR'
  []
  [phaseconcentration]
    # This kernel ties the sum of the sublattice concentrations to the global concentration cCr
    type = SLKKSMultiPhaseConcentration
    variable = SIGMA_2CR
    c = cCr
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta1dt]
    type = TimeDerivative
    variable = eta1
  []
  [ACBulkF1]
    type = KKSMultiACBulkF
    variable = eta1
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1    h2'
    gi_name = g1
    eta_i = eta1
    wi = 0.1
    coupled_variables = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR eta2'
  []
  [ACBulkC1]
    type = SLKKSMultiACBulkC
    variable = eta1
    F = F_BCC_A2
    c = BCC_CR
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  [ACInterface1]
    type = ACInterface
    variable = eta1
    kappa_name = kappa
  []
  [lagrange1]
    type = SwitchingFunctionConstraintEta
    variable = eta1
    h_name = h1
    lambda = lambda
    coupled_variables = 'eta2'
  []
  # Kernels for Allen-Cahn equation for eta1
  [deta2dt]
    type = TimeDerivative
    variable = eta2
  []
  [ACBulkF2]
    type = KKSMultiACBulkF
    variable = eta2
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1    h2'
    gi_name = g2
    eta_i = eta2
    wi = 0.1
    coupled_variables = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR eta1'
  []
  [ACBulkC2]
    type = SLKKSMultiACBulkC
    variable = eta2
    F = F_BCC_A2
    c = BCC_CR
    ns = '1      3'
    as = '1      10        4         16'
    cs = 'BCC_CR SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    h_names = 'h1   h2'
    eta = 'eta1 eta2'
  []
  [ACInterface2]
    type = ACInterface
    variable = eta2
    kappa_name = kappa
  []
  [lagrange2]
    type = SwitchingFunctionConstraintEta
    variable = eta2
    h_name = h2
    lambda = lambda
    coupled_variables = 'eta1'
  []
  # Lagrange-multiplier constraint kernel for lambda
  [lagrange]
    type = SwitchingFunctionConstraintLagrange
    variable = lambda
    h_names = 'h1   h2'
    etas = 'eta1 eta2'
    epsilon = 1e-6
  []
[]
[AuxKernels]
  [GlobalFreeEnergy]
    type = KKSMultiFreeEnergy
    variable = Fglobal
    Fj_names = 'F_BCC_A2 F_SIGMA'
    hj_names = 'h1 h2'
    gj_names = 'g1 g2'
    interfacial_vars = 'eta1 eta2'
    kappa_names = 'kappa kappa'
    w = 0.1
  []
[]
[Executioner]
  type = Transient
  solve_type = 'NEWTON'
  line_search = none
  petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type -ksp_gmres_restart'
  petsc_options_value = 'asm      lu          nonzero                    30'
  l_max_its = 100
  nl_max_its = 20
  nl_abs_tol = 1e-10
  end_time = 10000
  [TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 12
    iteration_window = 2
    growth_factor = 1.5
    cutback_factor = 0.7
    dt = 0.1
  []
[]
[VectorPostprocessors]
  [var]
    type = LineValueSampler
    start_point = '-25 0 0'
    end_point = '25 0 0'
    variable = 'cCr eta1 eta2 SIGMA_0CR SIGMA_1CR SIGMA_2CR'
    num_points = 151
    sort_by = id
    execute_on = 'initial timestep_end'
  []
  [mat]
    type = LineMaterialRealSampler
    start = '-25 0 0'
    end = '25 0 0'
    property = 'F_BCC_A2 F_SIGMA'
    sort_by = id
    execute_on = 'initial timestep_end'
  []
[]
[Postprocessors]
  [F]
    type = ElementIntegralVariablePostprocessor
    variable = Fglobal
    execute_on = 'initial timestep_end'
  []
  [cmin]
    type = NodalExtremeValue
    value_type = min
    variable = cCr
    execute_on = 'initial timestep_end'
  []
  [cmax]
    type = NodalExtremeValue
    value_type = max
    variable = cCr
    execute_on = 'initial timestep_end'
  []
  [ctotal]
    type = ElementIntegralVariablePostprocessor
    variable = cCr
    execute_on = 'initial timestep_end'
  []
[]
[Outputs]
  exodus = true
  print_linear_residuals = false
  csv = true
  perf_graph = true
[]
(modules/phase_field/test/tests/rigidbodymotion/update_orientation.i)
# test file for applyting advection term and observing rigid body motion of grains
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 25
  ny = 15
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./eta_dot]
    type = TimeDerivative
    variable = eta
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '5.0  2.0      0.1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  [../]
[]
[AuxVariables]
  [./unique_grains]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./var_indices]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./centroids]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadv_x]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./vadv_y]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./angle_initial]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./euler_angle]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./unique_grains]
    type = FeatureFloodCountAux
    variable = unique_grains
    flood_counter = grain_center
    field_display = UNIQUE_REGION
    execute_on = timestep_begin
  [../]
  [./var_indices]
    type = FeatureFloodCountAux
    variable = var_indices
    flood_counter = grain_center
    field_display = VARIABLE_COLORING
    execute_on = timestep_begin
  [../]
  [./centroids]
    type = FeatureFloodCountAux
    variable = centroids
    execute_on = timestep_begin
    field_display = CENTROID
    flood_counter = grain_center
  [../]
  [./vadv_x]
    type = GrainAdvectionAux
    grain_force = grain_force
    grain_volumes = grain_volumes
    grain_tracker_object = grain_center
    execute_on = timestep_begin
    component = x
    variable = vadv_x
  [../]
  [./vadv_y]
    type = GrainAdvectionAux
    grain_force = grain_force
    grain_volumes = grain_volumes
    grain_tracker_object = grain_center
    execute_on = timestep_begin
    component = y
    variable = vadv_y
  [../]
  [./angle_initial]
    type = OutputEulerAngles
    variable = angle_initial
    euler_angle_provider = euler_angle_initial
    grain_tracker = grain_center
    output_euler_angle = phi2
    execute_on = timestep_begin
  [../]
  [./angle]
    type = OutputEulerAngles
    variable = euler_angle
    euler_angle_provider = euler_angle
    grain_tracker = grain_center
    output_euler_angle = phi2
    execute_on = timestep_begin
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = GrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ConstantGrainForceAndTorque
    execute_on = 'initial timestep_begin linear nonlinear'
    force = '0.5 0.0 0.0 '
    torque = '0.0 0.0 10.0'
  [../]
  [./euler_angle_initial]
    type = RandomEulerAngleProvider
    grain_tracker_object = grain_center
    execute_on = 'initial timestep_begin'
  [../]
  [./euler_angle]
    type = EulerAngleUpdater
    grain_tracker_object = grain_center
    euler_angle_provider = euler_angle_initial
    grain_torques_object = grain_force
    grain_volumes = grain_volumes
    execute_on = timestep_begin
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  nl_max_its = 30
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  dt = 0.2
  num_steps = 5
[]
[Outputs]
  exodus = true
[]
[ICs]
  [./rect_c]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  [../]
  [./rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    type = BoundingBoxIC
  [../]
[]
(modules/combined/examples/phase_field-mechanics/kks_mechanics_VTS.i)
# KKS phase-field model coupled with elasticity using the Voigt-Taylor scheme as
# described in L.K. Aagesen et al., Computational Materials Science, 140, 10-21 (2017)
# Original run #170329e
[Mesh]
  type = GeneratedMesh
  dim = 3
  nx = 640
  ny = 1
  nz = 1
  xmin = -10
  xmax = 10
  ymin = 0
  ymax = 0.03125
  zmin = 0
  zmax = 0.03125
  elem_type = HEX8
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute phase concentration (matrix)
  [./cm]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute phase concentration (precipitate)
  [./cp]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_x]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_y]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_z]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[ICs]
  [./eta_ic]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
    block = 0
  [../]
  [./c_ic]
    variable = c
    type = FunctionIC
    function = ic_func_c
    block = 0
  [../]
  [./w_ic]
    variable = w
    type = ConstantIC
    value = 0.00991
    block = 0
  [../]
  [./cm_ic]
    variable = cm
    type = ConstantIC
    value = 0.131
    block = 0
  [../]
  [./cp_ic]
    variable = cp
    type = ConstantIC
    value = 0.236
    block = 0
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = '0.5*(1.0+tanh((x)/delta_eta/sqrt(2.0)))'
    symbol_names = 'delta_eta'
    symbol_values = '0.8034'
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = '0.2388*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^3*(6*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^2-15*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))+10)+0.1338*(1-(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^3*(6*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))^2-15*(0.5*(1.0+tanh(x/delta/sqrt(2.0))))+10))'
    symbol_names = 'delta'
    symbol_values = '0.8034'
  [../]
  [./psi_eq_int]
    type = ParsedFunction
    expression = 'volume*psi_alpha'
    symbol_names = 'volume psi_alpha'
    symbol_values = 'volume psi_alpha'
  [../]
  [./gamma]
    type = ParsedFunction
    expression = '(psi_int - psi_eq_int) / dy / dz'
    symbol_names = 'psi_int psi_eq_int dy       dz'
    symbol_values = 'psi_int psi_eq_int 0.03125  0.03125'
  [../]
[]
[AuxVariables]
  [./sigma11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./sigma22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./sigma33]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e12]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e33]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el11]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el12]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./e_el22]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./f_el]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./eigen_strain00]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./psi]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[AuxKernels]
  [./matl_sigma11]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 0
    index_j = 0
    variable = sigma11
  [../]
  [./matl_sigma22]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 1
    index_j = 1
    variable = sigma22
  [../]
  [./matl_sigma33]
    type = RankTwoAux
    rank_two_tensor = stress
    index_i = 2
    index_j = 2
    variable = sigma33
  [../]
  [./matl_e11]
    type = RankTwoAux
    rank_two_tensor = total_strain
    index_i = 0
    index_j = 0
    variable = e11
  [../]
  [./matl_e12]
    type = RankTwoAux
    rank_two_tensor = total_strain
    index_i = 0
    index_j = 1
    variable = e12
  [../]
  [./matl_e22]
    type = RankTwoAux
    rank_two_tensor = total_strain
    index_i = 1
    index_j = 1
    variable = e22
  [../]
  [./matl_e33]
    type = RankTwoAux
    rank_two_tensor = total_strain
    index_i = 2
    index_j = 2
    variable = e33
  [../]
  [./f_el]
    type = MaterialRealAux
    variable = f_el
    property = f_el_mat
    execute_on = timestep_end
  [../]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fp
    w = 0.0264
    kappa_names = kappa
    interfacial_vars = eta
  [../]
  [./psi_potential]
    variable = psi
    type = ParsedAux
    coupled_variables = 'Fglobal w c f_el sigma11 e11'
    expression = 'Fglobal - w*c + f_el - sigma11*e11'
  [../]
[]
[BCs]
  [./left_x]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  [../]
  [./right_x]
    type = DirichletBC
    variable = disp_x
    boundary = right
    value = 0
  [../]
  [./front_y]
    type = DirichletBC
    variable = disp_y
    boundary = front
    value = 0
  [../]
  [./back_y]
    type = DirichletBC
    variable = disp_y
    boundary = back
    value = 0
  [../]
  [./top_z]
    type = DirichletBC
    variable = disp_z
    boundary = top
    value = 0
  [../]
  [./bottom_z]
    type = DirichletBC
    variable = disp_z
    boundary = bottom
    value = 0
  [../]
[]
[Materials]
  # Chemical free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '6.55*(cm-0.13)^2'
  [../]
# Elastic energy of the matrix
  [./elastic_free_energy_m]
    type = ElasticEnergyMaterial
    base_name = matrix
    f_name = fe_m
    coupled_variables = ' '
    outputs = exodus
  [../]
# Total free energy of the matrix
  [./Total_energy_matrix]
    type = DerivativeSumMaterial
    property_name = f_total_matrix
    sum_materials = 'fm fe_m'
    coupled_variables = 'cm'
  [../]
  # Free energy of the precipitate phase
  [./fp]
    type = DerivativeParsedMaterial
    property_name = fp
    coupled_variables = 'cp'
    expression = '6.55*(cp-0.235)^2'
  [../]
# Elastic energy of the precipitate
  [./elastic_free_energy_p]
    type = ElasticEnergyMaterial
    base_name = ppt
    f_name = fe_p
    coupled_variables = ' '
    outputs = exodus
  [../]
# Total free energy of the precipitate
  [./Total_energy_ppt]
    type = DerivativeSumMaterial
    property_name = f_total_ppt
    sum_materials = 'fp fe_p'
    coupled_variables = 'cp'
  [../]
  # Total elastic energy
    [./Total_elastic_energy]
      type = DerivativeTwoPhaseMaterial
      eta = eta
      f_name = f_el_mat
      fa_name = fe_m
      fb_name = fe_p
      outputs = exodus
      W = 0
    [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa     misfit'
    prop_values = '0.7 0.7 0.01704   0.00377'
  [../]
  #Mechanical properties
  [./Stiffness_matrix]
    type = ComputeElasticityTensor
    C_ijkl = '103.3 74.25 74.25 103.3 74.25 103.3 46.75 46.75 46.75'
    base_name = matrix
    fill_method = symmetric9
  [../]
  [./Stiffness_ppt]
    type = ComputeElasticityTensor
    C_ijkl = '100.7 71.45 71.45 100.7 71.45 100.7 50.10 50.10 50.10'
    base_name = ppt
    fill_method = symmetric9
  [../]
  [./stress_matrix]
    type = ComputeLinearElasticStress
    base_name = matrix
  [../]
  [./stress_ppt]
    type = ComputeLinearElasticStress
    base_name = ppt
  [../]
  [./strain_matrix]
    type = ComputeSmallStrain
    displacements = 'disp_x disp_y disp_z'
    base_name = matrix
  [../]
  [./strain_ppt]
    type = ComputeSmallStrain
    displacements = 'disp_x disp_y disp_z'
    base_name = ppt
    eigenstrain_names = 'eigenstrain_ppt'
  [../]
  [./eigen_strain]
    type = ComputeEigenstrain
    base_name = ppt
    eigen_base = '1 1 1 0 0 0'
    prefactor = misfit
    eigenstrain_name = 'eigenstrain_ppt'
  [../]
  [./global_stress]
    type = TwoPhaseStressMaterial
    base_A = matrix
    base_B = ppt
  [../]
  [./global_strain]
    type = ComputeSmallStrain
    displacements = 'disp_x disp_y disp_z'
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y disp_z'
  [../]
  # enforce c = (1-h(eta))*cm + h(eta)*cp
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cm
    variable = cp
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb       = cp
    fa_name  = f_total_matrix
    fb_name  = f_total_ppt
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cm
    fa_name  = f_total_matrix
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = f_total_matrix
    fb_name  = f_total_ppt
    w        = 0.0264
    coupled_variables = 'cp cm'
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cm
    cb       = cp
    fa_name  = f_total_matrix
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       ilu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-11
  num_steps = 200
  [./TimeStepper]
    type = SolutionTimeAdaptiveDT
    dt = 0.5
  [../]
[]
[VectorPostprocessors]
  #[./eta]
  #  type =  LineValueSampler
  #  start_point = '-10 0 0'
  #  end_point = '10 0 0'
  #  variable = eta
  #  num_points = 321
  #  sort_by =  id
  #[../]
  #[./eta_position]
  #  type = FindValueOnLineSample
  #  vectorpostprocessor = eta
  #  variable_name = eta
  #  search_value = 0.5
  #[../]
#  [./f_el]
#    type =  LineMaterialRealSampler
#    start = '-20 0 0'
#    end   = '20 0 0'
#    sort_by = id
#    property = f_el
#  [../]
#  [./f_el_a]
#    type =  LineMaterialRealSampler
#    start = '-20 0 0'
#    end   = '20 0 0'
#    sort_by = id
#    property = fe_m
#  [../]
#  [./f_el_b]
#    type =  LineMaterialRealSampler
#    start = '-20 0 0'
#    end   = '20 0 0'
#    sort_by = id
#    property = fe_p
#  [../]
#  [./h_out]
#    type =  LineMaterialRealSampler
#    start = '-20 0 0'
#    end   = '20 0 0'
#    sort_by = id
#    property = h
#  [../]
#  [./fm_out]
#    type =  LineMaterialRealSampler
#    start = '-20 0 0'
#    end   = '20 0 0'
#    sort_by = id
#    property = fm
#  [../]
[]
[Postprocessors]
  [./f_el_int]
    type = ElementIntegralMaterialProperty
    mat_prop = f_el_mat
  [../]
  [./c_alpha]
    type =  SideAverageValue
    boundary = left
    variable = c
  [../]
  [./c_beta]
    type =  SideAverageValue
    boundary = right
    variable = c
  [../]
  [./e11_alpha]
    type =  SideAverageValue
    boundary = left
    variable = e11
  [../]
  [./e11_beta]
    type =  SideAverageValue
    boundary = right
    variable = e11
  [../]
  [./s11_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma11
  [../]
  [./s22_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma22
  [../]
  [./s33_alpha]
    type =  SideAverageValue
    boundary = left
    variable = sigma33
  [../]
  [./s11_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma11
  [../]
  [./s22_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma22
  [../]
  [./s33_beta]
    type =  SideAverageValue
    boundary = right
    variable = sigma33
  [../]
  [./f_el_alpha]
    type =  SideAverageValue
    boundary = left
    variable = f_el
  [../]
  [./f_el_beta]
    type =  SideAverageValue
    boundary = right
    variable = f_el
  [../]
  [./f_c_alpha]
    type =  SideAverageValue
    boundary = left
    variable = Fglobal
  [../]
  [./f_c_beta]
    type =  SideAverageValue
    boundary = right
    variable = Fglobal
  [../]
  [./chem_pot_alpha]
    type =  SideAverageValue
    boundary = left
    variable = w
  [../]
  [./chem_pot_beta]
    type =  SideAverageValue
    boundary = right
    variable = w
  [../]
  [./psi_alpha]
    type =  SideAverageValue
    boundary = left
    variable = psi
  [../]
  [./psi_beta]
    type =  SideAverageValue
    boundary = right
    variable = psi
  [../]
  [./total_energy]
    type = ElementIntegralVariablePostprocessor
    variable = Fglobal
  [../]
  # Get simulation cell size from postprocessor
  [./volume]
    type = ElementIntegralMaterialProperty
    mat_prop = 1
  [../]
  [./psi_eq_int]
    type = FunctionValuePostprocessor
    function = psi_eq_int
  [../]
  [./psi_int]
    type = ElementIntegralVariablePostprocessor
    variable = psi
  [../]
  [./gamma]
    type = FunctionValuePostprocessor
    function = gamma
  [../]
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Outputs]
  [./exodus]
    type = Exodus
    time_step_interval = 20
  [../]
  [./csv]
    type = CSV
    execute_on = 'final'
  [../]
#[./console]
#    type = Console
#    output_file = true
#  [../]
[]
(modules/phase_field/test/tests/KKS_system/kks_example.i)
#
# KKS toy problem in the non-split form
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 5
  ny = 5
  nz = 0
  xmin = -0.5
  xmax = 0.5
  ymin = -0.5
  ymax = 0.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  # order parameter
  [eta]
    order = THIRD
    family = HERMITE
  []
  # hydrogen concentration
  [c]
    order = THIRD
    family = HERMITE
  []
  # hydrogen phase concentration (matrix)
  [cm]
    order = THIRD
    family = HERMITE
    initial_condition = 0.0
  []
  # hydrogen phase concentration (delta phase)
  [cd]
    order = THIRD
    family = HERMITE
    initial_condition = 0.0
  []
[]
[ICs]
  [eta]
    variable = eta
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 0.2
    invalue = 0.2
    outvalue = 0.1
    int_width = 0.05
  []
  [c]
    variable = c
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 0.2
    invalue = 0.6
    outvalue = 0.4
    int_width = 0.05
  []
[]
[BCs]
  [Periodic]
    [all]
      variable = 'eta c cm cd'
      auto_direction = 'x y'
    []
  []
[]
[Materials]
  # Free energy of the matrix
  [fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '(0.1-cm)^2'
    outputs = oversampling
  []
  # Free energy of the delta phase
  [fd]
    type = DerivativeParsedMaterial
    property_name = fd
    coupled_variables = 'cd'
    expression = '(0.9-cd)^2'
    outputs = oversampling
  []
  # h(eta)
  [h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
    outputs = oversampling
  []
  # g(eta)
  [g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
    outputs = oversampling
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'L   '
    prop_values = '0.7 '
  []
[]
[Kernels]
  # enforce c = (1-h(eta))*cm + h(eta)*cd
  [PhaseConc]
    type = KKSPhaseConcentration
    ca = cm
    variable = cd
    c = c
    eta = eta
  []
  # enforce pointwise equality of chemical potentials
  [ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb = cd
    fa_name = fm
    fb_name = fd
  []
  #
  # Cahn-Hilliard Equation
  #
  [CHBulk]
    type = KKSCHBulk
    variable = c
    ca = cm
    cb = cd
    fa_name = fm
    fb_name = fd
    mob_name = 0.7
  []
  [dcdt]
    type = TimeDerivative
    variable = c
  []
  #
  # Allen-Cahn Equation
  #
  [ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name = fm
    fb_name = fd
    coupled_variables = 'cm cd'
    w = 0.4
  []
  [ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca = cm
    cb = cd
    fa_name = fm
  []
  [ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = 0.4
  []
  [detadt]
    type = TimeDerivative
    variable = eta
  []
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type'
  petsc_options_value = ' asm    lu          nonzero'
  l_max_its = 100
  nl_max_its = 100
  nl_rel_tol = 1e-4
  num_steps = 1
  dt = 0.01
  dtmin = 0.01
[]
[Preconditioning]
  [mydebug]
    type = SMP
    full = true
  []
[]
[Outputs]
  file_base = kks_example
  [oversampling]
    type = Exodus
    refinements = 3
    # To keep the same test results as before #30318 sampled output rework
    hide = 'd^2fd/dcd^2 d^2fm/dcm^2 d^2g/deta^2 d^2h/deta^2 dfd/dcd dfm/dcm dg/deta dh/deta fd fm g h'
  []
[]
(modules/phase_field/examples/multiphase/GrandPotential3Phase_masscons.i)
# This is an example of implementation of the multi-phase, multi-order parameter
# grand potential based phase-field model described in Phys. Rev. E, 98, 023309
# (2018). It includes 3 phases with 1 grain of each phase.
# This is a revised version of the model that eliminates small variations in mass
# that have been observed with the original formulation. In this version, rather
# than evolving the chemical potential as a field variable, we evolve the composition
# field using a normal Cahn-Hilliard equation, then relate chemical potential to
# composition using Eq. (22) from the paper (this relationship is derived from the
# grand potential functional and is valid only for parabolic free energies).
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 60
  ny = 60
  xmin = -15
  xmax = 15
  ymin = -15
  ymax = 15
[]
[Variables]
  [w]
  []
  [c]
  []
  [etaa0]
  []
  [etab0]
  []
  [etad0]
  []
[]
[ICs]
  [IC_etaa0]
    type = BoundingBoxIC
    variable = etaa0
    x1 = -10
    y1 = -10
    x2 = 10
    y2 = 10
    inside = 1.0
    outside = 0.0
  []
  [IC_etad0]
    type = BoundingBoxIC
    variable = etad0
    x1 = -10
    y1 = -10
    x2 = 10
    y2 = 10
    inside = 0.0
    outside = 1.0
  []
  [IC_c]
    type = BoundingBoxIC
    variable = c
    x1 = -10
    y1 = -10
    x2 = 10
    y2 = 10
    inside = 0.1
    outside = 0.5
  []
  [IC_w]
    type = FunctionIC
    variable = w
    function = ic_func_w
  []
[]
[Functions]
  [ic_func_w]
    type = ConstantFunction
    value = 0
  []
[]
[Kernels]
  # Order parameter eta_alpha0
  [ACa0_bulk]
    type = ACGrGrMulti
    variable = etaa0
    v = 'etab0 etad0'
    gamma_names = 'gab   gad'
  []
  [ACa0_sw]
    type = ACSwitching
    variable = etaa0
    Fj_names = 'omegaa omegab omegad'
    hj_names = 'ha     hb     hd'
    coupled_variables = 'etab0 etad0 w'
  []
  [ACa0_int]
    type = ACInterface
    variable = etaa0
    kappa_name = kappa
  []
  [ea0_dot]
    type = TimeDerivative
    variable = etaa0
  []
  # Order parameter eta_beta0
  [ACb0_bulk]
    type = ACGrGrMulti
    variable = etab0
    v = 'etaa0 etad0'
    gamma_names = 'gab   gbd'
  []
  [ACb0_sw]
    type = ACSwitching
    variable = etab0
    Fj_names = 'omegaa omegab omegad'
    hj_names = 'ha     hb     hd'
    coupled_variables = 'etaa0 etad0 w'
  []
  [ACb0_int]
    type = ACInterface
    variable = etab0
    kappa_name = kappa
  []
  [eb0_dot]
    type = TimeDerivative
    variable = etab0
  []
  # Order parameter eta_delta0
  [ACd0_bulk]
    type = ACGrGrMulti
    variable = etad0
    v = 'etaa0 etab0'
    gamma_names = 'gad   gbd'
  []
  [ACd0_sw]
    type = ACSwitching
    variable = etad0
    Fj_names = 'omegaa omegab omegad'
    hj_names = 'ha     hb     hd'
    coupled_variables = 'etaa0 etab0 w'
  []
  [ACd0_int]
    type = ACInterface
    variable = etad0
    kappa_name = kappa
  []
  [ed0_dot]
    type = TimeDerivative
    variable = etad0
  []
  #Concentration
  [c_dot]
    type = TimeDerivative
    variable = c
  []
  [Diffusion]
    type = MatDiffusion
    variable = c
    v = w
    diffusivity = DchiVm
    args = ''
  []
  #The following relate chemical potential to composition using Eq. (22)
  [w_rxn]
    type = MatReaction
    variable = w
    v = c
    reaction_rate = -1
  []
  [ca_rxn]
    type = MatReaction
    variable = w
    reaction_rate = 'hoverk_a'
    args = 'etaa0 etab0 etad0'
  []
  [ca_bodyforce]
    type = MaskedBodyForce
    variable = w
    mask = ha
    coupled_variables = 'etaa0 etab0 etad0'
    value = 0.1 #caeq
  []
  [cb_rxn]
    type = MatReaction
    variable = w
    reaction_rate = 'hoverk_b'
    args = 'etaa0 etab0 etad0'
  []
  [cb_bodyforce]
    type = MaskedBodyForce
    variable = w
    mask = hb
    coupled_variables = 'etaa0 etab0 etad0'
    value = 0.9 #cbeq
  []
  [cd_rxn]
    type = MatReaction
    variable = w
    reaction_rate = 'hoverk_d'
    args = 'etaa0 etab0 etad0'
  []
  [cd_bodyforce]
    type = MaskedBodyForce
    variable = w
    mask = hd
    coupled_variables = 'etaa0 etab0 etad0'
    value = 0.5 #cdeq
  []
[]
[Materials]
  [ha_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = ha
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etaa0'
  []
  [hb_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hb
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etab0'
  []
  [hd_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hd
    all_etas = 'etaa0 etab0 etad0'
    phase_etas = 'etad0'
  []
  [omegaa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegaa
    material_property_names = 'Vm ka caeq'
    expression = '-0.5*w^2/Vm^2/ka-w/Vm*caeq'
    derivative_order = 2
  []
  [omegab]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegab
    material_property_names = 'Vm kb cbeq'
    expression = '-0.5*w^2/Vm^2/kb-w/Vm*cbeq'
    derivative_order = 2
  []
  [omegad]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = omegad
    material_property_names = 'Vm kd cdeq'
    expression = '-0.5*w^2/Vm^2/kd-w/Vm*cdeq'
    derivative_order = 2
  []
  [rhoa]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhoa
    material_property_names = 'Vm ka caeq'
    expression = 'w/Vm^2/ka + caeq/Vm'
    derivative_order = 2
  []
  [rhob]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhob
    material_property_names = 'Vm kb cbeq'
    expression = 'w/Vm^2/kb + cbeq/Vm'
    derivative_order = 2
  []
  [rhod]
    type = DerivativeParsedMaterial
    coupled_variables = 'w'
    property_name = rhod
    material_property_names = 'Vm kd cdeq'
    expression = 'w/Vm^2/kd + cdeq/Vm'
    derivative_order = 2
  []
  [const]
    type = GenericConstantMaterial
    prop_names = 'kappa_c  kappa   L   D    Vm   ka    caeq kb    cbeq  kd    cdeq  gab gad gbd  mu  tgrad_corr_mult'
    prop_values = '0        1       1.0 1.0  1.0  10.0  0.1  10.0  0.9   10.0  0.5   1.5 1.5 1.5  1.0 0.0'
  []
  [Mobility]
    type = DerivativeParsedMaterial
    property_name = DchiVm
    material_property_names = 'D chi Vm' #Factor of Vm is needed to evolve c instead of rho
    expression = 'D*chi*Vm'
    derivative_order = 2
  []
  [chi]
    type = DerivativeParsedMaterial
    property_name = chi
    material_property_names = 'Vm ha(etaa0,etab0,etad0) ka hb(etaa0,etab0,etad0) kb hd(etaa0,etab0,etad0) kd'
    expression = '(ha/ka + hb/kb + hd/kd) / Vm^2'
    coupled_variables = 'etaa0 etab0 etad0'
    derivative_order = 2
  []
  [hoverk_a]
    type = DerivativeParsedMaterial
    material_property_names = 'ha(etaa0,etab0,etad0) Vm ka'
    property_name = hoverk_a
    expression = 'ha / Vm / ka'
  []
  [hoverk_b]
    type = DerivativeParsedMaterial
    material_property_names = 'hb(etaa0,etab0,etad0) Vm kb'
    property_name = hoverk_b
    expression = 'hb / Vm / kb'
  []
  [hoverk_d]
    type = DerivativeParsedMaterial
    material_property_names = 'hd(etaa0,etab0,etad0) Vm kd'
    property_name = hoverk_d
    expression = 'hd / Vm / kd'
  []
[]
[Postprocessors]
  [c_total]
    type = ElementIntegralVariablePostprocessor
    variable = c
  []
[]
[Executioner]
  type = Transient
  nl_max_its = 15
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = -pc_type
  petsc_options_value = asm
  l_max_its = 15
  l_tol = 1.0e-3
  nl_rel_tol = 1.0e-8
  start_time = 0.0
  num_steps = 20
  nl_abs_tol = 1e-10
  dt = 1.0
[]
[Outputs]
  csv = true
  exodus = true
[]
(modules/phase_field/test/tests/free_energy_material/CoupledValueFunctionFreeEnergy.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 10
  nz = 0
  xmin = 0
  xmax = 500
  ymin = 0
  ymax = 500
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[GlobalParams]
  op_num = 4
  var_name_base = gr
[]
[Variables]
  [PolycrystalVariables]
  []
[]
[Functions]
  [grain_growth_energy]
    type = PiecewiseMultilinear
    data_file = grain_growth_energy.data
  []
  [grain_growth_mu0]
    type = PiecewiseMultilinear
    data_file = grain_growth_mu0.data
  []
  [grain_growth_mu1]
    type = PiecewiseMultilinear
    data_file = grain_growth_mu1.data
  []
  [grain_growth_mu2]
    type = PiecewiseMultilinear
    data_file = grain_growth_mu2.data
  []
  [grain_growth_mu3]
    type = PiecewiseMultilinear
    data_file = grain_growth_mu3.data
  []
  [matrix]
    type = ParsedFunction
    expression = '1-x-y-z'
  []
[]
[ICs]
  [gr1]
    type = SmoothCircleIC
    variable = gr1
    x1 = 0
    y1 = 0
    radius = 150
    int_width = 90
    invalue = 1
    outvalue = 0
  []
  [gr2]
    type = SmoothCircleIC
    variable = gr2
    x1 = 500
    y1 = 0
    radius = 120
    int_width = 90
    invalue = 1
    outvalue = 0
  []
  [gr3]
    type = SmoothCircleIC
    variable = gr3
    x1 = 250
    y1 = 500
    radius = 300
    int_width = 90
    invalue = 1
    outvalue = 0
  []
  [gr0]
    type = CoupledValueFunctionIC
    variable = gr0
    v = 'gr1 gr2 gr3'
    function = matrix
  []
[]
[AuxVariables]
  [bnds]
    order = FIRST
    family = LAGRANGE
  []
  [local_energy]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Kernels]
  [gr0dot]
    type = TimeDerivative
    variable = gr0
  []
  [gr0bulk]
    type = AllenCahn
    variable = gr0
    f_name = F
    coupled_variables = 'gr1 gr2 gr3'
  []
  [gr0int]
    type = ACInterface
    variable = gr0
    kappa_name = kappa_op
  []
  [gr1dot]
    type = TimeDerivative
    variable = gr1
  []
  [gr1bulk]
    type = AllenCahn
    variable = gr1
    f_name = F
    coupled_variables = 'gr0 gr2 gr3'
  []
  [gr1int]
    type = ACInterface
    variable = gr1
    kappa_name = kappa_op
  []
  [gr2dot]
    type = TimeDerivative
    variable = gr2
  []
  [gr2bulk]
    type = AllenCahn
    variable = gr2
    f_name = F
    coupled_variables = 'gr0 gr1 gr3'
  []
  [gr2int]
    type = ACInterface
    variable = gr2
    kappa_name = kappa_op
  []
  [gr3dot]
    type = TimeDerivative
    variable = gr3
  []
  [gr3bulk]
    type = AllenCahn
    variable = gr3
    f_name = F
    coupled_variables = 'gr0 gr1 gr2'
  []
  [gr3int]
    type = ACInterface
    variable = gr3
    kappa_name = kappa_op
  []
[]
[AuxKernels]
  [BndsCalc]
    type = BndsCalcAux
    variable = bnds
  []
  [local_free_energy]
    type = TotalFreeEnergy
    variable = local_energy
    kappa_names = 'kappa_op kappa_op kappa_op kappa_op'
    interfacial_vars = 'gr0 gr1 gr2 gr3'
  []
[]
[Materials]
  [Copper]
    type = GBEvolution
    T = 500 # K
    wGB = 60 # nm
    GBmob0 = 2.5e-6 # m^4/(Js) from Schoenfelder 1997
    Q = 0.23 # Migration energy in eV
    GBenergy = 0.708 # GB energy in J/m^2
  []
  [Tabulated]
    type = CoupledValueFunctionFreeEnergy
    free_energy_function = grain_growth_energy
    chemical_potential_functions = 'grain_growth_mu0 grain_growth_mu1 grain_growth_mu2 '
                                   'grain_growth_mu3'
    v = 'gr0 gr1 gr2 gr3'
  []
[]
[Postprocessors]
  [total_energy]
    type = ElementIntegralVariablePostprocessor
    variable = local_energy
  []
[]
[Preconditioning]
  [SMP]
    type = SMP
    coupled_groups = 'gr0,gr1 gr0,gr2 gr0,gr3'
  []
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  l_tol = 1.0e-4
  l_max_its = 30
  nl_max_its = 30
  nl_rel_tol = 1.0e-9
  start_time = 0.0
  num_steps = 3
  dt = 100.0
[]
[Outputs]
  exodus = true
  print_linear_residuals = false
  perf_graph = true
[]
(modules/phase_field/examples/kim-kim-suzuki/kks_example_noflux.i)
#
# KKS simple example in the split form
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 150
  ny = 15
  nz = 0
  xmin = -25
  xmax = 25
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [./Fglobal]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # Liquid phase solute concentration
  [./cl]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.1
  [../]
  # Solid phase solute concentration
  [./cs]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.9
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = '0.5*(1.0-tanh((x)/sqrt(2.0)))'
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = '0.9*(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10)+0.1*(1-(0.5*(1.0-tanh(x/sqrt(2.0))))^3*(6*(0.5*(1.0-tanh(x/sqrt(2.0))))^2-15*(0.5*(1.0-tanh(x/sqrt(2.0))))+10))'
  [../]
[]
[ICs]
  [./eta]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
  [../]
  [./c]
    variable = c
    type = FunctionIC
    function = ic_func_c
  [../]
[]
[Materials]
  # Free energy of the liquid
  [./fl]
    type = DerivativeParsedMaterial
    property_name = fl
    coupled_variables = 'cl'
    expression = '(0.1-cl)^2'
  [../]
  # Free energy of the solid
  [./fs]
    type = DerivativeParsedMaterial
    property_name = fs
    coupled_variables = 'cs'
    expression = '(0.9-cs)^2'
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   eps_sq'
    prop_values = '0.7 0.7 1.0  '
  [../]
[]
[Kernels]
  active = 'PhaseConc ChemPotSolute CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  # enforce c = (1-h(eta))*cl + h(eta)*cs
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cl
    variable = cs
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotSolute]
    type = KKSPhaseChemicalPotential
    variable = cl
    cb       = cs
    fa_name  = fl
    fb_name  = fs
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cl
    fa_name  = fl
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = fl
    fb_name  = fs
    w        = 1.0
    coupled_variables = 'cl cs'
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cl
    cb       = cs
    fa_name  = fl
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = eps_sq
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fl
    fb_name = fs
    w = 1.0
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type -sub_pc_factor_shift_type'
  petsc_options_value = 'asm      ilu          nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 50
  dt = 0.1
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[VectorPostprocessors]
  [./c]
    type =  LineValueSampler
    start_point = '-25 0 0'
    end_point = '25 0 0'
    variable = c
    num_points = 151
    sort_by =  id
    execute_on = timestep_end
  [../]
  [./eta]
    type =  LineValueSampler
    start_point = '-25 0 0'
    end_point = '25 0 0'
    variable = eta
    num_points = 151
    sort_by =  id
    execute_on = timestep_end
  [../]
[]
[Outputs]
  exodus = true
  [./csv]
    type = CSV
    execute_on = final
  [../]
[]
(modules/phase_field/test/tests/phase_field_kernels/nonuniform_barrier_coefficient.i)
# This material tests the kernels ACBarrierFunction and ACKappaFunction for a
# multiphase system.
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  xmin = -200
  xmax = 200
  ymin = -200
  ymax = 200
  uniform_refine = 0
[]
[Variables]
  [./gr0]
  [../]
  [./gr1]
  [../]
[]
[ICs]
  [./gr0_IC]
    type = BoundingBoxIC
    variable = gr0
    x1 = -80
    y1 = -80
    x2 = 80
    y2 = 80
    inside = 0
    outside = 1
  [../]
  [./gr1_IC]
    type = BoundingBoxIC
    variable = gr1
    x1 = -80
    y1 = -80
    x2 = 80
    y2 = 80
    inside = 1
    outside = 0
  [../]
[]
[Materials]
  [./constants]
    type = GenericConstantMaterial
    prop_names =  'L   gamma E0 E1'
    prop_values = '0.1 1.5   3  1'
  [../]
  [./h0]
    type = DerivativeParsedMaterial
    property_name = h0
    coupled_variables = 'gr0 gr1'
    expression = 'gr0^2 / (gr0^2 + gr1^2)'
    derivative_order = 2
  [../]
  [./h1]
    type = DerivativeParsedMaterial
    property_name = h1
    coupled_variables = 'gr0 gr1'
    expression = 'gr1^2 / (gr0^2 + gr1^2)'
    derivative_order = 2
  [../]
  [./mu]
    type = DerivativeParsedMaterial
    property_name = mu
    coupled_variables = 'gr0 gr1'
    constant_names = 'mag'
    constant_expressions = '16'
    expression = 'mag * (gr0^2 * gr1^2 + 0.1)'
    derivative_order = 2
  [../]
  [./kappa]
    type = DerivativeParsedMaterial
    property_name = kappa
    coupled_variables = 'gr0 gr1'
    material_property_names = 'h0(gr0,gr1) h1(gr0,gr1)'
    constant_names = 'mag0 mag1'
    constant_expressions = '200 100'
    expression = 'h0*mag0 + h1*mag1'
    derivative_order = 2
  [../]
[]
[Kernels]
  [./gr0_time]
    type = TimeDerivative
    variable = gr0
  [../]
  [./gr0_interface]
    type = ACInterface
    variable = gr0
    coupled_variables = 'gr1'
    mob_name = L
    kappa_name = 'kappa'
  [../]
  [./gr0_switching]
    type = ACSwitching
    variable = gr0
    coupled_variables = 'gr1'
    hj_names = 'h0 h1'
    Fj_names = 'E0 E1'
    mob_name = L
  [../]
  [./gr0_multi]
    type = ACGrGrMulti
    variable = gr0
    v = 'gr1'
    mob_name = L
    gamma_names = 'gamma'
  [../]
  [./gr0_barrier]
    type = ACBarrierFunction
    variable = gr0
    mob_name = L
    gamma = gamma
    v = 'gr1'
  [../]
  [./gr0_kappa]
    type = ACKappaFunction
    variable = gr0
    mob_name = L
    kappa_name = kappa
    v = 'gr1'
  [../]
  [./gr1_time]
    type = TimeDerivative
    variable = gr1
  [../]
  [./gr1_interface]
    type = ACInterface
    variable = gr1
    coupled_variables = 'gr0'
    mob_name = L
    kappa_name = 'kappa'
  [../]
  [./gr1_switching]
    type = ACSwitching
    variable = gr1
    coupled_variables = 'gr0'
    hj_names = 'h0 h1'
    Fj_names = 'E0 E1'
    mob_name = L
  [../]
  [./gr1_multi]
    type = ACGrGrMulti
    variable = gr1
    v = 'gr0'
    mob_name = L
    gamma_names = 'gamma'
  [../]
  [./gr1_barrier]
    type = ACBarrierFunction
    variable = gr1
    mob_name = L
    gamma = gamma
    v = 'gr0'
  [../]
  [./gr1_kappa]
    type = ACKappaFunction
    variable = gr1
    mob_name = L
    kappa_name = kappa
    v = 'gr0'
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -sub_pc_type -pc_asm_overlap -ksp_gmres_restart -sub_ksp_type'
  petsc_options_value = ' asm      ilu          1               31                 preonly'
  nl_max_its = 20
  l_max_its = 30
  l_tol = 1e-4
  nl_rel_tol = 1e-12
  nl_abs_tol = 1e-12
  start_time = 0
  num_steps = 3
  dt = 1
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/TotalFreeEnergy/TotalFreeEnergy_2var_test.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 10
  ny = 10
  nz = 0
  xmin = 0
  xmax = 1000
  ymin = 0
  ymax = 1000
  zmin = 0
  zmax = 0
  elem_type = QUAD4
  uniform_refine = 2
[]
[GlobalParams]
  op_num = 2
  var_name_base = gr
[]
[Variables]
  [./PolycrystalVariables]
  [../]
[]
[ICs]
  [./PolycrystalICs]
    [./BicrystalCircleGrainIC]
      radius = 333.333
      x = 500
      y = 500
      int_width = 60
    [../]
  [../]
[]
[AuxVariables]
  [./bnds]
    order = FIRST
    family = LAGRANGE
  [../]
  [./local_energy]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[Kernels]
  [./gr0dot]
    type = TimeDerivative
    variable = gr0
  [../]
  [./gr0bulk]
    type = AllenCahn
    variable = gr0
    f_name = F
    coupled_variables = gr1
  [../]
  [./gr0int]
    type = ACInterface
    variable = gr0
    kappa_name = kappa_op
  [../]
  [./gr1dot]
    type = TimeDerivative
    variable = gr1
  [../]
  [./gr1bulk]
    type = AllenCahn
    variable = gr1
    f_name = F
    coupled_variables = gr0
  [../]
  [./gr1int]
    type = ACInterface
    variable = gr1
    kappa_name = kappa_op
  [../]
[]
[AuxKernels]
  [./BndsCalc]
    type = BndsCalcAux
    variable = bnds
  [../]
  [./local_free_energy]
    type = TotalFreeEnergy
    variable = local_energy
    kappa_names = 'kappa_op kappa_op'
    interfacial_vars = 'gr0 gr1'
  [../]
[]
[BCs]
  [./Periodic]
    [./All]
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  [./Copper]
    type = GBEvolution
    T = 500 # K
    wGB = 60 # nm
    GBmob0 = 2.5e-6 # m^4/(Js) from Schoenfelder 1997
    Q = 0.23 # Migration energy in eV
    GBenergy = 0.708 # GB energy in J/m^2
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'gr0 gr1'
    material_property_names = 'mu gamma_asymm'
    expression = 'mu*( gr0^4/4.0 - gr0^2/2.0 + gr1^4/4.0 - gr1^2/2.0 + gamma_asymm*gr0^2*gr1^2) + 1.0/4.0'
    derivative_order = 2
    enable_jit = true
  [../]
[]
[Postprocessors]
  [./total_energy]
    type = ElementIntegralVariablePostprocessor
    variable = local_energy
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -pc_hypre_type -ksp_gmres_restart'
  petsc_options_value = 'hypre boomeramg 31'
  l_tol = 1.0e-4
  l_max_its = 30
  nl_max_its = 30
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  num_steps = 7
  dt = 80.0
  [./Adaptivity]
    initial_adaptivity = 2
    refine_fraction = 0.8
    coarsen_fraction = 0.05
    max_h_level = 2
  [../]
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/MultiPhase/switchingfunctionmultiphasematerial.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 30
  ny = 30
  xmin = 0
  xmax = 30
  ymin = 0
  ymax = 30
[]
[Variables]
  [./c]
  [../]
  [./w]
  [../]
  [./eta1]
  [../]
  [./eta2]
  [../]
  [./eta3]
  [../]
  [./eta0]
  [../]
[]
[ICs]
  [./IC_eta2]
    x1 = 0
    y1 = 15
    x2 = 30
    y2 = 30
    inside = 1.0
    outside = 0.0
    type = BoundingBoxIC
    variable = eta2
    int_width = 0
  [../]
  [./IC_eta3]
    x1 = 15
    y1 = 0
    x2 = 30
    y2 = 15
    inside = 1.0
    outside = 0.0
    type = BoundingBoxIC
    variable = eta3
    int_width = 0
  [../]
  [./IC_eta4]
    x1 = 0
    y1 = 0
    x2 = 15
    y2 = 15
    inside = 1.0
    outside = 0.0
    type = BoundingBoxIC
    variable = eta0
    int_width = 0
  [../]
  [./IC_c]
    x1 = 15
    y1 = 15
    radius = 8.0
    outvalue = 0.05
    variable = c
    invalue = 1.0
    type = SmoothCircleIC
    int_width = 3.0
  [../]
  [./IC_eta1]
    x1 = 15
    y1 = 15
    radius = 8.0
    outvalue = 0.0
    variable = eta1
    invalue = 1.0
    type = SmoothCircleIC
    int_width = 3.0
  [../]
[]
# Not evalulating time evolution to improve test performance, since we are only testing
# the material property. However, the kernel and free energy are left in place to allow
# this test to be easily turned in to a working example
#[Kernels]
#  [./c_dot]
#    type = CoupledTimeDerivative
#    variable = w
#    v = c
#  [../]
#  [./c_res]
#    type = SplitCHParsed
#    variable = c
#    f_name = F
#    kappa_name = kappa_c
#    w = w
#    coupled_variables = 'eta1 eta2 eta3 eta0'
#  [../]
#  [./w_res]
#    # coupled_variables = 'c'
#    type = SplitCHWRes
#    variable = w
#    mob_name = M
#  [../]
#  [./AC1_bulk]
#    type = AllenCahn
#    variable = eta1
#    f_name = F
#    coupled_variables = 'c eta2 eta3 eta0'
#  [../]
#  [./AC1_int]
#    type = ACInterface
#    variable = eta1
#    kappa_name = kappa_s
#  [../]
#  [./e1_dot]
#    type = TimeDerivative
#    variable = eta1
#  [../]
#  [./AC2_bulk]
#    type = AllenCahn
#    variable = eta2
#    f_name = F
#    coupled_variables = 'c eta1 eta3 eta0'
#  [../]
#  [./AC2_int]
#    type = ACInterface
#    variable = eta2
#  [../]
#  [./e2_dot]
#    type = TimeDerivative
#    variable = eta2
#  [../]
#  [./AC3_bulk]
#    type = AllenCahn
#    variable = eta3
#    f_name = F
#    coupled_variables = 'c eta2 eta1 eta0'
#  [../]
#  [./AC3_int]
#    type = ACInterface
#    variable = eta3
#  [../]
#  [./e3_dot]
#    type = TimeDerivative
#    variable = eta3
#  [../]
#  [./AC4_bulk]
#    type = AllenCahn
#    variable = eta0
#    f_name = F
#    coupled_variables = 'c eta2 eta3 eta1'
#  [../]
#  [./AC4_int]
#    type = ACInterface
#    variable = eta0
#  [../]
#  [./e4_dot]
#    type = TimeDerivative
#    variable = eta0
#  [../]
#[]
[Materials]
  [./ha_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = ha
    all_etas = 'eta0 eta1 eta2 eta3'
    phase_etas = 'eta1'
    outputs = exodus
  [../]
  [./hb_test]
    type = SwitchingFunctionMultiPhaseMaterial
    h_name = hb
    all_etas = 'eta0 eta1 eta2 eta3'
    phase_etas = 'eta0 eta2 eta3'
    outputs = exodus
  [../]
  #[./ha]
  #  type = DerivativeParsedMaterial
  #  coupled_variables = 'eta1 eta2 eta3 eta0'
  #  property_name = ha_parsed
  #  expression = 'eta1^2/(eta1^2+eta2^2+eta3^2+eta0^2)'
  #  derivative_order = 2
  #  outputs = exodus
  #[../]
  #[./hb]
  #  type = DerivativeParsedMaterial
  #  coupled_variables = 'eta1 eta2 eta3 eta0'
  #  property_name = hb_parsed
  #  expression = '(eta2^2+eta3^2+eta0^2)/(eta1^2+eta2^2+eta3^2+eta0^2)'
  #  derivative_order = 2
  #  outputs = exodus
  #[../]
  #[./FreeEng]
  #  type = DerivativeParsedMaterial
  #  coupled_variables = 'c eta1 eta2 eta3 eta0'
  #  property_name = F
  #  constant_names = 'c1 c2 s g d e h z'
  #  constant_expressions = '1.0 0.0 1.5 1.5 1.0 1.0 1 1.0'
  #  material_property_names = 'ha(eta1,eta2,eta3,eta0) hb(eta1,eta2,eta3,eta0)'
  #  expression = 'a:=eta1^2/(eta1^2+eta2^2+eta3^2+eta0^2);f1:=ha*(c-c1)^2;b:=(eta2^2+eta3^2+eta0^2)/(eta1^2+eta2^2+eta3^2+eta0^2);f2:=hb*(c-c2)^2
  #  ;f3:=1/4*eta1^4-1/2*eta1^2+1/4*eta2^4-1/2*eta2^2+1/4*eta3^4-1/2*eta3^2+1/4*eta0^4-1/2*eta0^2
  #  ;f4:=z*s*(eta1^2*eta2^2+eta1^2*eta3^2+eta1^2*eta0^2)+g*(eta2^2*eta3^2+eta2^2*eta0^2+eta3^2*eta0^2);f:=1/4+e*f1+d*f2+h*(f3+f4);f'
  #  derivative_order = 2
  #[../]
  [./const]
    type = GenericConstantMaterial
    prop_names = 'kappa_c kappa_s kappa_op L M'
    prop_values = '0 3 3 1.0 1.0'
    outputs = exodus
  [../]
[]
[Executioner]
  type = Transient
  num_steps = 1
[]
[Problem]
  solve = false
  kernel_coverage_check = false
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/MultiPhase/derivativetwophasematerial.i)
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 14
  ny = 10
  nz = 0
  xmin = 10
  xmax = 40
  ymin = 15
  ymax = 35
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 25.0
      y1 = 25.0
      radius = 6.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 3.0
    [../]
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 30.0
      y1 = 25.0
      radius = 4.0
      invalue = 0.9
      outvalue = 0.1
      int_width = 2.0
    [../]
  [../]
[]
[Kernels]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
  [./ACBulk]
    type = AllenCahn
    variable = eta
    coupled_variables = c
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa_eta
  [../]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = 'eta'
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
[]
[BCs]
  [./Periodic]
    [./All]
      auto_direction = 'x y'
    [../]
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1 1        '
  [../]
  [./consts2]
    type = GenericConstantMaterial
    prop_names  = 'M kappa_c'
    prop_values = '1 1'
  [../]
  [./switching]
    type = SwitchingFunctionMaterial
    eta = eta
    h_order = SIMPLE
  [../]
  [./barrier]
    type = BarrierFunctionMaterial
    eta = eta
    g_order = SIMPLE
  [../]
  [./free_energy_A]
    type = DerivativeParsedMaterial
    property_name = Fa
    coupled_variables = 'c'
    expression = '(c-0.1)^2*(c-1)^2 + c*0.01'
    derivative_order = 2
    enable_jit = true
  [../]
  [./free_energy_B]
    type = DerivativeParsedMaterial
    property_name = Fb
    coupled_variables = 'c'
    expression = 'c^2*(c-0.9)^2 + (1-c)*0.01'
    derivative_order = 2
    enable_jit = true
  [../]
  [./free_energy]
    type = DerivativeTwoPhaseMaterial
    property_name = F
    fa_name = Fa
    fb_name = Fb
    coupled_variables = 'c'
    eta = eta
    derivative_order = 2
    outputs = exodus
    output_properties = 'F dF/dc dF/deta d^2F/dc^2 d^2F/dcdeta d^2F/deta^2'
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = 'bdf2'
  solve_type = 'NEWTON'
  l_max_its = 15
  l_tol = 1.0e-4
  nl_max_its = 10
  nl_rel_tol = 1.0e-11
  start_time = 0.0
  num_steps = 1
  dt = 0.1
[]
[Outputs]
  exodus = true
[]
(modules/phase_field/test/tests/rigidbodymotion/grain_motion.i)
# test file for applyting advection term and observing rigid body motion of grains
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 25
  ny = 15
  nz = 0
  xmax = 50
  ymax = 25
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[Kernels]
  [./c_res]
    type = SplitCHParsed
    variable = c
    f_name = F
    kappa_name = kappa_c
    w = w
    coupled_variables = eta
  [../]
  [./w_res]
    type = SplitCHWRes
    variable = w
    mob_name = M
  [../]
  [./time]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./motion]
    type = MultiGrainRigidBodyMotion
    variable = w
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./eta_dot]
    type = TimeDerivative
    variable = eta
  [../]
  [./vadv_eta]
    type = SingleGrainRigidBodyMotion
    variable = eta
    c = c
    v = eta
    grain_tracker_object = grain_center
    grain_force = grain_force
    grain_volumes = grain_volumes
  [../]
  [./acint_eta]
    type = ACInterface
    variable = eta
    mob_name = M
    coupled_variables = c
    kappa_name = kappa_eta
  [../]
  [./acbulk_eta]
    type = AllenCahn
    variable = eta
    mob_name = M
    f_name = F
    coupled_variables = c
  [../]
[]
[Materials]
  [./pfmobility]
    type = GenericConstantMaterial
    prop_names = 'M    kappa_c  kappa_eta'
    prop_values = '5.0  2.0      0.1'
  [../]
  [./free_energy]
    type = DerivativeParsedMaterial
    coupled_variables = 'c eta'
    constant_names = 'barr_height  cv_eq'
    constant_expressions = '0.1          1.0e-2'
    expression = 16*barr_height*(c-cv_eq)^2*(1-cv_eq-c)^2+(c-eta)^2
    derivative_order = 2
  [../]
[]
[VectorPostprocessors]
  [./forces]
    type = GrainForcesPostprocessor
    grain_force = grain_force
  [../]
  [./grain_volumes]
    type = FeatureVolumeVectorPostprocessor
    flood_counter = grain_center
    execute_on = 'initial timestep_begin'
  [../]
[]
[UserObjects]
  [./grain_center]
    type = GrainTracker
    variable = eta
    outputs = none
    compute_var_to_feature_map = true
    execute_on = 'initial timestep_begin'
  [../]
  [./grain_force]
    type = ConstantGrainForceAndTorque
    execute_on = 'linear nonlinear'
    force = '0.5 0.0 0.0 '
    torque = '0.0 0.0 10.0 '
  [../]
[]
[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  nl_max_its = 30
  scheme = bdf2
  solve_type = NEWTON
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm         31   preonly   lu      1'
  l_max_its = 30
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  start_time = 0.0
  dt = 0.2
  num_steps = 1
[]
[Outputs]
  exodus = true
[]
[ICs]
  [./rect_c]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = c
    x1 = 10.0
    type = BoundingBoxIC
  [../]
  [./rect_eta]
    y2 = 20.0
    y1 = 5.0
    inside = 1.0
    x2 = 30.0
    variable = eta
    x1 = 10.0
    type = BoundingBoxIC
  [../]
[]
(modules/combined/test/tests/phase_field_fracture/crack2d_iso_wo_time.i)
#This input does not add time derivative kernel for phase field equation
[Mesh]
  [gen]
    type = GeneratedMeshGenerator
    dim = 2
    nx = 20
    ny = 10
    ymax = 0.5
  []
  [./noncrack]
    type = BoundingBoxNodeSetGenerator
    new_boundary = noncrack
    bottom_left = '0.5 0 0'
    top_right = '1 0 0'
    input = gen
  [../]
[]
[GlobalParams]
  displacements = 'disp_x disp_y'
[]
[Physics]
  [./SolidMechanics]
    [./QuasiStatic]
      [./mech]
        add_variables = true
        strain = SMALL
        additional_generate_output = 'stress_yy'
        save_in = 'resid_x resid_y'
      [../]
    [../]
  [../]
[]
[Variables]
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[AuxVariables]
  [./resid_x]
  [../]
  [./resid_y]
  [../]
[]
[Kernels]
  [./solid_x]
    type = PhaseFieldFractureMechanicsOffDiag
    variable = disp_x
    component = 0
    c = c
  [../]
  [./solid_y]
    type = PhaseFieldFractureMechanicsOffDiag
    variable = disp_y
    component = 1
    c = c
  [../]
  [./ACBulk]
    type = AllenCahn
    variable = c
    f_name = F
  [../]
  [./ACInterface]
    type = ACInterface
    variable = c
    kappa_name = kappa_op
  [../]
[]
[BCs]
  [./ydisp]
    type = FunctionDirichletBC
    variable = disp_y
    boundary = top
    function = 't'
  [../]
  [./yfix]
    type = DirichletBC
    variable = disp_y
    boundary = noncrack
    value = 0
  [../]
  [./xfix]
    type = DirichletBC
    variable = disp_x
    boundary = top
    value = 0
  [../]
[]
[Materials]
  [./pfbulkmat]
    type = GenericConstantMaterial
    prop_names = 'gc_prop l visco'
    prop_values = '1e-3 0.04 1e-4'
  [../]
  [./define_mobility]
    type = ParsedMaterial
    material_property_names = 'gc_prop visco'
    property_name = L
    expression = '1.0/(gc_prop * visco)'
  [../]
  [./define_kappa]
    type = ParsedMaterial
    material_property_names = 'gc_prop l'
    property_name = kappa_op
    expression = 'gc_prop * l'
  [../]
  [./elasticity_tensor]
    type = ComputeElasticityTensor
    C_ijkl = '120.0 80.0'
    fill_method = symmetric_isotropic
  [../]
  [./elastic]
    type = ComputeLinearElasticPFFractureStress
    c = c
    E_name = 'elastic_energy'
    D_name = 'degradation'
    F_name = 'local_fracture_energy'
    decomposition_type = strain_spectral
  [../]
  [./degradation]
    type = DerivativeParsedMaterial
    property_name = degradation
    coupled_variables = 'c'
    expression = '(1.0-c)^2*(1.0 - eta) + eta'
    constant_names       = 'eta'
    constant_expressions = '0.0'
    derivative_order = 2
  [../]
  [./local_fracture_energy]
    type = DerivativeParsedMaterial
    property_name = local_fracture_energy
    coupled_variables = 'c'
    material_property_names = 'gc_prop l'
    expression = 'c^2 * gc_prop / 2 / l'
    derivative_order = 2
  [../]
  [./fracture_driving_energy]
    type = DerivativeSumMaterial
    coupled_variables = c
    sum_materials = 'elastic_energy local_fracture_energy'
    derivative_order = 2
    property_name = F
  [../]
[]
[Postprocessors]
  [./resid_x]
    type = NodalSum
    variable = resid_x
    boundary = 2
  [../]
  [./resid_y]
    type = NodalSum
    variable = resid_y
    boundary = 2
  [../]
[]
[Preconditioning]
  [./smp]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  solve_type = PJFNK
  petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap'
  petsc_options_value = 'asm      31                  preonly       lu           1'
  nl_rel_tol = 1e-8
  l_max_its = 10
  nl_max_its = 10
  dt = 1e-4
  dtmin = 1e-4
  num_steps = 2
[]
[Outputs]
  exodus = true
[]
(modules/combined/examples/phase_field-mechanics/Nonconserved.i)
#
# Example 2
# Phase change driven by a mechanical (elastic) driving force.
# An oversized phase inclusion grows under a uniaxial tensile stress.
# Check the file below for comments and suggestions for parameter modifications.
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 40
  ny = 40
  nz = 0
  xmin = 0
  xmax = 50
  ymin = 0
  ymax = 50
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[Variables]
  [./eta]
    order = FIRST
    family = LAGRANGE
    [./InitialCondition]
      type = SmoothCircleIC
      x1 = 0
      y1 = 0
      radius = 30.0
      invalue = 1.0
      outvalue = 0.0
      int_width = 10.0
    [../]
  [../]
  [./disp_x]
    order = FIRST
    family = LAGRANGE
  [../]
  [./disp_y]
    order = FIRST
    family = LAGRANGE
  [../]
[]
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y'
  [../]
  [./eta_bulk]
    type = AllenCahn
    variable = eta
    f_name = F
  [../]
  [./eta_interface]
    type = ACInterface
    variable = eta
    kappa_name = 1
  [../]
  [./time]
    type = TimeDerivative
    variable = eta
  [../]
[]
#
# Try visualizing the stress tensor components as done in Conserved.i
#
[Materials]
  [./consts]
    type = GenericConstantMaterial
    block = 0
    prop_names  = 'L'
    prop_values = '1'
  [../]
  # matrix phase
  [./stiffness_a]
    type = ComputeElasticityTensor
    base_name = phasea
    block = 0
    # lambda, mu values
    C_ijkl = '7 7'
    # Stiffness tensor is created from lambda=7, mu=7 for symmetric_isotropic fill method
    fill_method = symmetric_isotropic
    # See RankFourTensor.h for details on fill methods
  [../]
  [./strain_a]
    type = ComputeSmallStrain
    block = 0
    displacements = 'disp_x disp_y'
    base_name = phasea
  [../]
  [./stress_a]
    type = ComputeLinearElasticStress
    block = 0
    base_name = phasea
  [../]
  [./elastic_free_energy_a]
    type = ElasticEnergyMaterial
    base_name = phasea
    f_name = Fea
    block = 0
    coupled_variables = ''
  [../]
  # oversized precipitate phase (simulated using thermal expansion)
  [./stiffness_b]
    type = ComputeElasticityTensor
    base_name = phaseb
    block = 0
    # Stiffness tensor lambda, mu values
    # Note that the two phases could have different stiffnesses.
    # Try reducing the precipitate stiffness (to '1 1') rather than making it oversized
    C_ijkl = '7 7'
    fill_method = symmetric_isotropic
  [../]
  [./strain_b]
    type = ComputeSmallStrain
    block = 0
    displacements = 'disp_x disp_y'
    base_name = phaseb
    eigenstrain_names = eigenstrain
  [../]
  [./eigenstrain_b]
    type = ComputeEigenstrain
    base_name = phaseb
    eigen_base = '0.1 0.1 0.1'
    eigenstrain_name = eigenstrain
  [../]
  [./stress_b]
    type = ComputeLinearElasticStress
    block = 0
    base_name = phaseb
  [../]
  [./elastic_free_energy_b]
    type = ElasticEnergyMaterial
    base_name = phaseb
    f_name = Feb
    block = 0
    coupled_variables = ''
  [../]
  # Generate the global free energy from the phase free energies
  [./switching]
    type = SwitchingFunctionMaterial
    block = 0
    eta = eta
    h_order = SIMPLE
  [../]
  [./barrier]
    type = BarrierFunctionMaterial
    block = 0
    eta = eta
    g_order = SIMPLE
  [../]
  [./free_energy]
    type = DerivativeTwoPhaseMaterial
    block = 0
    f_name = F
    fa_name = Fea
    fb_name = Feb
    eta = eta
    coupled_variables = ''
    W = 0.1
    derivative_order = 2
  [../]
  # Generate the global stress from the phase stresses
  [./global_stress]
    type = TwoPhaseStressMaterial
    block = 0
    base_A = phasea
    base_B = phaseb
  [../]
[]
[BCs]
  [./bottom_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'bottom'
    value = 0
  [../]
  [./top_y]
    type = DirichletBC
    variable = disp_y
    boundary = 'top'
    value = 5
  [../]
  [./left_x]
    type = DirichletBC
    variable = disp_x
    boundary = 'left'
    value = 0
  [../]
[]
[Preconditioning]
  # active = ' '
  [./SMP]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  # this gives best performance on 4 cores
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type  -sub_pc_type '
  petsc_options_value = 'asm       lu'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-8
  nl_abs_tol = 1.0e-10
  start_time = 0.0
  num_steps = 200
  [./TimeStepper]
    type = SolutionTimeAdaptiveDT
    dt = 0.2
  [../]
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/phase_field/test/tests/KKS_system/kks_example_nested.i)
#
# Two-phase nested KKS toy problem
#
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 15
  ny = 15
  nz = 0
  xmin = -2.5
  xmax = 2.5
  ymin = -2.5
  ymax = 2.5
  zmin = 0
  zmax = 0
  elem_type = QUAD4
[]
[AuxVariables]
  [Fglobal]
    order = CONSTANT
    family = MONOMIAL
  []
[]
[Variables]
  # order parameter
  [eta]
    order = FIRST
    family = LAGRANGE
  []
  # hydrogen concentration
  [c]
    order = FIRST
    family = LAGRANGE
  []
  # chemical potential
  [w]
    order = FIRST
    family = LAGRANGE
  []
[]
[ICs]
  [eta]
    variable = eta
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.2
    outvalue = 0.1
    int_width = 0.75
  []
  [c]
    variable = c
    type = SmoothCircleIC
    x1 = 0.0
    y1 = 0.0
    radius = 1.5
    invalue = 0.6
    outvalue = 0.4
    int_width = 0.75
  []
[]
[BCs]
  [Periodic]
    [all]
      variable = 'eta w c'
      auto_direction = 'x y'
    []
  []
[]
[Materials]
  # Free energy of the matrix
  [fm]
    type = DerivativeParsedMaterial
    property_name = fm
    expression = '(0.1-cm)^2'
    material_property_names = 'cm'
    additional_derivative_symbols = 'cm'
    compute = false
  []
  # Free energy of the delta phase
  [fd]
    type = DerivativeParsedMaterial
    property_name = fd
    expression = '(0.9-cd)^2'
    material_property_names = 'cd'
    additional_derivative_symbols = 'cd'
    compute = false
  []
  # Compute phase concentrations
  [PhaseConcentrationMaterial]
    type = KKSPhaseConcentrationMaterial
    global_cs = 'c'
    ci_names = 'cm cd'
    ci_IC = '0 0'
    fa_name = fm
    fb_name = fd
    h_name = h
    min_iterations = 1
    max_iterations = 100
    absolute_tolerance = 1e-9
    relative_tolerance = 1e-9
    nested_iterations = iter
    outputs = exodus
  []
  # Compute chain rule terms
  [PhaseConcentrationDerivatives]
    type = KKSPhaseConcentrationDerivatives
    global_cs = 'c'
    eta = eta
    ci_names = 'cm cd'
    fa_name = fm
    fb_name = fd
    h_name = h
  []
  # h(eta)
  [h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  []
  # g(eta)
  [g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
  []
  # constant properties
  [constants]
    type = GenericConstantMaterial
    prop_names = 'M   L   kappa'
    prop_values = '0.7 0.7 0.4  '
  []
[]
[Kernels]
  # full transient
  active = 'CHBulk ACBulkF ACBulkC ACInterface dcdt detadt ckernel'
  #
  # Cahn-Hilliard Equation
  #
  [CHBulk]
    type = NestedKKSSplitCHCRes
    variable = c
    global_cs = 'c'
    w = w
    all_etas = eta
    ca_names = 'cm cd'
    fa_name = fm
    coupled_variables = 'eta w'
  []
  [dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  []
  [ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  []
  #
  # Allen-Cahn Equation
  #
  [ACBulkF]
    type = NestedKKSACBulkF
    variable = eta
    global_cs = 'c'
    ci_names = 'cm cd'
    fa_name = fm
    fb_name = fd
    g_name = g
    h_name = h
    mob_name = L
    w = 0.4
    coupled_variables = 'c'
  []
  [ACBulkC]
    type = NestedKKSACBulkC
    variable = eta
    global_cs = 'c'
    ci_names = 'cm cd'
    fa_name = fm
    h_name = h
    mob_name = L
    coupled_variables = 'c'
  []
  [ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  []
  [detadt]
    type = TimeDerivative
    variable = eta
  []
[]
[AuxKernels]
  [GlobalFreeEnergy]
    variable = Fglobal
    type = KKSGlobalFreeEnergy
    fa_name = fm
    fb_name = fd
    w = 0.4
  []
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pctype -sub_pc_type -sub_pc_factor_shift_type -pc_factor_shift_type'
  petsc_options_value = ' asm    lu          nonzero                    nonzero'
  l_max_its = 100
  nl_max_its = 100
  num_steps = 3
  dt = 0.1
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [full]
    type = SMP
    full = true
  []
[]
[Outputs]
  file_base = kks_example_nested
  exodus = true
[]
(modules/phase_field/test/tests/MultiPhase/mixedswitchingfunctionmaterial.i)
# This is a test of the MixedSwitchingfunctionmaterial
# Several mixed type of switching function with ajustable weight parameter
[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 20
  ny = 20
  xmin = 0
  xmax = 20
  ymin = 0
  ymax = 20
  elem_type = QUAD4
[]
[Variables]
  [./eta]
  [../]
[]
[ICs]
  [./IC_eta]
    type = SmoothCircleIC
    variable = eta
    x1 = 10
    y1 = 10
    radius = 5
    invalue = 1
    outvalue = 0
    int_width = 1
  [../]
[]
[Kernels]
  [./eta_bulk]
    type = AllenCahn
    variable = eta
    f_name = F
  [../]
  [./eta_interface]
    type = ACInterface
    variable = eta
    kappa_name = kappa_eta
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[Materials]
  [./consts]
    type = GenericConstantMaterial
    prop_names  = 'L kappa_eta'
    prop_values = '1.0 1.0'
  [../]
  [./switching]
    type = MixedSwitchingFunctionMaterial
    function_name = h
    eta = eta
    h_order = MIX234
    weight = 1.0
  [../]
  [./barrier]
    type = BarrierFunctionMaterial
    eta = eta
    g_order = SIMPLE
  [../]
# Total free energy: F = Fa*(1-h) + Fb*h
  [./free_energy]
    type = DerivativeTwoPhaseMaterial
    property_name = F
    fa_name = '0'
    fb_name = '-1'
    eta = eta
    W = 3.1
    derivative_order = 2
    outputs = exodus
  [../]
[]
[BCs]
  [./Periodic]
    [./all]
      auto_direction = 'x y'
    [../]
  [../]
[]
[Executioner]
  type = Transient
  scheme = bdf2
  solve_type = 'PJFNK'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-10
  nl_abs_tol = 1.0e-12
  start_time = 0.0
  num_steps = 2
  [./TimeStepper]
    type = IterationAdaptiveDT
    optimal_iterations = 9
    iteration_window = 2
    growth_factor = 1.1
    cutback_factor = 0.75
    dt = 0.3
  [../]
[]
[Outputs]
  execute_on = 'timestep_end'
  exodus = true
[]
(modules/combined/test/tests/surface_tension_KKS/surface_tension_KKS.i)
#
# KKS coupled with elasticity. Physical parameters for matrix and precipitate phases
# are gamma and gamma-prime phases, respectively, in the Ni-Al system.
# Parameterization is as described in L.K. Aagesen et al., Computational Materials
# Science, 140, 10-21 (2017), with isotropic elastic properties in both phases
# and without eigenstrain.
#
[Mesh]
  type = GeneratedMesh
  dim = 1
  nx = 200
  xmax = 200
  coord_type = RSPHERICAL
[]
[GlobalParams]
  displacements = 'disp_x'
[]
[Variables]
  # order parameter
  [./eta]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute concentration
  [./c]
    order = FIRST
    family = LAGRANGE
  [../]
  # chemical potential
  [./w]
    order = FIRST
    family = LAGRANGE
  [../]
  # solute phase concentration (matrix)
  [./cm]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.13
  [../]
  # solute phase concentration (precipitate)
  [./cp]
    order = FIRST
    family = LAGRANGE
    initial_condition = 0.235
  [../]
[]
[AuxVariables]
  [./energy_density]
    family = MONOMIAL
  [../]
  [./extra_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./extra_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./extra_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strain_xx]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strain_yy]
    order = CONSTANT
    family = MONOMIAL
  [../]
  [./strain_zz]
    order = CONSTANT
    family = MONOMIAL
  [../]
[]
[ICs]
  [./eta_ic]
    variable = eta
    type = FunctionIC
    function = ic_func_eta
  [../]
  [./c_ic]
    variable = c
    type = FunctionIC
    function = ic_func_c
  [../]
[]
[Functions]
  [./ic_func_eta]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2+z^2);0.5*(1.0-tanh((r-r0)/delta_eta/sqrt(2.0)))'
    symbol_names = 'delta_eta r0'
    symbol_values = '6.431     100'
  [../]
  [./ic_func_c]
    type = ParsedFunction
    expression = 'r:=sqrt(x^2+y^2+z^2);eta_an:=0.5*(1.0-tanh((r-r0)/delta/sqrt(2.0)));0.235*eta_an^3*(6*eta_an^2-15*eta_an+10)+0.13*(1-eta_an^3*(6*eta_an^2-15*eta_an+10))'
    symbol_names = 'delta r0'
    symbol_values = '6.431 100'
  [../]
[]
[Physics/SolidMechanics/QuasiStatic]
  [./all]
    add_variables = true
    generate_output = 'hydrostatic_stress stress_xx stress_yy stress_zz'
  [../]
[]
[Kernels]
  # enforce c = (1-h(eta))*cm + h(eta)*cp
  [./PhaseConc]
    type = KKSPhaseConcentration
    ca       = cm
    variable = cp
    c        = c
    eta      = eta
  [../]
  # enforce pointwise equality of chemical potentials
  [./ChemPotVacancies]
    type = KKSPhaseChemicalPotential
    variable = cm
    cb       = cp
    fa_name  = f_total_matrix
    fb_name  = f_total_ppt
  [../]
  #
  # Cahn-Hilliard Equation
  #
  [./CHBulk]
    type = KKSSplitCHCRes
    variable = c
    ca       = cm
    fa_name  = f_total_matrix
    w        = w
  [../]
  [./dcdt]
    type = CoupledTimeDerivative
    variable = w
    v = c
  [../]
  [./ckernel]
    type = SplitCHWRes
    mob_name = M
    variable = w
  [../]
  #
  # Allen-Cahn Equation
  #
  [./ACBulkF]
    type = KKSACBulkF
    variable = eta
    fa_name  = f_total_matrix
    fb_name  = f_total_ppt
    w        = 0.0033
    coupled_variables = 'cp cm'
  [../]
  [./ACBulkC]
    type = KKSACBulkC
    variable = eta
    ca       = cm
    cb       = cp
    fa_name  = f_total_matrix
  [../]
  [./ACInterface]
    type = ACInterface
    variable = eta
    kappa_name = kappa
  [../]
  [./detadt]
    type = TimeDerivative
    variable = eta
  [../]
[]
[AuxKernels]
  [./extra_xx]
    type = RankTwoAux
    rank_two_tensor = extra_stress
    index_i = 0
    index_j = 0
    variable = extra_xx
  [../]
  [./extra_yy]
    type = RankTwoAux
    rank_two_tensor = extra_stress
    index_i = 1
    index_j = 1
    variable = extra_yy
  [../]
  [./extra_zz]
    type = RankTwoAux
    rank_two_tensor = extra_stress
    index_i = 2
    index_j = 2
    variable = extra_zz
  [../]
  [./strain_xx]
    type = RankTwoAux
    rank_two_tensor = mechanical_strain
    index_i = 0
    index_j = 0
    variable = strain_xx
  [../]
  [./strain_yy]
    type = RankTwoAux
    rank_two_tensor = mechanical_strain
    index_i = 1
    index_j = 1
    variable = strain_yy
  [../]
  [./strain_zz]
    type = RankTwoAux
    rank_two_tensor = mechanical_strain
    index_i = 2
    index_j = 2
    variable = strain_zz
  [../]
[]
[Materials]
  # Chemical free energy of the matrix
  [./fm]
    type = DerivativeParsedMaterial
    property_name = fm
    coupled_variables = 'cm'
    expression = '6.55*(cm-0.13)^2'
  [../]
# Elastic energy of the matrix
  [./elastic_free_energy_m]
    type = ElasticEnergyMaterial
    base_name = matrix
    f_name = fe_m
    coupled_variables = ' '
  [../]
# Total free energy of the matrix
  [./Total_energy_matrix]
    type = DerivativeSumMaterial
    property_name = f_total_matrix
    sum_materials = 'fm fe_m'
    coupled_variables = 'cm'
  [../]
  # Free energy of the precipitate phase
  [./fp]
    type = DerivativeParsedMaterial
    property_name = fp
    coupled_variables = 'cp'
    expression = '6.55*(cp-0.235)^2'
  [../]
# Elastic energy of the precipitate
  [./elastic_free_energy_p]
    type = ElasticEnergyMaterial
    base_name = ppt
    f_name = fe_p
    coupled_variables = ' '
  [../]
# Total free energy of the precipitate
  [./Total_energy_ppt]
    type = DerivativeSumMaterial
    property_name = f_total_ppt
    sum_materials = 'fp fe_p'
    coupled_variables = 'cp'
  [../]
# Total elastic energy
  [./Total_elastic_energy]
    type = DerivativeTwoPhaseMaterial
    eta = eta
    f_name = f_el_mat
    fa_name = fe_m
    fb_name = fe_p
    outputs = exodus
    W = 0
  [../]
  # h(eta)
  [./h_eta]
    type = SwitchingFunctionMaterial
    h_order = HIGH
    eta = eta
  [../]
  # g(eta)
  [./g_eta]
    type = BarrierFunctionMaterial
    g_order = SIMPLE
    eta = eta
    outputs = exodus
  [../]
  # constant properties
  [./constants]
    type = GenericConstantMaterial
    prop_names  = 'M   L   kappa'
    prop_values = '0.7 0.7 0.1365'
  [../]
  #Mechanical properties
  [./Stiffness_matrix]
    type = ComputeElasticityTensor
    C_ijkl = '74.25 14.525'
    base_name = matrix
    fill_method = symmetric_isotropic
  [../]
  [./Stiffness_ppt]
    type = ComputeElasticityTensor
    C_ijkl = '74.25 14.525'
    base_name = ppt
    fill_method = symmetric_isotropic
  [../]
  [./strain_matrix]
    type = ComputeRSphericalSmallStrain
    base_name = matrix
  [../]
  [./strain_ppt]
    type = ComputeRSphericalSmallStrain
    base_name = ppt
  [../]
  [./stress_matrix]
    type = ComputeLinearElasticStress
    base_name = matrix
  [../]
  [./stress_ppt]
    type = ComputeLinearElasticStress
    base_name = ppt
  [../]
  [./global_stress]
    type = TwoPhaseStressMaterial
    base_A = matrix
    base_B = ppt
  [../]
  [./interface_stress]
    type = ComputeSurfaceTensionKKS
    v = eta
    kappa_name = kappa
    w = 0.0033
  [../]
[]
[BCs]
  [./left_r]
    type = DirichletBC
    variable = disp_x
    boundary = left
    value = 0
  [../]
[]
#
# Precondition using handcoded off-diagonal terms
#
[Preconditioning]
  [./full]
    type = SMP
    full = true
  [../]
[]
[Executioner]
  type = Transient
  solve_type = 'PJFNK'
  petsc_options_iname = '-pc_type -sub_pc_type   -sub_pc_factor_shift_type'
  petsc_options_value = 'asm       lu            nonzero'
  l_max_its = 30
  nl_max_its = 10
  l_tol = 1.0e-4
  nl_rel_tol = 1.0e-9
  nl_abs_tol = 1.0e-10
  num_steps = 2
  dt = 0.5
[]
[Outputs]
  exodus = true
  [./csv]
    type = CSV
    execute_on = 'final'
  [../]
[]
(modules/phase_field/include/kernels/ACInterface2DMultiPhase1.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "Kernel.h"
#include "JvarMapInterface.h"
#include "DerivativeMaterialInterface.h"
#include "ACInterface.h"
/**
 * Compute the Allen-Cahn interface term with the weak form residual
 * \f$ \left(\nabla (L \psi), 1/2 {\partial \kappa} \over {\partial \nabla \eta_{\alpha i}}
 * \sum \{(\nabla \eta_{\beta j})^2 \} \right) \f$
 */
class ACInterface2DMultiPhase1 : public ACInterface
{
public:
  static InputParameters validParams();
  ACInterface2DMultiPhase1(const InputParameters & parameters);
protected:
  virtual Real computeQpResidual();
  virtual Real computeQpJacobian();
  virtual Real computeQpOffDiagJacobian(unsigned int jvar);
  Real sumSquareGradEta();
  /// Interfacial parameter
  const MaterialProperty<RealGradient> & _dkappadgrad_etaa;
  const MaterialProperty<RealTensorValue> & _d2kappadgrad_etaa;
  /// Order parameters
  unsigned int _num_etas;
  std::vector<const VariableValue *> _eta;
  std::vector<const VariableGradient *> _grad_eta;
};
(modules/phase_field/include/kernels/ACInterface2DMultiPhase2.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "Kernel.h"
#include "JvarMapInterface.h"
#include "DerivativeMaterialInterface.h"
#include "ACInterface.h"
/**
 * Compute the Allen-Cahn interface term with the weak form residual
 * \f$ \left( \kappa \nabla \eta_{\alpha i}, \nabla (L \psi) \right) \f$
 * It is assumed kappa is a function of gradients of two order parameters eta_alpha and eta_beta.
 * Therefore, kappa depends on multiple order parameters.
 */
class ACInterface2DMultiPhase2 : public ACInterface
{
public:
  static InputParameters validParams();
  ACInterface2DMultiPhase2(const InputParameters & parameters);
protected:
  virtual Real computeQpJacobian();
  virtual Real computeQpOffDiagJacobian(unsigned int jvar);
  /// Interfacial parameter
  const MaterialProperty<RealGradient> & _dkappadgrad_etaa;
};
(modules/phase_field/include/kernels/ACInterfaceChangedVariable.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
/// Considers cleavage plane anisotropy in the crack propagation
#pragma once
#include "ACInterface.h"
class ACInterfaceChangedVariable : public ACInterface
{
public:
  static InputParameters validParams();
  ACInterfaceChangedVariable(const InputParameters & parameters);
  virtual void initialSetup();
protected:
  virtual Real computeQpResidual();
  virtual Real computeQpJacobian();
  /// Order parameter derivative
  const MaterialProperty<Real> & _dopdu;
  /// 2nd order parameter derivative
  const MaterialProperty<Real> & _d2opdu2;
};
(modules/phase_field/include/kernels/ACInterfaceCleavageFracture.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
/// Considers cleavage plane anisotropy in the crack propagation
#pragma once
#include "ACInterface.h"
class ACInterfaceCleavageFracture : public ACInterface
{
public:
  static InputParameters validParams();
  ACInterfaceCleavageFracture(const InputParameters & parameters);
protected:
  virtual Real computeQpResidual();
  virtual Real computeQpJacobian();
  /// term with beta penalty
  Real betaNablaPsi();
  /// penalty for damage on planes not normal to the weak (favoured) cleavage
  /// plane (Clayton & Knap, 2015)
  const Real _beta_penalty;
  /// Plane normal to the weak cleavage plane: M in (Clayton & Knap, 2015)
  const RealVectorValue _cleavage_plane_normal;
};