! the contents of this are set to match the needs of pre_ms_to_cc_12_20
! so local inlist_common files show differences from what is used for that case.

&star_job
      show_log_description_at_start = .false.

      change_net = .true.
      new_net_name = 'approx21_cr60_plus_co56.net'
      dump_missing_metals_into_heaviest = .false.

       
      ! if using rotation
      change_D_omega_flag = .true.
      new_D_omega_flag = .false.
      
      ! turn on hydrodynamics
      change_v_flag = .true.
      new_v_flag = .false.


      ! If using a big network, comment out and used a local rate_tables directory
      num_special_rate_factors = 2
      reaction_for_special_factor(1) = 'r_c12_ag_o16'
      special_rate_factor(1) = 1
      filename_of_special_rate(1) = 'c12ag_deboer_sigma_0p0_2000_Tgrid.dat'

      reaction_for_special_factor(2) = 'r_he4_he4_he4_to_c12'
      special_rate_factor(2) = 1
      filename_of_special_rate(2) = 'r_he4_he4_he4_to_c12_cf88.txt'

      show_retry_counts_when_terminate = .true.
      show_timestep_limit_counts_when_terminate = .true.

      ! pgstar is recommended for diagnosing issues and understanding the evolution
      pgstar_flag = .true.
      save_pgstar_files_when_terminate = .false.
      pause_before_terminate = .true.

/ ! end of star_job namelist

&eos      
      use_Skye = .true.
      use_PC = .false.
/ ! end of eos namelist

&kap      
      ! OPAL asplund 2009 opacities, Zbase set in inlist_mass_Z_wind_rotation
      kap_file_prefix = 'a09'    ! 'gs98' 'a09'  'OP_a09' 'OP_gs98'
      kap_CO_prefix   = 'a09_co' ! 'gs98_co' 'a09_co'
      kap_lowT_prefix = 'lowT_fa05_a09p'
      use_Type2_opacities = .true.
      
/ ! end of kap namelist

&controls

! wind
      ! Dutch scaling factor set in inlist_mass_Z_wind_rotation      
      cool_wind_full_on_T = 0.8d4
      hot_wind_full_on_T = 1.2d4
      cool_wind_RGB_scheme = 'Dutch'
      cool_wind_AGB_scheme = 'Dutch'
      hot_wind_scheme = 'Dutch'
      Dutch_wind_lowT_scheme = 'de Jager'

      max_T_center_for_any_mass_loss = 1.1d9

! atmosphere
      Pextra_factor = 2 ! easy to lower with mass loss!ideally 1.5 is most physical
      ! if you run into issues, you can increase Pextra 
      ! extra pressure helps stabilize the atmosphere during core He burning +
     

      atm_option = 'T_tau'
      atm_T_tau_relation = 'Eddington'
      atm_T_tau_opacity = 'fixed' ! next best is 'iterated'

! rotation
      am_nu_visc_factor = 0
      am_D_mix_factor = 0.0333333333333333d00
      D_DSI_factor = 0
      D_SH_factor = 1
      D_SSI_factor = 1
      D_ES_factor = 1
      D_GSF_factor = 1
      D_ST_factor = 1

! mlt
      mixing_length_alpha = 1.5
      MLT_option = 'TDC'

      ! If you would like to be bold, try radiative damping, although it
      ! is a departure from the mlt limit of 'TDC'
      alpha_TDC_DAMPR = 0d0 ! 0d0 is default for mlt limit




      use_Ledoux_criterion = .true.
      semiconvection_option = 'Langer_85 mixing; gradT = gradr'
      thermohaline_option = 'Kippenhahn'

      alpha_semiconvection = 1d-2
      thermohaline_coeff = 0

      mlt_make_surface_no_mixing = .true.

      

! superadiabatic convection routines, it's a choice:
      
      ! superadiabatic reduction, implicit, new
      use_superad_reduction = .false.
      superad_reduction_Gamma_limit = 0.3d0 ! default is 0.5d0
      superad_reduction_Gamma_limit_scale = 5d0
      superad_reduction_Gamma_inv_scale = 5d0
      superad_reduction_diff_grads_limit = 1d-2 ! default is 1d-3
      superad_reduction_limit = -1d0


      ! MLT ++, explicit, well tested
      okay_to_reduce_gradT_excess = .false.
      gradT_excess_f1 = 1d-4
      gradT_excess_f2 = 1d-2
      gradT_excess_lambda1 = -1d0 ! full on

