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

Trigger tracking not at program end or termination #8

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
10 changes: 9 additions & 1 deletion source/control/tem_timeControl_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,15 @@ subroutine tem_timeControl_update(me, now, hasTriggered, localTriggered)
end if

if (triggered) then
me%trigger = max(me%trigger + me%interval, now)
if (tem_time_gt_trigger(me%max, me%trigger)) then
me%trigger = max(me%trigger + me%interval, now)
if (tem_time_gt_trigger(me%trigger, me%max)) then
me%trigger = max(me%max, now)
end if
else
! Beyond the tracking window, never trigger again
me%trigger = tem_time_never()
end if
end if

end subroutine tem_timeControl_update
Expand Down
17 changes: 6 additions & 11 deletions source/tem_tracking_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ module tem_tracking_module

!> Pointer to config array in tem_tracking_type
integer :: pntConfig

end type tem_tracking_instance_type

type tem_tracking_type
Expand Down Expand Up @@ -839,16 +839,11 @@ function tem_tracking_has_triggered( timeControl, simControl, proc ) &
type(tem_simControl_type), intent(in) :: simControl
logical :: triggered

logical :: tc_triggered

call tem_timeControl_check( me = timeControl, &
& now = simControl%now, &
& comm = proc%comm, &
& triggered = tc_triggered )
& triggered = triggered )

triggered = tc_triggered &
& .or. tem_status_run_end(simControl%status) &
& .or. tem_status_run_terminate(simControl%status)
end function tem_tracking_has_triggered
! ------------------------------------------------------------------------ !

Expand All @@ -871,7 +866,7 @@ subroutine tem_tracker( track, simControl, varSys, tree )
! -------------------------------------------------------------------- !
integer :: iLog, iConfig
! -------------------------------------------------------------------- !

! Run over all tracking objects
do iLog = 1, track%control%nActive
iConfig = track%instance(iLog)%pntConfig
Expand All @@ -886,11 +881,11 @@ subroutine tem_tracker( track, simControl, varSys, tree )
! stop file is defined
! simulation is terminated abruptly
! simulation reaches the maximum simulation time
if ( tem_tracking_has_triggered( &
if ( tem_tracking_has_triggered( &
& timeControl = track%config(iConfig)%timeControl, &
& simControl = simControl, &
& proc = track%instance(iLog)%output_file%proc ) ) then

if( track%instance( iLog )%subTree%useGlobalMesh ) then
! Open the output files, this also generates the vertices for the
! mesh, and writes the mesh data to disk. Also writes header file
Expand Down Expand Up @@ -937,7 +932,7 @@ subroutine tem_tracker( track, simControl, varSys, tree )
& mesh = tree, &
& subTree = track%instance(iLog)%subTree )
end if !Global mesh

end if ! do tracking? interval, tmin, tmax check
end do ! iLog

Expand Down