From eb5d087401283cb133991899940d43aff8ae7353 Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Wed, 13 Dec 2023 18:51:30 -0600 Subject: [PATCH 1/2] Remove nfhout, nfhout_hf, nsout --- atmos_model.F90 | 4 +- fv3_cap.F90 | 73 ++----------------------------------- io/module_fv3_io_def.F90 | 2 +- io/module_wrt_grid_comp.F90 | 3 +- module_fv3_config.F90 | 2 +- 5 files changed, 8 insertions(+), 76 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index 25cc61a88..7105f6997 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -101,7 +101,7 @@ 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: first_kdt, nsout, output_fh, & +use module_fv3_config, only: first_kdt, output_fh, & fcst_mpi_comm, fcst_ntasks, & quilting_restart use module_block_data, only: block_atmos_copy, block_data_copy, & @@ -976,7 +976,7 @@ subroutine update_atmos_model_state (Atmos, rc) call get_time (Atmos%Time - diag_time, isec) call get_time (Atmos%Time - Atmos%Time_init, seconds) call atmosphere_nggps_diag(Atmos%Time,ltavg=.true.,avg_max_length=avg_max_length) - if (ANY(nint(output_fh(:)*3600.0) == seconds) .or. (GFS_control%kdt == first_kdt) .or. nsout > 0) then + if (ANY(nint(output_fh(:)*3600.0) == seconds) .or. (GFS_control%kdt == first_kdt)) then if (mpp_pe() == mpp_root_pe()) write(6,*) "---isec,seconds",isec,seconds time_int = real(isec) if(Atmos%iau_offset > zero) then diff --git a/fv3_cap.F90 b/fv3_cap.F90 index ada73a861..5401e66a5 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -28,7 +28,7 @@ module fv3atm_cap_mod NUOPC_ModelGet ! use module_fv3_config, only: quilting, quilting_restart, output_fh, & - nfhout, nfhout_hf, nsout, dt_atmos, & + dt_atmos, & calendar, cpl_grid_id, & cplprint_flag, first_kdt @@ -36,7 +36,7 @@ module fv3atm_cap_mod num_files, filename_base, & wrttasks_per_group, n_group, & lead_wrttask, last_wrttask, & - nsout_io, iau_offset, lflname_fulltime, & + iau_offset, lflname_fulltime, & time_unlimited ! use module_fcst_grid_comp, only: fcstSS => SetServices @@ -301,7 +301,6 @@ subroutine InitializeAdvertise(gcomp, rc) if(mype == 0) print *,'af ufs config,quilting=',quilting,' calendar=', trim(calendar),' iau_offset=',iau_offset, & ' noutput_fh=',noutput_fh ! - nfhout = 0 ; nfhmax_hf = 0 ; nfhout_hf = 0 ; nsout = 0 if ( quilting ) then call ESMF_ConfigGetAttribute(config=CF,value=use_saved_routehandles, & label ='use_saved_routehandles:', & @@ -334,15 +333,6 @@ subroutine InitializeAdvertise(gcomp, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return enddo -! variables for output - call ESMF_ConfigGetAttribute(config=CF, value=nfhout, label ='nfhout:', default=-1,rc=rc) - call ESMF_ConfigGetAttribute(config=CF, value=nfhmax_hf,label ='nfhmax_hf:',default=-1,rc=rc) - call ESMF_ConfigGetAttribute(config=CF, value=nfhout_hf,label ='nfhout_hf:',default=-1,rc=rc) - call ESMF_ConfigGetAttribute(config=CF, value=nsout, label ='nsout:', default=-1,rc=rc) - nsout_io = nsout -! - if(mype==0) print *,'af ufs config,nfhout,nsout=',nfhout,nfhmax_hf,nfhout_hf, nsout,noutput_fh - call ESMF_ConfigGetAttribute(config=CF, value=time_unlimited, label ='time_unlimited:', default=.false., rc=rc) endif ! quilting @@ -819,64 +809,7 @@ subroutine InitializeAdvertise(gcomp, rc) if(iau_offset > 0) then output_startfh = iau_offset endif - if(mype==0) print *,'in fv3 cap init, output_startfh=',output_startfh,'nsout=',nsout, & - 'iau_offset=',iau_offset,'nfhmax_hf=',nfhmax_hf,'nfhout_hf=',nfhout_hf, & - 'nfhout=',nfhout -! -!--- set up output_fh with output forecast hours -! if the run does not have iau, it will have output after first step integration as fh00 -! if the run has iau, it will start output at fh=00 at the cycle time (usually StartTime+IAU_offsetTI) - if(nsout > 0) then -!--- use nsout for output frequency nsout*dt_atmos - nfh = 0 - if( nfhmax > output_startfh ) nfh = nint((nfhmax-output_startfh)/(nsout*dt_atmos/3600.))+1 - if(nfh >0) then - allocate(output_fh(nfh)) - if( output_startfh == 0) then - output_fh(1) = dt_atmos/3600. - else - output_fh(1) = output_startfh - endif - do i=2,nfh - output_fh(i) = (i-1)*nsout*dt_atmos/3600. + output_startfh - enddo - endif - elseif (nfhmax_hf > 0 ) then -!--- use high frequency output and low frequency for output forecast time - nfh = 0 - if( nfhout_hf>0 .and. nfhmax_hf>output_startfh) nfh = nint((nfhmax_hf-output_startfh)/nfhout_hf)+1 - nfh2 = 0 - if( nfhout>0 .and. nfhmax>nfhmax_hf) nfh2 = nint((nfhmax-nfhmax_hf)/nfhout) - if( nfh+nfh2 > 0) then - allocate(output_fh(nfh+nfh2)) - if( output_startfh == 0) then - output_fh(1) = dt_atmos/3600. - else - output_fh(1) = output_startfh - endif - do i=2,nfh - output_fh(i) = (i-1)*nfhout_hf + output_startfh - enddo - do i=1,nfh2 - output_fh(nfh+i) = nfhmax_hf + i*nfhout - enddo - endif - elseif (nfhout > 0 ) then -!--- use one output freqency - nfh = 0 - if( nfhout > 0 .and. nfhmax>output_startfh) nfh = nint((nfhmax-output_startfh)/nfhout) + 1 - if( nfh > 0 ) then - allocate(output_fh(nfh)) - if( output_startfh == 0) then - output_fh(1) = dt_atmos/3600. - else - output_fh(1) = output_startfh - endif - do i=2,nfh - output_fh(i) = (i-1)*nfhout + output_startfh - enddo - endif - endif + if(mype==0) print *,'in fv3 cap init, output_startfh=',output_startfh,' iau_offset=',iau_offset ! !----------------------------------------------------------------------- !*** SET THE FIRST WRITE GROUP AS THE FIRST ONE TO ACT. diff --git a/io/module_fv3_io_def.F90 b/io/module_fv3_io_def.F90 index 2689ef1c2..dfef37500 100644 --- a/io/module_fv3_io_def.F90 +++ b/io/module_fv3_io_def.F90 @@ -15,7 +15,7 @@ module module_fv3_io_def integer :: n_group integer :: num_files integer :: nbdlphys - integer :: nsout_io, iau_offset + integer :: iau_offset logical :: lflname_fulltime logical :: time_unlimited diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index b59fe5e45..fe7d43952 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -38,7 +38,6 @@ module module_wrt_grid_comp imo,jmo,ichunk2d,jchunk2d, & ichunk3d,jchunk3d,kchunk3d, & quantize_mode,quantize_nsd, & - nsout => nsout_io, & cen_lon, cen_lat, & lon1, lat1, lon2, lat2, dlon, dlat, & stdlat1, stdlat2, dx, dy, iau_offset, & @@ -1876,7 +1875,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc) if (nf_hours < 0) return - if (nsout > 0 .or. lflname_fulltime) then + if (lflname_fulltime) then ndig = max(log10(nf_hours+0.5)+1., 3.) write(cform, '("(I",I1,".",I1,",A1,I2.2,A1,I2.2)")') ndig, ndig write(cfhour, cform) nf_hours,'-',nf_minutes,'-',nf_seconds diff --git a/module_fv3_config.F90 b/module_fv3_config.F90 index aac606a5e..7e82c8e24 100644 --- a/module_fv3_config.F90 +++ b/module_fv3_config.F90 @@ -13,7 +13,7 @@ module module_fv3_config implicit none ! - integer :: nfhout, nfhout_hf, nsout, dt_atmos + integer :: dt_atmos integer :: first_kdt integer :: fcst_mpi_comm, fcst_ntasks ! From 4592fade6fd141307bdb0799dfab949576b10467 Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Thu, 14 Dec 2023 02:37:47 +0000 Subject: [PATCH 2/2] Do not open 'coupler.res' file with status 'new' --- io/module_wrt_grid_comp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index fe7d43952..e409788ab 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -2447,7 +2447,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc) if (out_phase == 2 .and. restart_written .and. mype == lead_write_task) then !** write coupler.res log file - open(newunit=nolog, file='RESTART/'//trim(time_restart)//'.coupler.res', status='new') + open(newunit=nolog, file='RESTART/'//trim(time_restart)//'.coupler.res') write(nolog,"(i6,8x,a)") calendar_type , & '(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)' write(nolog,"(6i6,8x,a)") start_time(1:6), &