! mixing
      D_omega_mixing_rate = 1d0
      D_omega_mixing_across_convection_boundary = .false.



  ! we use step overshooting in H core
      overshoot_scheme(1) = 'step'
      overshoot_zone_type(1) = 'burn_H'
      overshoot_zone_loc(1) = 'core'
      overshoot_bdy_loc(1) = 'top'
      overshoot_f(1) = 0.345 ! for M>10
      !overshoot_f(1) = 0.21 ! For M<10 
      overshoot_f0(1) = 0.01

  ! exponential in the H core
      overshoot_scheme(2) = 'exponential'
      overshoot_zone_type(2) = 'burn_He'
      overshoot_zone_loc(2) = 'core'
      overshoot_bdy_loc(2) = 'top'
      overshoot_f(2) = 0.01
      overshoot_f0(2) = 0.005

     ! we don't want to deal with He/CO core mergers 
     ! and there is reason to believe there is little
     ! inward overshooting in the shell across compositions boundaries
      overshoot_scheme(3) = 'none'
      overshoot_zone_type(3) = 'burn_He'
      overshoot_zone_loc(3) = 'shell'
      overshoot_bdy_loc(3) = 'bottom'

   ! a small amount of overshooting on top of any other convective core
   ! avoid spurious numerical behavior
   ! perfect amount for degenerate flames
      overshoot_scheme(4) = 'exponential'
      overshoot_zone_type(4) = 'any'
      overshoot_zone_loc(4) = 'any'
      overshoot_bdy_loc(4) = 'any'
      overshoot_f(4) = 0.005d0
      overshoot_f0(4) = 0.001d0


! timesteps
      time_delta_coeff = 1.0
      varcontrol_target   = 1d-3
      
      ! min_timestep_factor = 0.8d0
      ! max_timestep_factor = 1.05d0
      ! timestep_factor_for_retries = 0.75
      
      limit_for_rel_error_in_energy_conservation = 1d-7
      hard_limit_for_rel_error_in_energy_conservation = 1d-6      
      
      never_skip_hard_limits = .true.
      min_xa_hard_limit = -1d-5
      min_xa_hard_limit_for_highT = -3d-5

      delta_lgTeff_limit =  0.01
      delta_lgL_limit = 0.1     
      delta_lgL_He_limit = 0.1


      ! Recommend decreasing all three Rho, T, Tmax 
      ! to 1d-3 or lower in production runs
      delta_lgRho_cntr_limit = 0.03
      delta_lgRho_cntr_hard_limit = 0.1
      delta_lgRho_limit = 0.1 
      
      delta_lgT_cntr_limit_only_after_near_zams = .true.
      delta_lgT_cntr_limit = 0.002  
      delta_lgT_cntr_hard_limit = 0.1 

      delta_lgT_max_limit_only_after_near_zams = .true.
      delta_lgT_max_limit = 0.002     
      delta_lgT_max_hard_limit = 0.1

      dX_div_X_limit(2) = -1 ! for he4

      ! On the changes in total abundance of each isotope
      ! one of the most useful timestep controls, period 
      dX_nuc_drop_limit = 2d-2 ! Recommend decreasing to 1d-3 or lower in a production run
      dX_nuc_drop_limit_at_high_T = 2d-2  ! default = -1 = same as dX_nuc_drop_limit
      dX_nuc_drop_min_X_limit = 1d-3 ! try decreasing to 1d-4 or 1d-5 in a production run
      dX_nuc_drop_max_A_limit = 70   ! try increasing beyond 60 in a big network run
      dX_nuc_drop_hard_limit = 1d99

     
    !  delta_XHe_cntr_limit = 0.01d0
    !  delta_XHe_cntr_hard_limit = 0.1d0
    !  delta_lg_XH_cntr_limit = -1
    !  delta_lg_XHe_cntr_limit = -1
    !  delta_lg_XC_cntr_limit = -1
    !  delta_lg_XNe_cntr_limit = -1
    !  delta_lg_XO_cntr_limit = -1
    !  delta_lg_XSi_cntr_limit = -1
    !  delta_XC_cntr_limit = -1
    !  delta_XC_cntr_hard_limit = -1
    !  delta_XNe_cntr_limit = -1
    !  delta_XNe_cntr_hard_limit = -1
    !  delta_XO_cntr_limit = -1
    !  delta_XO_cntr_hard_limit = -1
    !  delta_XSi_cntr_limit = -1
    !  delta_XSi_cntr_hard_limit = -1



      delta_lg_XH_cntr_limit = 0.01d0
      delta_lg_XH_cntr_max   = 0.0d0
      delta_lg_XH_cntr_min   = -2.0d0
      !delta_lg_XH_cntr_hard_limit = 0.02d0
      
      delta_lg_XHe_cntr_limit = 0.01d0
      delta_lg_XHe_cntr_max   = 0.0d0
      delta_lg_XHe_cntr_min   = -2.0d0
      !delta_lg_XHe_cntr_hard_limit = -1!0.02d0
      
