Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not guard calls mesa_error() with report_ierr #732

Merged
merged 10 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion star/defaults/controls.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -11216,7 +11216,7 @@
! stop_for_bad_nums
! ~~~~~~~~~~~~~~~~~

! If true and report_ierr is also true, then stop for bad numbers (NaNs or infinity).
! If true, then stop for bad numbers (NaNs or infinity).
! this replaces old control stop_for_NaNs

! ::
Expand Down
1 change: 0 additions & 1 deletion star/private/atm_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ subroutine get_table( &
s% retry_message = 'atm get_table: L < 0'
if (s% report_ierr) then
write(*,2) 'atm get_table: L < 0', s% model_number, L
!call mesa_error(__FILE__,__LINE__)
end if
ierr = -1
return
Expand Down
1 change: 0 additions & 1 deletion star/private/brunt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ subroutine get_brunt_B(s, species, nz, k, T_face, rho_face, chiT_face, chiRho_fa
write(*,2) 'lnP1', k, lnP1
write(*,2) 'lnP2', k, lnP2
write(*,'(A)')
!call mesa_error(__FILE__,__LINE__,'do_brunt_B_MHM_form')
end if
if (s% stop_for_bad_nums) then
write(*,2) 's% brunt_B(k)', k, s% brunt_B(k)
Expand Down
2 changes: 1 addition & 1 deletion star/private/eos_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ subroutine get_eos( &
if(logRho < -25) then
! Provide some hard lower limit on what we would even try to evalue the eos at
! Going to low causes FPE's when we try to evaluate certain derviatives that need (rho**power)
s% retry_message = 'eos evaluted at too low a density'
s% retry_message = 'eos evaluated at too low a density'
ierr = -1
return
end if
Expand Down
3 changes: 1 addition & 2 deletions star/private/eps_grav.f90
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,9 @@ subroutine eval_eps_grav_composition(s, k, eps_grav_composition_term, ierr)
end if

if (is_bad(eps_grav_composition_term% val)) then
if (s% report_ierr) write(*, *) s% retry_message
if (s% report_ierr) then
write(*, *) s% retry_message
write(*,2) 'eps_grav_composition_term', k, eps_grav_composition_term% val
!call mesa_error(__FILE__,__LINE__,'eval_eps_grav_composition')
end if
if (s% stop_for_bad_nums) then
write(*,2) 'include_composition_in_eps_grav -- bad value for eps_grav_composition_term', k, eps_grav_composition_term% val
Expand Down
2 changes: 1 addition & 1 deletion star/private/hydro_vars.f90
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ subroutine get_surf_PT( &
if (L_surf < 0._dp) then
if (s% report_ierr) then
write(*,2) 'get_surf_PT: L_surf <= 0', s% model_number, L_surf
call mesa_error(__FILE__,__LINE__)
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__)
s% retry_message = 'L_surf < 0'
ierr = -1
return
Expand Down
20 changes: 10 additions & 10 deletions star/private/micro.f90
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ subroutine do_eos_for_cell(s,k,ierr)
if (ierr /= 0) then
if (s% report_ierr) then
write(*,*) 'do_eos_for_cell: solve_eos_given_PT ierr', ierr
!call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
return
end if

Expand All @@ -382,9 +382,10 @@ subroutine do_eos_for_cell(s,k,ierr)
s% d_eos_dxa(:,:,k), ierr)
if (ierr /= 0) then
if (s% report_ierr) then
write(*, *) s% retry_message
write(*,*) 'do_eos_for_cell: get_eos ierr', ierr
!call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
return
end if

Expand All @@ -404,7 +405,7 @@ subroutine do_eos_for_cell(s,k,ierr)
s% solver_call_number == s% solver_test_partials_call_number .and. &
s% solver_iter == s% solver_test_partials_iter_number) then
call write_eos_call_info(s,k)
call mesa_error(__FILE__,__LINE__,'do_eos_for_cell: write_eos_call_info')
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_eos_for_cell: write_eos_call_info')
end if

contains
Expand All @@ -423,9 +424,8 @@ subroutine store_stuff(ierr)
if (s% report_ierr) then
call write_eos_call_info(s,k)
write(*,2) 'store_eos_for_cell failed', k
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
return
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_eos_for_cell')
return
end if

Expand Down Expand Up @@ -465,9 +465,9 @@ subroutine store_eos_for_cell(s, k, res, d_dlnd, d_dlnT, d_dxa, ierr)
write(*,2) 'd_dlnT ' // trim(eosDT_result_names(i)), k, d_dlnT(i)
write(*,'(A)')
call write_eos_call_info(s,k)
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'store_eos_for_cell')
!$OMP end critical (micro_crit0)
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'store_eos_for_cell')
return
end if
end do
Expand All @@ -493,7 +493,7 @@ subroutine store_eos_for_cell(s, k, res, d_dlnd, d_dlnT, d_dxa, ierr)
s% grada(k) = res(i_grad_ad)
s% dE_dRho(k) = res(i_dE_drho)
s% Cv(k) = res(i_Cv)
s% cp(k) = res(i_cp)
s% Cp(k) = res(i_Cp)
s% chiRho(k) = res(i_chiRho)
s% chiT(k) = res(i_chiT)
s% gamma1(k) = res(i_gamma1)
Expand Down Expand Up @@ -544,7 +544,7 @@ subroutine store_eos_for_cell(s, k, res, d_dlnd, d_dlnT, d_dxa, ierr)
if (ierr /= 0) then
if (s% report_ierr) then
!$OMP critical (micro_crit1)
write(*,2) 's% cp(k)', k, s% cp(k)
write(*,2) 's% Cp(k)', k, s% Cp(k)
write(*,2) 's% csound(k)', k, s% csound(k)
write(*,2) 's% lnPeos(k)', k, s% lnPeos(k)
write(*,2) 's% gam(k)', k, s% gam(k)
Expand All @@ -558,9 +558,9 @@ subroutine store_eos_for_cell(s, k, res, d_dlnd, d_dlnT, d_dxa, ierr)
write(*,2) 'zbar', k, s% zbar(k)
write(*,*)
call write_eos_call_info(s,k)
call mesa_error(__FILE__,__LINE__,'store_eos_for_cell')
!$OMP end critical (micro_crit1)
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'store_eos_for_cell')
ierr = -1
end if

