Skip to content

Commit 0e84f88

Browse files
junwang-noaaDusanJovic-NOAA
authored andcommitted
make writing last restart file optional (NOAA-EMC#9)
1 parent 452333a commit 0e84f88

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

driver/fvGFS/atmosphere.F90

+3-2
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ end subroutine atmosphere_dynamics
712712

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

731732
#ifdef CCPP
732733
integer :: ierr
@@ -754,7 +755,7 @@ subroutine atmosphere_end (Time, Grid_box)
754755
call timing_off('FV_DIAG')
755756
endif
756757

757-
call fv_end(Atm, grids_on_this_pe)
758+
call fv_end(Atm, grids_on_this_pe, restart_endfcst)
758759
deallocate (Atm)
759760

760761
deallocate( u_dt, v_dt, t_dt, pref, dum1d )

model/fv_control.F90

+3-2
Original file line numberDiff line numberDiff line change
@@ -592,17 +592,18 @@ end subroutine fv_init
592592

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

597597
type(fv_atmos_type), intent(inout) :: Atm(:)
598598
logical, intent(INOUT) :: grids_on_this_pe(:)
599+
logical, intent(in) :: restart_endfcst
599600

600601
integer :: n
601602

602603
call timing_off('TOTAL')
603604
call timing_prt( gid )
604605

605-
call fv_restart_end(Atm, grids_on_this_pe)
606+
call fv_restart_end(Atm, grids_on_this_pe, restart_endfcst)
606607
call fv_io_exit()
607608

608609
! Free temporary memory from sw_core routines

tools/fv_restart.F90

+9-5
Original file line numberDiff line numberDiff line change
@@ -1434,9 +1434,10 @@ end subroutine fv_write_restart
14341434
!>@brief The subroutine 'fv_restart_end' writes ending restart files,
14351435
!! terminates I/O, and prints out diagnostics including global totals
14361436
!! and checksums.
1437-
subroutine fv_restart_end(Atm, grids_on_this_pe)
1437+
subroutine fv_restart_end(Atm, grids_on_this_pe, restart_endfcst)
14381438
type(fv_atmos_type), intent(inout) :: Atm(:)
14391439
logical, intent(INOUT) :: grids_on_this_pe(:)
1440+
logical, intent(in) :: restart_endfcst
14401441

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

15171518
enddo
15181519

1519-
call fv_io_write_restart(Atm, grids_on_this_pe)
1520-
do n=1,ntileMe
1521-
if (Atm(n)%neststruct%nested .and. grids_on_this_pe(n)) call fv_io_write_BCs(Atm(n))
1522-
end do
1520+
if ( restart_endfcst ) then
1521+
call fv_io_write_restart(Atm, grids_on_this_pe)
1522+
! print *,'af call fv_io_write_restart, restart_endfcst=',restart_endfcst
1523+
do n=1,ntileMe
1524+
if (Atm(n)%neststruct%nested .and. grids_on_this_pe(n)) call fv_io_write_BCs(Atm(n))
1525+
end do
1526+
endif
15231527

15241528
module_is_initialized = .FALSE.
15251529

0 commit comments

Comments
 (0)