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

#25: add capability to write out restart files at specified forecast hours #9

Merged
merged 1 commit into from
Dec 24, 2019
Merged
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
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
DusanJovic-NOAA marked this conversation as resolved.
Show resolved Hide resolved
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