Mixed Oxide Fuel Tutorial

[Problem]
  coord_type = RZ
[]

[UserObjects]
  [./pin_geometry]
    type = Layered1DFuelPinGeometry
     include_clad = false
  [../]
[]

[Mesh]
  type = Layered1DMesh
  fuel_height = 0.1
  pellet_outer_radius = 0.00541
  include_clad = false
  pellet_bottom_coor = 0.0
  pellet_mesh_density = customize
  nx_p = 200
  elem_type = EDGE2
  slices_per_block = 1
  include_plenum = false
[]

[Variables]
  [./temp]
    initial_condition = 300
  [../]
  [./pore]
    initial_condition = 0.15
    scaling = 1e14
  [../]
[]

[AuxVariables]
 [./pore_speed_aux]
   order = constant
   family = monomial
 [../]
 [./fission_rate_aux_variable]
   order = first
   family = lagrange
 [../]
 [./fission_rate_aux_variable_mox]
   order = first
   family = lagrange
 [../]
 [./grad_temp_x]
   order = CONSTANT
   family = MONOMIAL
 [../]
 [./thermal_conductivity]
   order = CONSTANT
   family = MONOMIAL
   block = fuel
 [../]
[]

[Functions]
  [./power_history1]
    type = PiecewiseLinear
      x = '0 10000'
      y = '0 50000'
  [../]
  [./fuel_surface_temp]
    type = PiecewiseLinear
    data_file = fuel_surface_temp_bc.csv
    scale_factor = 1
    format = columns
  [../]
[]

[Kernels]

  [./heat]         # gradient term in heat conduction equation
    type = HeatConduction
    variable = temp
  [../]
  [./heat_ie]       # time term in heat conduction equation
    type = HeatConductionTimeDerivative
    variable = temp
  [../]
  [./heat_source]  # source term in heat conduction equation
    type = NeutronHeatSource
    variable = temp
    block = fuel # fission rate applied to the fuel (block 2) only
    fission_rate = fission_rate_aux_variable_mox
  [../]

  [./pore_continuity]
   type = MOXPoreContinuity
   variable = pore
   temperature = temp
   debug = 0
   alpha = 0.25
   beta = 1
   heating_function = power_history1
  [../]
  [./pore_diffusion]
   type = MOXPoreDiffusion
   variable = pore
   debug = 0
#   nu = 3.25e-8 #seems to be THE value to use... result is super sensitive to this number
#   nu = 10e-10
   nu = 1e-12
   heating_function = power_history1
   v_upper = 1e-12
   v_lower = 1e-20
  # v_upper = 1
  # v_lower = 1
#   save_in = saved_p
  [../]
  [./poretimederivative]
   type = CoefTimeDerivative
   variable = pore
   Coefficient = 1
#   save_in = saved_p
   [../]
[]

[AuxKernels]
  [./pore_speed_aux]
    type = MaterialRealAux
    variable = pore_speed_aux
    property = pore_velocity
    block = fuel
    execute_on = 'initial timestep_end'
  [../]
  [./fission_rate_aux_kernel]
    type = FissionRateAuxLWR
    variable = fission_rate_aux_variable
    block = fuel
    rod_ave_lin_pow = power_history1
#    axial_power_profile = axial_peaking_factors     # using the axial power profile function defined above
    pellet_diameter = 0.01082
    pellet_inner_diameter = 0
    energy_per_fission = 3.2e-11
    execute_on = 'initial timestep_end'
    value = 1.0
  [../]
  [./fission_rate_aux_kernel_mox]
    type = FissionRateMOX
    variable = fission_rate_aux_variable_mox
    block = fuel
    porosity = pore
    initial_porosity = 0.15
    rod_ave_lin_pow = power_history1
    pellet_diameter = 0.01082
    pellet_inner_diameter = 0
    energy_per_fission = 3.2e-11
    execute_on = 'initial timestep_end'
    value = 1.0
  [../]
  [./grad_temp_x_aux]
    type = VariableGradientComponent
    variable = grad_temp_x
    component = x
    gradient_variable = temp
    execute_on = 'initial timestep_end'
  [../]
  [./ThermalConductivityAux]
    type = MaterialRealAux
     block = fuel
     execute_on = linear
     property = thermal_conductivity
     variable = thermal_conductivity
   [../]
[]

[BCs]
[./temp_outside] # pin pellets and clad along axis of symmetry (y)
  type = FunctionPresetBC
  variable = temp
  boundary = 10
  function = fuel_surface_temp
[../]
[]

[Materials]
  [./fuel_thermal]
    type = ThermalMAMOX
    block = fuel
    temperature = temp
    porosity = pore
    porosity_limit = 0.95
  [../]
  [./density_block]
    type = GenericConstantMaterial
    block = fuel
    prop_names = density
    prop_values = 10662.0
  [../]
  [./pore_velocity]
   type = MOXPoreVelocity
   block = fuel
   temperature = temp
   limit = 1e-3