Expand Down Expand Up @@ -636,9 +636,9 @@ subroutine do_kap_for_cell(s,k,ierr)
write(*,*) 'do_kap_for_cell: get_kap ierr', ierr
!$omp critical (star_kap_get)
call show_stuff()
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_kap_for_cell')
!$omp end critical (star_kap_get)
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do_kap_for_cell')
ierr = -1
return
end if
Expand Down
2 changes: 1 addition & 1 deletion star/private/rsp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ subroutine do1_step(s,ierr)
if (s% dt > max_dt) then
if (s% RSP_report_limit_dt) then
write(*,4) 'limit to RSP_max_dt_times_min_dr_div_cs', s% model_number, max_dt, s% dt
call mesa_error(__FILE__,__LINE__,'do1_step 1')
end if
if (s% stop_for_bad_nums) call mesa_error(__FILE__,__LINE__,'do1_step 1')
s% dt = max_dt
end if

Expand Down
2 changes: 1 addition & 1 deletion star/private/rsp_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ subroutine HYD(s,ierr)
write(*,2) 'old dt', s% model_number, s% dt
write(*,2) 'reduced dt', s% model_number, dt_max
write(*,'(A)')
call mesa_error(__FILE__,__LINE__,'HYD compressing innermost cell')
end if
call mesa_error(__FILE__,__LINE__,'HYD compressing innermost cell')
s% dt = dt_max
if (call_is_bad) then
if (is_bad(s% dt)) then
Expand Down
14 changes: 7 additions & 7 deletions star/private/star_profile_def.f90
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ module star_profile_def
integer, parameter :: p_grada = p_logE + 1
integer, parameter :: p_dE_dRho = p_grada + 1
integer, parameter :: p_Cv = p_dE_dRho + 1
integer, parameter :: p_cp = p_Cv + 1
integer, parameter :: p_thermal_time_to_surface = p_cp + 1
integer, parameter :: p_Cp = p_Cv + 1
integer, parameter :: p_thermal_time_to_surface = p_Cp + 1
integer, parameter :: p_log_thermal_time_to_surface = p_thermal_time_to_surface + 1
integer, parameter :: p_log_CpT = p_log_thermal_time_to_surface + 1
integer, parameter :: p_log_CpT_absMdot_div_L = p_log_CpT + 1
Expand Down Expand Up @@ -505,8 +505,8 @@ module star_profile_def
integer, parameter :: p_mixing_type = p_mix_type + 1

