Skip to content

Commit

Permalink
fall back to using ydot to estimate tdel if NR does not converge in l…
Browse files Browse the repository at this point in the history
…ast timestep attempt
  • Loading branch information
jaharris87 committed Feb 1, 2024
1 parent 224986c commit a1557c8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/xnet_integrate_be.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Subroutine solve_be(kstep,its)
!-----------------------------------------------------------------------------------------------
Use xnet_abundances, Only: y, yo, yt, xext
Use xnet_conditions, Only: t, to, tt, tdel, tdel_next, t9, t9o, t9t, rho, rhoo, rhot, &
yeo, ye, yet, nt, nto, ntt, t9rhofind
yeo, ye, yet, nt, nto, ntt, t9rhofind, tdelstart
Use xnet_controls, Only: idiag, iheat, kitmx, kmon, ktot, lun_diag, lun_stdout, tdel_maxmult, &
& szbatch, zb_lo, zb_hi
Use xnet_integrate, Only: timestep
Use xnet_timers, Only: xnet_wtime, start_timer, stop_timer, timer_tstep
Implicit None

Expand Down Expand Up @@ -106,6 +107,18 @@ Subroutine solve_be(kstep,its)
EndDo
EndIf

! For the last attempt, re-calculate timestep based on derivatives
! as is done for the first timestep.
If ( kts == ktsmx-1 ) Then
Do izb = zb_lo, zb_hi
If ( inr(izb) == 0 ) Then
tdel(izb) = 0.0
tdelstart(izb) = 0.0
EndIf
EndDo
Call timestep(kstep,mask_in = lzstep)
EndIf

! Log the failed integration attempts
If ( idiag >= 2 ) Then
Do izb = zb_lo, zb_hi
Expand Down

0 comments on commit a1557c8

Please sign in to comment.