! star_1M_thermohaline

&star_job
      show_log_description_at_start = .false.

      load_saved_model = .true.
      saved_model_name = 'thermohaline.mod'
!      saved_model_name = 'test.bin'
!      saved_model_name = 'test.mod'

      save_model_when_terminate = .true.
      save_model_filename = 'final.mod'

!      save_model_number = 151
!      save_model_filename = 'test.bin'
      
      write_profile_when_terminate = .true.
      filename_for_profile_when_terminate = 'final_profile.data'

      eos_file_prefix = 'mesa'
      kappa_file_prefix = 'gs98'
               
!      change_v_flag = .true.
!      new_v_flag = .true.
               
!      change_rotation_flag = .true.
!      new_rotation_flag = .false.
      
!      set_initial_surface_rotation_v = .true.
!      new_surface_rotation_v = 10 ! km/sec    for 1.0 M
      
      change_lnPgas_flag = .true.
      new_lnPgas_flag = .true.

      !pgstar_flag = .true.


/ ! end of star_job namelist


&controls

         ! check for retries and backups as part of test_suite
         ! you can/should delete this for use outside of test_suite
            max_number_backups = 50
            max_number_retries = 100
            max_model_number = 2001

         initial_mass = 1.0
         initial_z = 2d-2

         ! to match Cantiello & Langer
         RGB_wind_scheme = ''
         AGB_wind_scheme = 'de Jager'
         RGB_to_AGB_wind_switch = 1d-4
         de_Jager_wind_eta = 1

         mixing_D_limit_for_log = 1d4
         
         he_core_mass_limit = 0.24d0
         
      
         use_Ledoux_criterion = .true.
         alpha_semiconvection = 4d-2
                  
         thermohaline_coeff = 2  
         thermohaline_option = 'Kippenhahn'

         dX_mix_dist_limit = 1d-4 
         
         omega_function_weight = 20
         
         iter_for_resid_tol2 = 4
         iter_for_resid_tol3 = 7 

         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

         mdot_omega_power = 0.43

         clip_D_limit = 10 ! zero mixing diffusion coeffs that are smaller than this
         
         xa_scale = 1d-5
         newton_itermin = 2

         tol_correction_norm_alt = 1d-3
         tol_max_correction_alt = 1d0

         mass_change_full_on_dt = 1d7 ! (seconds)
         mass_change_full_off_dt = 1d6 ! (seconds)

         mixing_length_alpha = 1.6
         
         !min_timestep_limit = 1d-12 ! (seconds)

         photostep = 50
         profile_interval = 50
         history_interval = 1
         terminal_interval = 10
         write_header_frequency = 10

         T_mix_limit = 1d4



      ! FOR DEBUGGING

      !report_hydro_solver_progress = .true. ! set true to see info about newton iterations
      !report_ierr = .true. ! if true, produce terminal output when have some internal error
      !hydro_show_correction_info = .true.
      
      !max_years_for_timestep = 3.67628942044319d-05

      !report_why_dt_limits = .true.
      !report_all_dt_limits = .true.
      
      !show_mesh_changes = .true.
      !mesh_dump_call_number = 5189
      !okay_to_remesh = .false.
      
      !trace_evolve = .true.
            

      ! hydro debugging
      !hydro_check_everything = .true.
      !hydro_inspectB_flag = .true.
      
      !hydro_numerical_jacobian = .true.
      !hydro_save_numjac_plot_data = .true.
      !small_mtx_decsol = 'lapack'
      !large_mtx_decsol = 'lapack'
      !hydro_dump_call_number = 195

      !trace_newton_bcyclic_solve_input = .true. ! input is "B" j k iter B(j,k)
      !trace_newton_bcyclic_solve_output = .true. ! output is "X" j k iter X(j,k)
      
      trace_newton_bcyclic_steplo = 2 ! 1st model number to trace
      trace_newton_bcyclic_stephi = 2 ! last model number to trace
      
      trace_newton_bcyclic_iterlo = 0 ! 1st newton iter to trace
      trace_newton_bcyclic_iterhi = 20 ! last newton iter to trace
      
      trace_newton_bcyclic_nzlo = 1 ! 1st cell to trace
      trace_newton_bcyclic_nzhi = 10000 ! last cell to trace; if < 0, then use nz as nzhi
      
      trace_newton_bcyclic_jlo = 1 ! 1st var to trace
      trace_newton_bcyclic_jhi = 100 ! last var to trace; if < 0, then use nvar as jhi
      
      !trace_k = 1284

/ ! end of controls namelist



