@@ -70,7 +70,8 @@ subroutine do_history_info(s, write_flag, ierr)
7070 num_extra_cols, num_binary_cols, num_extra_binary_cols, num_colors_cols,num_extra_header_items, n
7171 integer , parameter :: num_epsnuc_out = 12
7272 real (dp) :: &
73- epsnuc_out(num_epsnuc_out), csound_surf, v_surf, envelope_fraction_left
73+ epsnuc_out(num_epsnuc_out), csound_surf, v_surf, envelope_fraction_left, m_div_h, &
74+ min_m_div_h, max_m_div_h
7475 integer :: mixing_regions, mix_relr_regions, burning_regions, burn_relr_regions
7576 integer , pointer :: mixing_type(:), mix_relr_type(:), burning_type(:), burn_relr_type(:)
7677 character (len = maxlen_history_column_name), pointer , dimension (:) :: &
@@ -268,9 +269,28 @@ subroutine do_history_info(s, write_flag, ierr)
268269 colors_col_names(1 :num_colors_cols) = ' unknown'
269270 colors_col_vals(1 :num_colors_cols) = - 1d99
270271
271- call data_for_colors_history_columns(s% T(1 ), safe_log10(s% grav(1 )), s% R(1 ), s% kap_rq% Zbase, &
272- s% model_number, s% colors_handle, num_colors_cols, colors_col_names, colors_col_vals, ierr)
272+ ! Here we compute [Fe/H], and thencall colors to compute history columns.
273+ if (colors_settings% z_over_x_ref <= 0d0 ) then
274+ write (* , * ) ' colors error: z_over_x_ref must be positive'
275+ ierr = - 1
276+ call dealloc
277+ return
278+ end if
279+
280+ min_m_div_h = minval (colors_settings% lu_meta)
281+ max_m_div_h = maxval (colors_settings% lu_meta)
282+
283+ ! Map the current photospheric Z/X onto the atmosphere table metallicity axis.
284+ if (s% X(s% photosphere_cell_k) > 0d0 .and. s% Z(s% photosphere_cell_k) > 0d0 ) then
285+ m_div_h = log10 ((s% Z(s% photosphere_cell_k)/ s% X(s% photosphere_cell_k)) / &
286+ colors_settings% z_over_x_ref)
287+ m_div_h = max (min_m_div_h, min (max_m_div_h, m_div_h))
288+ else
289+ m_div_h = min_m_div_h
290+ end if
273291
292+ call data_for_colors_history_columns(s% T(1 ), log10 (s% grav(1 )), s% R(1 ), m_div_h, &
293+ s% colors_handle, num_colors_cols, colors_col_names, colors_col_vals, ierr)
274294 if (ierr /= 0 ) then
275295 call dealloc
276296 return
0 commit comments