Skip to content

Commit

Permalink
make writing last restart file optional (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
junwang-noaa authored and DusanJovic-NOAA committed Dec 24, 2019
1 parent 452333a commit 0e84f88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions driver/fvGFS/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ end subroutine atmosphere_dynamics

!>@brief The subroutine 'atmosphere_end' is an API for the termination of the
!! FV3 dynamical core responsible for writing out a restart and final diagnostic state.
subroutine atmosphere_end (Time, Grid_box)
subroutine atmosphere_end (Time, Grid_box, restart_endfcst)
#ifdef CCPP
#ifdef STATIC
! For static builds, the ccpp_physics_{init,run,finalize} calls
Expand All @@ -727,6 +727,7 @@ subroutine atmosphere_end (Time, Grid_box)
#endif
type (time_type), intent(in) :: Time
type(grid_box_type), intent(inout) :: Grid_box
logical, intent(in) :: restart_endfcst

#ifdef CCPP
integer :: ierr
Expand Down Expand Up @@ -754,7 +755,7 @@ subroutine atmosphere_end (Time, Grid_box)
call timing_off('FV_DIAG')
endif

call fv_end(Atm, grids_on_this_pe)
call fv_end(Atm, grids_on_this_pe, restart_endfcst)
deallocate (Atm)

deallocate( u_dt, v_dt, t_dt, pref, dum1d )
Expand Down
5 changes: 3 additions & 2 deletions model/fv_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -592,17 +592,18 @@ end subroutine fv_init

!>@brief The subroutine 'fv_end' terminates FV3, deallocates memory,
!! saves restart files, and stops I/O.
subroutine fv_end(Atm, grids_on_this_pe)
subroutine fv_end(Atm, grids_on_this_pe, restart_endfcst)

type(fv_atmos_type), intent(inout) :: Atm(:)
logical, intent(INOUT) :: grids_on_this_pe(:)
logical, intent(in) :: restart_endfcst

integer :: n

call timing_off('TOTAL')
call timing_prt( gid )

call fv_restart_end(Atm, grids_on_this_pe)
call fv_restart_end(Atm, grids_on_this_pe, restart_endfcst)
call fv_io_exit()

! Free temporary memory from sw_core routines
Expand Down
14 changes: 9 additions & 5 deletions tools/fv_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,10 @@ end subroutine fv_write_restart
!>@brief The subroutine 'fv_restart_end' writes ending restart files,
!! terminates I/O, and prints out diagnostics including global totals
!! and checksums.
subroutine fv_restart_end(Atm, grids_on_this_pe)
subroutine fv_restart_end(Atm, grids_on_this_pe, restart_endfcst)
type(fv_atmos_type), intent(inout) :: Atm(:)
logical, intent(INOUT) :: grids_on_this_pe(:)
logical, intent(in) :: restart_endfcst

integer :: isc, iec, jsc, jec
integer :: iq, n, ntileMe, ncnst, ntprog, ntdiag
Expand Down Expand Up @@ -1516,10 +1517,13 @@ subroutine fv_restart_end(Atm, grids_on_this_pe)

enddo

call fv_io_write_restart(Atm, grids_on_this_pe)
do n=1,ntileMe
if (Atm(n)%neststruct%nested .and. grids_on_this_pe(n)) call fv_io_write_BCs(Atm(n))
end do
if ( restart_endfcst ) then
call fv_io_write_restart(Atm, grids_on_this_pe)
! print *,'af call fv_io_write_restart, restart_endfcst=',restart_endfcst
do n=1,ntileMe
if (Atm(n)%neststruct%nested .and. grids_on_this_pe(n)) call fv_io_write_BCs(Atm(n))
end do
endif

module_is_initialized = .FALSE.

Expand Down

0 comments on commit 0e84f88

Please sign in to comment.