integer, parameter :: p_log_mlt_D_mix = p_mixing_type + 1
integer, parameter :: p_log_cp_T_div_t_sound = p_log_mlt_D_mix + 1
integer, parameter :: p_log_t_thermal = p_log_cp_T_div_t_sound + 1
integer, parameter :: p_log_Cp_T_div_t_sound = p_log_mlt_D_mix + 1
integer, parameter :: p_log_t_thermal = p_log_Cp_T_div_t_sound + 1
integer, parameter :: p_log_t_sound = p_log_t_thermal + 1
integer, parameter :: p_pressure_scale_height_cm = p_log_t_sound + 1
integer, parameter :: p_pressure_scale_height = p_pressure_scale_height_cm + 1
Expand Down Expand Up @@ -904,10 +904,10 @@ subroutine profile_column_names_init(ierr)
profile_column_name(p_logE) = 'logE'
profile_column_name(p_grada) = 'grada'
profile_column_name(p_dE_dRho) = 'dE_dRho'
profile_column_name(p_cv) = 'cv'
profile_column_name(p_Cv) = 'cv'
profile_column_name(p_thermal_time_to_surface) = 'thermal_time_to_surface'
profile_column_name(p_log_thermal_time_to_surface) = 'log_thermal_time_to_surface'
profile_column_name(p_cp) = 'cp'
profile_column_name(p_Cp) = 'cp'
profile_column_name(p_log_CpT) = 'log_CpT'
profile_column_name(p_log_CpT_absMdot_div_L) = 'log_CpT_absMdot_div_L'
profile_column_name(p_logS) = 'logS'
Expand Down Expand Up @@ -1191,7 +1191,7 @@ subroutine profile_column_names_init(ierr)
profile_column_name(p_mix_type) = 'mix_type'
profile_column_name(p_mixing_type) = 'mixing_type'
profile_column_name(p_log_mlt_D_mix) = 'log_mlt_D_mix'
profile_column_name(p_log_cp_T_div_t_sound) = 'log_cp_T_div_t_sound'
profile_column_name(p_log_Cp_T_div_t_sound) = 'log_cp_T_div_t_sound'
profile_column_name(p_log_t_thermal) = 'log_t_thermal'
profile_column_name(p_log_t_sound) = 'log_t_sound'
profile_column_name(p_pressure_scale_height_cm) = 'pressure_scale_height_cm'
Expand Down
1 change: 0 additions & 1 deletion star/private/struct_burn_mix.f90
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,6 @@ integer function do_burn(s, dt)
do_burn = retry
if (trace .or. s% report_ierr) then
write(*,*) 'do_burn ierr'
!call mesa_error(__FILE__,__LINE__,'do_burn')
end if
call restore
return
Expand Down
6 changes: 3 additions & 3 deletions star/private/timestep.f90
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ integer function do_timestep_limits(s, dt)
write(*,2) 's% dt', s% model_number, s% dt
write(*,2) 'max_timestep_factor', s% model_number, max_timestep_factor
write(*,2) 's% dt_next', s% model_number, s% dt_next
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
end if
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
if (i_limit == Tlim_struc) i_limit = Tlim_max_timestep_factor
end if

Expand All @@ -363,8 +363,8 @@ integer function do_timestep_limits(s, dt)
write(*,2) 's% dt', s% model_number, s% dt
write(*,2) 'min_timestep_factor', s% model_number, s% min_timestep_factor
write(*,2) 's% dt_next', s% model_number, s% dt_next
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
end if
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
if (i_limit == Tlim_struc) i_limit = Tlim_min_timestep_factor
end if

Expand Down Expand Up @@ -2430,8 +2430,8 @@ subroutine filter_dt_next(s, order, dt_limit_ratio_in)
write(*,2) 'dt_limit_ratio_target', s% model_number, dt_limit_ratio_target
write(*,2) 'dt_limit_ratio', s% model_number, dt_limit_ratio
write(*,2) 'filter_dt_next', s% model_number, s% dt_next
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
end if
if (s% dt_next == 0d0) call mesa_error(__FILE__,__LINE__,'filter_dt_next')
end if


Expand Down
Loading