&pgstar
         
         
!pause = .true.
         pgstar_grid_title_scale = 1.2
         pgstar_grid_title_disp = 2

      Grid3_win_flag = .true.
         
         
         Grid3_win_width = 12
         Grid3_win_aspect_ratio = 0.7 ! aspect_ratio = height/width
         
         Grid3_xleft = 0.10 ! fraction of full window width for margin on left
         Grid3_xright = 0.89 ! fraction of full window width for margin on right
         Grid3_ybot = 0.08 ! fraction of full window width for margin on bottom
         Grid3_ytop = 0.92 ! fraction of full window width for margin on top
         Grid3_title = 'Mixing'

         Grid3_num_cols = 2 ! divide plotting region into this many equal width cols
         Grid3_num_rows = 4 ! divide plotting region into this many equal height rows
         Grid3_num_plots = 4 ! <= 10
         
         Grid3_plot_name(1) = 'Mixing'

         Mixing_xmin = 0.22 ! only used if /= -101d0
         Mixing_xmax = 0.28 ! only used if /= -101d0
         
         Mixing_ymin = -101d0 ! only used if /= -101d0
         Mixing_ymax = -101d0 ! only used if /= -101d0        
         Mixing_dymin = -101d0 ! only used if /= -101d0
         
         
         Grid3_plot_row(1) = 3 ! number from 1 at top
         Grid3_plot_rowspan(1) = 2 ! plot spans this number of rows
         Grid3_plot_col(1) =  2 ! number from 1 at left
         Grid3_plot_colspan(1) = 1 ! plot spans this number of columns 
         Grid3_plot_pad_left(1) = 0.08 ! fraction of full window width for padding on left
         Grid3_plot_pad_right(1) = 0.00 ! fraction of full window width for padding on right
         Grid3_plot_pad_top(1) = 0.08 ! fraction of full window height for padding at top
         Grid3_plot_pad_bot(1) = 0.00 ! fraction of full window height for padding at bottom
         Grid3_txt_scale_factor(1) = 0.7 ! multiply txt_scale for subplot by this
         
         
         
         Grid3_plot_name(3) = 'TRho_Profile'
         Grid3_plot_row(3) = 1 ! number from 1 at top
         Grid3_plot_rowspan(3) = 2 ! plot spans this number of rows
         Grid3_plot_col(3) =  2 ! number from 1 at left
         Grid3_plot_colspan(3) = 1 ! plot spans this number of columns 
         Grid3_plot_pad_left(3) = 0.08 ! fraction of full window width for padding on left
         Grid3_plot_pad_right(3) = 0.00 ! fraction of full window width for padding on right
         Grid3_plot_pad_top(3) = 0.00 ! fraction of full window height for padding at top
         Grid3_plot_pad_bot(3) = 0.08 ! fraction of full window height for padding at bottom
         Grid3_txt_scale_factor(3) = 0.7 ! multiply txt_scale for subplot by this

         
         
         
         Grid3_plot_name(2) = 'History_Panels1'
         
         History_Panels1_title = 'History'      

         History_Panels1_num_panels = 2
         History_Panels1_yaxis_name(1) = 'log_center_T' 
         History_Panels1_other_yaxis_name(1) = 'log_L' 
         History_Panels1_yaxis_name(2) = 'log_center_Rho' 
         History_Panels1_other_yaxis_name(2) = 'log_Teff' 
         
         Grid3_plot_row(2) = 3 ! number from 1 at top
         Grid3_plot_rowspan(2) = 2 ! plot spans this number of rows
         Grid3_plot_col(2) =  1 ! number from 1 at left
         Grid3_plot_colspan(2) = 1 ! plot spans this number of columns 
         Grid3_plot_pad_left(2) = 0.00 ! fraction of full window width for padding on left
         Grid3_plot_pad_right(2) = 0.08 ! fraction of full window width for padding on right
         Grid3_plot_pad_top(2) = 0.08 ! fraction of full window height for padding at top
         Grid3_plot_pad_bot(2) = 0.00 ! fraction of full window height for padding at bottom
         Grid3_txt_scale_factor(2) = 0.7 ! multiply txt_scale for subplot by this
         
         
         Grid3_plot_name(4) = 'Kipp'
         
         Kipp_show_mass_boundaries = .false.
         Kipp_mass_max = 0.28 ! (Msun units) negative means use default
         Kipp_mass_min = 0.22 ! (Msun units) negative means use default

         Kipp_show_luminosities = .false.
         Kipp_lgL_max = 2d0 ! only used if /= -101d0; (L in Lsun units)
         Kipp_lgL_min = 1d0 ! only used if /= -101d0; (L in Lsun units)
         
         
         Grid3_plot_row(4) = 1 ! number from 1 at top
         Grid3_plot_rowspan(4) = 2 ! plot spans this number of rows
         Grid3_plot_col(4) =  1 ! number from 1 at left
         Grid3_plot_colspan(4) = 1 ! plot spans this number of columns 
         Grid3_plot_pad_left(4) = 0.00 ! fraction of full window width for padding on left
         Grid3_plot_pad_right(4) = 0.08 ! fraction of full window width for padding on right
         Grid3_plot_pad_top(4) = 0.00 ! fraction of full window height for padding at top
         Grid3_plot_pad_bot(4) = 0.08 ! fraction of full window height for padding at bottom
         Grid3_txt_scale_factor(4) = 0.7 ! multiply txt_scale for subplot by this

         ! file output
         Grid3_file_flag = .false.
         Grid3_file_dir = 'png'
         Grid3_file_prefix = 'grid3_'
         Grid3_file_cnt = 5 ! output when mod(model_number,Grid3_file_cnt)==0
         Grid3_file_width = -1 ! (inches) negative means use same value as for window
         Grid3_file_aspect_ratio = -1 ! negative means use same value as for window


         ! file output
         !Grid3_file_flag = .true.
         Grid3_file_dir = 'png'
         Grid3_file_prefix = 'Mixing_'
         Grid3_file_cnt = 2 ! output when mod(model_number,Grid3_file_cnt)==0

      
/ ! end of pgstar namelist
