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
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
4 changes: 2 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ module atmos_model_mod
DIAG_SIZE
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, &
restart_endfcst, output_fh, fcst_mpi_comm, &
fcst_ntasks
output_fh, fcst_mpi_comm, fcst_ntasks
use module_block_data, only: block_atmos_copy, block_data_copy, &
block_data_copy_or_fill, &
block_data_combine_fractions
Expand Down Expand Up @@ -178,6 +177,7 @@ module atmos_model_mod
logical :: debug = .false.
!logical :: debug = .true.
logical :: sync = .false.
logical :: restart_endfcst = .false.
real :: avg_max_length=3600.
logical :: ignore_rst_cksum = .false.
namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, ccpp_suite, avg_max_length, &
Expand Down
44 changes: 5 additions & 39 deletions module_fcst_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ module module_fcst_grid_comp
nbdlphys, iau_offset
use module_fv3_config, only: dt_atmos, fcst_mpi_comm, fcst_ntasks, &
quilting, calendar, cpl_grid_id, &
cplprint_flag, restart_endfcst
cplprint_flag

use get_stochy_pattern_mod, only: write_stoch_restart_atm
use module_cplfields, only: nExportFields, exportFields, exportFieldsInfo, &
nImportFields, importFields, importFieldsInfo
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 @@ -744,20 +743,7 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
endif
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
if (mype == 0) print *,'frestart=',frestart(1:10)/3600, 'total_inttime=',total_inttime

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

Expand Down Expand Up @@ -1255,9 +1241,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 +1264,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 +1307,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
1 change: 0 additions & 1 deletion module_fv3_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module module_fv3_config
integer :: cpl_grid_id
logical :: cplprint_flag
logical :: quilting, output_1st_tstep_rst
logical :: restart_endfcst
!
real,dimension(:),allocatable :: output_fh
character(esmf_maxstr),dimension(:),allocatable :: filename_base
Expand Down