diff --git a/driver/fvGFS/atmosphere.F90 b/driver/fvGFS/atmosphere.F90 index 48b8d1d54..0d81b6cb1 100644 --- a/driver/fvGFS/atmosphere.F90 +++ b/driver/fvGFS/atmosphere.F90 @@ -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 @@ -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 @@ -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 ) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index e87b01963..6a36bd835 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -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 diff --git a/tools/fv_restart.F90 b/tools/fv_restart.F90 index 1632212ed..72071cea6 100644 --- a/tools/fv_restart.F90 +++ b/tools/fv_restart.F90 @@ -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 @@ -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.