! time step controls below are useful for resolution on fuel depletion
      !delta_lg_XC_cntr_limit = 0.01d0
      !delta_lg_XC_cntr_max   = 0.0d0
      !delta_lg_XC_cntr_min   = -2.0d0
      !delta_lg_XC_cntr_hard_limit = -1!0.2d0
      
      !delta_lg_XNe_cntr_limit = 0.01d0  
      !delta_lg_XNe_cntr_max   = 0.0d0
      !delta_lg_XNe_cntr_min   = -2.0d0
      !delta_lg_XNe_cntr_hard_limit = 0.02 !0.1d0!0.02d0 can crash run
      !delta_XNe_cntr_limit = 0.01

      !delta_lg_XO_cntr_limit = 0.01d0  
      !delta_lg_XO_cntr_max   = 0.0d0
      !delta_lg_XO_cntr_min   = -2.0d0
      !delta_lg_XO_cntr_hard_limit = -1 !0.1d0!0.02d0 can crash run
      
      delta_XSi_cntr_limit = 0.01
      delta_XSi_cntr_hard_limit = -1!0.02

      !delta_lg_XSi_cntr_limit = 0.01d0  
      !delta_lg_XSi_cntr_max   = 0.0d0
      !delta_lg_XSi_cntr_min   = -2.0d0
      !delta_lg_XSi_cntr_hard_limit = -1 !0.1d0!0.02d0 can crash run

      !dX_limit_species(3) = 'fe56'
      !dX_limit(3) = 0.1
      !dX_div_X_limit_min_X(3) = 1d-5
      !dX_div_X_limit(3) = 0.5d0

      delta_Ye_highT_limit = 1d-3


! mesh
      !max_dq= 1d-3 ! or lower
      mesh_delta_coeff = 2.5 ! try 1.0 or below in production run
      mesh_delta_coeff_for_highT = 1.5 ! try 1.0 or below in production run
      logT_max_for_standard_mesh_delta_coeff = 9.0 
      logT_min_for_highT_mesh_delta_coeff = 9.5 
      !min_dq_for_xa = 1d-4 ! avoid over-resolving composition changes, bad for bit for bit convergence
      !remesh_dt_limit = 1728000 ! 20 days. turn off remesh when dt smaller than this

! solver

      ! damped newton and structure only
       scale_max_correction = 0.1d0
       ignore_species_in_max_correction = .true.

      ! might help to turn off gold2 in 8-10 Msun degenerate cores
      ! for O-Ne flames.
      use_gold2_tolerances = .true. 
      gold2_tol_max_residual2 = 5d-7
      gold2_tol_max_residual3 = 5d-4


      use_gold_tolerances = .true.
      gold_tol_max_residual2 = 5d-4
      !gold_tol_max_residual3 = 1d-4 ! Default in controls is 1d-5
      tol_correction_high_T_limit = 1d9 ! Switch to lower tol at high temp for large Mass
      solver_iters_timestep_limit = 20
      gold_solver_iters_timestep_limit = 20
      iter_for_resid_tol2 = 10

      max_abs_rel_run_E_err = 1d-2

      energy_eqn_option = 'dedt'
      max_tries_for_implicit_wind = 0 ! Recommend 10 for a production run     

      convergence_ignore_equL_residuals = .true. 
      make_gradr_sticky_in_solver_iters = .true.
      xa_scale = 1d-5
      iter_for_resid_tol2 = 10
      min_timestep_limit = 1d-12 ! (seconds) ! 1d-20 if things are sticky

      warn_rates_for_high_temp = .true.
      max_safe_logT_for_rates = 10.5d0

      ! when_to_stop_rtol = 1d-3
      ! when_to_stop_atol = 1d-3

      sig_min_factor_for_high_Tcenter = 0.01
      Tcenter_min_for_sig_min_factor_full_on = 3.2d9
      Tcenter_max_for_sig_min_factor_full_off = 2.8d9
     
      ! Can be helpful to decrease op_split_burn_min_T 
      ! 4d9 has been well tested with the approx21 network
      ! lower to 2.5d9 or worst case 1d9 for large networks to help with
      ! numerical stability and speed, see MESA VI (Jermyn 2023) 
      op_split_burn = .true.
      op_split_burn_min_T = 4d9 
      burn_steps_limit = 150
      burn_steps_hard_limit = 250
      op_split_burn_eps = 1d-5
      op_split_burn_odescal = 1d-5

! output
      terminal_show_log_dt = .false.

       !max_model_number = 4000000 ! if you're serious

       photo_interval         = 200 !1000
       photo_digits           = 8
       profile_interval       = 10 
       max_num_profile_models = 400000
       history_interval       = 1
       write_header_frequency = 10
       terminal_interval      = 1

      !report_solver_progress = .true. ! set true to see info about solver iterations
      !report_ierr = .true. ! if true, produce terminal output when have some internal error







/
&pgstar


/ ! end of pgstar namelist
