Skip to content

Commit

Permalink
fixed some inconsistencies to satisfy interface standards
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonr committed Aug 11, 2023
1 parent c3286b4 commit d01efc0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
21 changes: 10 additions & 11 deletions model/fv_regional_bc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1381,16 +1381,15 @@ subroutine start_regional_restart(Atm &
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if( open_file(Gfs_ctl, 'INPUT/gfs_ctrl.nc', "read", pelist=pes(1)) ) then
if( open_file(Gfs_ctl, 'INPUT/gfs_ctrl.nc', "read", pelist=pes(1:1)) ) then
!--- read in the number of levsp
call get_dimension_size(Gfs_ctl, 'levsp', levsp)
call close_file(Gfs_ctl)
else
call mpp_error(FATAL,'==> Error in fv_regional::start_regional_restart file INPUT/gfs_ctl.nc does not exist')
endif
endif
call mpp_broadcast(levsp, 1, pes(1), pes)

call mpp_broadcast(levsp, pes(1), pes)
levp = levsp-1
!
!-----------------------------------------------------------------------
Expand All @@ -1416,12 +1415,12 @@ subroutine start_regional_restart(Atm &
allocate (bk_in(levp+1)) ! remapping BC updates during the forecast.
if (mpp_pe() == pes(1)) then
if (Atm%flagstruct%hrrrv3_ic) then
if (open_file(Grid_input, 'INPUT/hrrr_ctrl.nc', "read", pelist=pes(1))) then
if (open_file(Grid_input, 'INPUT/hrrr_ctrl.nc', "read", pelist=pes(1:1))) then
call read_data(Grid_input,'vcoord',wk2)
call close_file(Grid_input)
endif
else
if (open_file(Grid_input, 'INPUT/gfs_ctrl.nc', "read", pelist=pes(1))) then
if (open_file(Grid_input, 'INPUT/gfs_ctrl.nc', "read", pelist=pes(1:1))) then
call read_data(Grid_input,'vcoord',wk2)
call close_file(Grid_input)
endif
Expand Down Expand Up @@ -6828,7 +6827,7 @@ subroutine get_data_source(data_source_fv3gfs,regional,directory)
logical, intent(in):: regional
logical, intent(out):: data_source_fv3gfs

character (len=80) :: source
character (len=80), dimension(1) :: source
logical :: lstatus
character(len=*), intent(in), optional :: directory
character(len=128) :: dir
Expand All @@ -6846,8 +6845,8 @@ subroutine get_data_source(data_source_fv3gfs,regional,directory)
call mpp_get_current_pelist(pes)

if (mpp_pe() == pes(1)) then
if (open_file(Gfs_data , trim(dir)//'/gfs_data.nc', "read", pelist=pes(1)) .or. &
open_file(Gfs_data , trim(dir)//'/gfs_data.tile1.nc', "read", pelist=pes(1))) then
if (open_file(Gfs_data , trim(dir)//'/gfs_data.nc', "read", pelist=pes(1:1)) .or. &
open_file(Gfs_data , trim(dir)//'/gfs_data.tile1.nc', "read", pelist=pes(1:1))) then
lstatus = global_att_exists(Gfs_data, "source")
if(lstatus) call get_global_attribute(Gfs_data, "source", source)
call close_file(Gfs_data)
Expand All @@ -6865,9 +6864,9 @@ subroutine get_data_source(data_source_fv3gfs,regional,directory)
deallocate(pes)

! Logical flag for fv3gfs nemsio/netcdf/grib2 --------
if ( trim(source)=='FV3GFS GAUSSIAN NEMSIO FILE' .or. &
trim(source)=='FV3GFS GAUSSIAN NETCDF FILE' .or. &
trim(source)=='FV3GFS GRIB2 FILE' ) then
if ( trim(source(1))=='FV3GFS GAUSSIAN NEMSIO FILE' .or. &
trim(source(1))=='FV3GFS GAUSSIAN NETCDF FILE' .or. &
trim(source(1))=='FV3GFS GRIB2 FILE' ) then
data_source_fv3gfs = .TRUE.
else
data_source_fv3gfs = .FALSE.
Expand Down
12 changes: 6 additions & 6 deletions tools/external_ic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ subroutine get_nggps_ic (Atm)
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1)) ) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1:1)) ) then
!--- read in the number of tracers in the NCEP NGGPS ICs
call read_data (Gfs_ctl, 'ntrac', dum_i4(1))
!--- read in the number of levp
Expand All @@ -408,7 +408,7 @@ subroutine get_nggps_ic (Atm)
call mpp_broadcast(dum_i4, size(dum_i4), pes(1), pes)
deallocate(pes)
ntrac = dum_i4(1)
levsp = dum_14(2)
levsp = dum_i4(2)

call mpp_error(NOTE,'==> External_ic::get_nggps_ic: using control file '//trim(fn_gfs_ctl)//' for NGGPS IC')

Expand Down Expand Up @@ -738,7 +738,7 @@ subroutine read_gfs_ic()
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1)) ) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1:1)) ) then
call read_data(Gfs_ctl,'vcoord',wk2)
call close_file(Gfs_ctl)
endif
Expand Down Expand Up @@ -916,7 +916,7 @@ subroutine get_hrrr_ic (Atm)
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if( open_file(Hrr_ctl, fn_hrr_ctl, "read", pelist=pes(1)) ) then
if( open_file(Hrr_ctl, fn_hrr_ctl, "read", pelist=pes(1:1)) ) then
!--- read in the number of tracers in the HRRR ICs
call read_data (Hrr_ctl, 'ntrac', ntrac)
if (ntrac > ntracers) call mpp_error(FATAL,'==> External_ic::get_hrrr_ic: more HRRR tracers &
Expand Down Expand Up @@ -1936,12 +1936,12 @@ subroutine get_ecmwf_ic( Atm )
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1)) ) then
if( open_file(Gfs_ctl, fn_gfs_ctl, "read", pelist=pes(1:1)) ) then
call read_data(Gfs_ctl,'vcoord',wk2)
call close_file(Gfs_ctl)
endif
endif
mpp_broadcast(wk2, size(wk2), pes(1), pes)
call mpp_broadcast(wk2, size(wk2), pes(1), pes)
ak_gfs(1:levp_gfs+1) = wk2(1:levp_gfs+1,1)
bk_gfs(1:levp_gfs+1) = wk2(1:levp_gfs+1,2)
deallocate (wk2, pes)
Expand Down
4 changes: 2 additions & 2 deletions tools/fv_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ subroutine fv_io_read_restart(fv_domain,Atm,prefix,directory)
if (mpp_pe() == pes(1)) then
suffix = ''
fname = ''//trim(dir)//'/'//trim(pre)//'fv_core.res.nc'
Atm(1)%Fv_restart_is_open = open_file(Atm(1)%Fv_restart,fname,"read", is_restart=.true., pelist=pes(1))
Atm(1)%Fv_restart_is_open = open_file(Atm(1)%Fv_restart,fname,"read", is_restart=.true., pelist=pes(1:1))
if (Atm(1)%Fv_restart_is_open) then
call fv_io_register_restart(Atm(1))
call read_restart(Atm(1)%Fv_restart)
Expand Down Expand Up @@ -687,7 +687,7 @@ subroutine remap_restart(Atm)
allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (mpp_pe() == pes(1)) then
if (open_file(Fv_restart_r,fname,"read", is_restart=.true., pelist=pes(1))) then
if (open_file(Fv_restart_r,fname,"read", is_restart=.true., pelist=pes(1:1))) then
call read_data(Fv_restart_r, 'ak', ak_r(:))
call read_data(Fv_restart_r, 'bk', bk_r(:))
call close_file(Fv_restart_r)
Expand Down

0 comments on commit d01efc0

Please sign in to comment.