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

fix diag time at GEFS restart and clean up output_1st_tstep_rst #643

Merged
merged 2 commits into from
Apr 12, 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
14 changes: 10 additions & 4 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ module atmos_model_mod
use fv_ufs_restart_io_mod, only: fv_dyn_restart_register, &
fv_dyn_restart_output
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, &
output_fh, fcst_mpi_comm, fcst_ntasks, &
use module_fv3_config, only: first_kdt, nsout, output_fh, &
fcst_mpi_comm, fcst_ntasks, &
quilting_restart
use module_block_data, only: block_atmos_copy, block_data_copy, &
block_data_copy_or_fill, &
Expand Down Expand Up @@ -782,8 +782,14 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)

!--- set the initial diagnostic timestamp
diag_time = Time
if (output_1st_tstep_rst) then
diag_time = Time - real_to_time_type(mod(int((first_kdt - 1)*dt_phys/3600.),6)*3600.0)
call get_time (Atmos%Time - Atmos%Time_init, sec)
!--- Model should restart at the forecast hours that are multiples of fhzero.
!--- WARNING: For special cases that model needs to restart at non-multiple of fhzero
!--- the fields in first output files are not accumulated from the beginning of
!--- the bucket, but the restart time.
if (mod(sec,int(GFS_Control%fhzero*3600.)) /= 0) then
diag_time = Time - real_to_time_type(mod(int((GFS_Control%kdt - 1)*dt_phys/3600.),int(GFS_Control%fhzero))*3600.0)
if (mpp_pe() == mpp_root_pe()) print *,'Warning: in atmos_init,start at non multiple of fhzero'
endif
if (Atmos%iau_offset > zero) then
call get_time (Atmos%Time - Atmos%Time_init, sec)
Expand Down
12 changes: 1 addition & 11 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ module fv3gfs_cap_mod
use module_fv3_config, only: quilting, quilting_restart, output_fh, &
nfhout, nfhout_hf, nsout, dt_atmos, &
calendar, cpl_grid_id, &
cplprint_flag,output_1st_tstep_rst, &
first_kdt
cplprint_flag, first_kdt

use module_fv3_io_def, only: num_pes_fcst,write_groups, &
num_files, filename_base, &
Expand Down Expand Up @@ -284,10 +283,6 @@ subroutine InitializeAdvertise(gcomp, rc)

if (.not.quilting) quilting_restart = .false.

call ESMF_ConfigGetAttribute(config=CF,value=output_1st_tstep_rst, &
default=.false., label ='output_1st_tstep_rst:',rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

call ESMF_ConfigGetAttribute(config=CF,value=iau_offset,default=0,label ='iau_offset:',rc=rc)
if (iau_offset < 0) iau_offset=0

Expand Down Expand Up @@ -350,11 +345,6 @@ subroutine InitializeAdvertise(gcomp, rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

first_kdt = 1
if( output_1st_tstep_rst) then
rsthour = currTime - StartTime
first_kdt = nint(rsthour/timeStep) + 1
endif

!
!#######################################################################
! set up fcst grid component
Expand Down
2 changes: 1 addition & 1 deletion io/module_wrt_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc)
!** write out log file
!
if (mype == lead_write_task) then
open(newunit=nolog,file='logf'//trim(cfhour),form='FORMATTED')
open(newunit=nolog,file='atm.logf'//trim(cfhour),form='FORMATTED')
write(nolog,100)nfhour,idate(1:6)
100 format(' completed fv3gfs fhour=',f10.3,2x,6(i4,2x))
close(nolog)
Expand Down
2 changes: 1 addition & 1 deletion module_fv3_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module module_fv3_config
!
integer :: cpl_grid_id
logical :: cplprint_flag
logical :: quilting, quilting_restart, output_1st_tstep_rst
logical :: quilting, quilting_restart
!
real,dimension(:),allocatable :: output_fh
character(esmf_maxstr),dimension(:),allocatable :: filename_base
Expand Down