Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ conserving total angular momentum. See
Bug Fixes
---------

Incomplete split burns now trigger a stellar retry when they reach
``burn_steps_hard_limit``.

Fixed ``switch_to_radiative`` zeroing saved ``mlt_vc`` during TDC photo
restarts and preparation for a new step. Mixing cleanup now preserves
the velocity until it has been copied to ``mlt_vc_old``.
Expand Down
6 changes: 3 additions & 3 deletions net/private/net_burn_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ subroutine netint( &
end if

! this is the normal exit point
if ( (nstp == max_steps) .or. &
(x-stopp)*(stopp-start)>= 0.0d0) then
if ((x-stopp)*(stopp-start)>= 0.0d0) then
call burner_finish_substep(nstp, x, y, ierr)
return
end if
Expand Down Expand Up @@ -178,6 +177,8 @@ subroutine netint( &

! back for another iteration or death
end do

! if we made it here, we took too many steps
ierr = -1
return
call mesa_error(__FILE__,__LINE__,'more than max_steps steps required in netint')
Expand Down Expand Up @@ -638,4 +639,3 @@ end subroutine net_pzextr


end module net_burn_support

46 changes: 13 additions & 33 deletions star/private/struct_burn_mix.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ integer function do_struct_burn_mix(s, skip_global_corr_coeff_limit)
end do
if (s% trace_evolve) write(*,*) 'call do_burn'
do_struct_burn_mix = do_burn(s, dt)
if (do_struct_burn_mix /= keep_going) then
write(*,2) 'failed in do_burn', s% model_number
call mesa_error(__FILE__,__LINE__,'do_struct_burn_mix')
return
end if
if (do_struct_burn_mix /= keep_going) return
do_struct_burn_mix = retry
call set_vars_if_needed(s, s% dt, 'after do_burn', ierr)
if (ierr /= 0) return
do k=1,s% nz
Expand Down Expand Up @@ -826,8 +823,8 @@ integer function do_burn(s, dt)
real(dp), intent(in) :: dt

integer :: &
k_bad, ierr, max_num_iters_k, nz, op_err, &
k, num_iters, species, max_num_iters_used, &
k_bad, ierr, nz, op_err, &
k, num_iters, species, &
screening_mode, kmin
integer(i8) :: time0
real(dp) :: total, avg_epsnuc, min_T_for_const_density_solver
Expand Down Expand Up @@ -857,8 +854,6 @@ integer function do_burn(s, dt)

if (dt <= 0d0) return

max_num_iters_used = 0
max_num_iters_k = 0
k_bad = 0

screening_mode = get_screening_mode(s,ierr)
Expand Down Expand Up @@ -894,7 +889,9 @@ integer function do_burn(s, dt)

!$OMP PARALLEL DO PRIVATE(k,op_err,num_iters,avg_epsnuc) SCHEDULE(dynamic,2)
do k = kmin, nz
if (k_bad /= 0) cycle
!$OMP ATOMIC READ
op_err = k_bad
if (op_err /= 0) cycle
if (s% T_start(k) < s% op_split_burn_min_T) then
! We get here if we have an off center ignition,
! the arrays wont have been initialised earlier as they stop at the
Expand All @@ -910,24 +907,20 @@ integer function do_burn(s, dt)
screening_mode, &
dt, num_iters, avg_epsnuc, burn_dbg, op_err)
if (op_err /= 0) then
ierr = -1
!$OMP ATOMIC WRITE
k_bad = k
cycle
end if
call do_eos_for_cell(s,k,op_err)
if (op_err /= 0) then
write(*,2) 'do_burn failed in do_eos_for_cell', k
ierr = -1
!$OMP ATOMIC WRITE
k_bad = k
cycle
end if
!write(*,3) 'num_iters', k, num_iters
s% burn_num_iters(k) = num_iters
s% burn_avg_epsnuc(k) = avg_epsnuc
if (num_iters > max_num_iters_used) then
max_num_iters_used = num_iters
max_num_iters_k = k
end if
end do
!$OMP END PARALLEL DO

Expand All @@ -936,34 +929,21 @@ integer function do_burn(s, dt)
if (s% doing_timing) &
call update_time(s, time0, total, s% time_solve_burn)

if (ierr /= 0) then
if (k_bad /= 0) then
if (s% report_ierr) write(*,2) 'do_burn failed', k_bad
return
call mesa_error(__FILE__,__LINE__,'do_burn')


do_burn = retry
s% result_reason = nonzero_ierr
s% retry_message = 'split burn failed'
s% retry_message_k = k_bad
if (trace .or. s% report_ierr) then
write(*,*) 'do_burn ierr'
end if
call restore
return
end if

if (dbg) write(*,2) 'done do_burn'


contains

subroutine restore
integer :: j, k
do k = 1, nz
do j=1,species
s% xa(j,k) = s% xa_start(j,k)
end do
end do
end subroutine restore

end function do_burn


Expand Down
Loading