#go back to this if necessary   scale_factor = 0.05
   scale_factor = 0.1
  [../]
[]

[Preconditioning]
  [./SMP]
    type = SMP
    full = true
  [../]
[]

[Dampers]
  [./limitT]
    type = MaxIncrement
    max_increment = 100.0
    variable = temp
  [../]
[]

[Executioner]
  type = Transient
  solve_type = 'PJFNK'

  petsc_options = '-snes_ksp_ew'
  #petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'  # -mat_superlu_dist_fact'
  #petsc_options_value = 'lu superlu_dist' # SamePattern_SameRowPerm'
  petsc_options_iname = '-pc_type -sub_pc_type'
  petsc_options_value = 'asm lu'
  line_search = 'none'

  l_max_its = 50
  l_tol = 8e-3
  nl_max_its = 50
  nl_rel_tol = 1e-5
  nl_abs_tol = 1e-6
  end_time = 10000
  dtmax = 100
  dtmin = 0.25

  [./TimeStepper]
    type = IterationAdaptiveDT
    dt = 1e1
    optimal_iterations = 15
    iteration_window = 2
    linear_iteration_ratio = 100
    growth_factor = 2
    cutback_factor = .5
    force_step_every_function_point = true
    timestep_limiting_function = power_history1
  [../]
[]

[Postprocessors]
  [./_dt]                     # time step
    type = TimestepSize
  [../]
  [./z_nonlinear_its]           # number of nonlinear iterations at each timestep
    type = NumNonlinearIterations
  [../]
  [./a_run_time]               # average temperature of cladding interior
    type = PerformanceData
    event = ALIVE
  [../]

  [./ave_fuel_temp]
    type = ElementAverageValue
    block = fuel
    variable = temp
  [../]
  [./max_fuel_temp]
    type = NodalExtremeValue
    block = fuel
    value_type = max
    variable = temp
  [../]

  [./ave_pore]
    type = ElementAverageValue
    block = fuel
    variable = pore
  [../]
  [./max_pore]
    type = NodalExtremeValue
    block = fuel
    value_type = max
    variable = pore
  [../]
  [./min_pore]
    type = NodalExtremeValue
    block = fuel
    value_type = min
    variable = pore
  [../]
  [./max_pore_speed]
    type = ElementExtremeValue
    block = fuel
    value_type = max
    variable = pore_speed_aux
  [../]
  [./ave_fission_rate]
    type = ElementAverageValue
    block = fuel
    variable = fission_rate_aux_variable
  [../]
  [./rod_total_power]
    type = ElementIntegralPower
    variable = temp
    block = fuel
    fission_rate = fission_rate_aux_variable
    fuel_pin_geometry = pin_geometry
  [../]
  [./rod_total_power_mox]
    type = ElementIntegralPower
    variable = temp
    block = fuel
    fission_rate = fission_rate_aux_variable_mox
    fuel_pin_geometry = pin_geometry
  [../]
  [./rod_input_power]
    type = FunctionValuePostprocessor
    function = power_history1
    scale_factor = 0.1 # rod height
  [../]
  [./ave_themal_conductivity]
    type = ElementAverageValue
    block = fuel
    variable = thermal_conductivity
  [../] # end element average burnup
[]

#[VectorPostprocessors]
#  [./line_value_vector_postprocessor_pore]
#    type = LineValueSampler
#    variable = pore
#    start_point = '0.0 0.05 0'
#    end_point = '0.0041 0.05 0'
#    num_points = 100
#    sort_by = x
#    execute_on = linear
#    outputs = stuff_v_rad
#    control_tags = a
#  [../]
#  [./line_value_vector_postprocessor_gradT]
#    type = LineValueSampler
#    variable = grad_temp_x
#    start_point = '0.0 0.05 0'
#    end_point = '0.0041 0.05 0'
#    num_points = 100
#    sort_by = x
#    execute_on = linear
#    outputs = stuff_v_rad
#  [../]
#  [./line_value_vector_postprocessor_pore_speed]
#    type = LineValueSampler
#    variable = pore_speed_aux
#    start_point = '0.0 0.05 0'
#    end_point = '0.0041 0.05 0'
#    num_points = 100
#    sort_by = x
#    execute_on = linear
#    outputs = stuff_v_rad
#  [../]
#  [./line_value_vector_postprocessor_temp]
#    type = LineValueSampler
#    variable = temp
#    start_point = '0.0 0.05 0'
#    end_point = '0.0041 0.05 0'
#    num_points = 100
#    sort_by = x
#    execute_on = linear
#    outputs = stuff_v_rad
#  [../]
#[]

[Outputs]
  exodus = true
  csv = false
  color = false
  [./console]
    type = Console
    perf_log = true
    max_rows = 25
    all_variable_norms = true
  [../]
  #[./stuff_v_rad]
  #  type = CSV
  #  execute_on = 'FINAL'
  #[../]
[]

[Debug]
 show_var_residual_norms = true
[]
(examples/mox_fuel/mox_porosity_demo.i)