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

consistent Restart filenames #625

Merged
merged 6 commits into from
Feb 27, 2023
Merged
Changes from 3 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
38 changes: 3 additions & 35 deletions module_fcst_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ module module_fcst_grid_comp
use module_cplfields, only: realizeConnectedCplFields

use atmos_model_mod, only: setup_exportdata
use CCPP_data, only: GFS_control
!
!-----------------------------------------------------------------------
!
Expand All @@ -90,7 +89,7 @@ module module_fcst_grid_comp
type(ESMF_GridComp),dimension(:),allocatable :: fcstGridComp
integer :: ngrids, mygrid

integer :: intrm_rst, n_atmsteps
integer :: n_atmsteps

!----- coupled model data -----

Expand Down Expand Up @@ -745,19 +744,8 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
endif
! if to write out restart at the end of forecast
restart_endfcst = .false.
if ( ANY(frestart(:) == total_inttime) ) restart_endfcst = .true.
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved
! frestart only contains intermediate restart
do i=1,size(frestart)
if(frestart(i) == total_inttime) then
frestart(i) = 0
exit
endif
enddo
if (mype == 0) print *,'frestart=',frestart(1:10)/3600, 'restart_endfcst=',restart_endfcst, &
'total_inttime=',total_inttime
! if there is restart writing during integration
intrm_rst = 0
DusanJovic-NOAA marked this conversation as resolved.
Show resolved Hide resolved
if (frestart(1)>0) intrm_rst = 1

!------ initialize component models ------

Expand Down Expand Up @@ -1255,9 +1243,8 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

!--- intermediate restart
if (intrm_rst>0) then
call get_time(Atmos%Time - Atmos%Time_init, seconds)
if (ANY(frestart(:) == seconds)) then
call get_time(Atmos%Time - Atmos%Time_init, seconds)
if (ANY(frestart(:) == seconds)) then
if (mype == 0) write(*,*)'write out restart at n_atmsteps=',n_atmsteps,' seconds=',seconds, &
'integration length=',n_atmsteps*dt_atmos/3600.

Expand All @@ -1279,7 +1266,6 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc)
'Current model time: year, month, day, hour, minute, second'
close( unit )
endif
endif
endif

if (mype == 0) write(*,'(A,I16,A,F16.6)')'PASS: fcstRUN phase 2, n_atmsteps = ', &
Expand Down Expand Up @@ -1323,24 +1309,6 @@ subroutine fcst_finalize(fcst_comp, importState, exportState,clock,rc)

call atmos_model_end (Atmos)

!*** write restart file
if( restart_endfcst ) then
call get_date (Atmos%Time, date(1), date(2), date(3), &
date(4), date(5), date(6))
call mpp_set_current_pelist()
if (mpp_pe() == mpp_root_pe())then
open( newunit=unit, file='RESTART/coupler.res' )
write( unit, '(i6,8x,a)' )calendar_type, &
'(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)'

write( unit, '(6i6,8x,a)' )date_init, &
'Model start time: year, month, day, hour, minute, second'
write( unit, '(6i6,8x,a)' )date, &
'Current model time: year, month, day, hour, minute, second'
close( unit )
endif
endif

call diag_manager_end (Atmos%Time)

call fms_end
Expand Down