From eb0ad21a50cfd7436bc8d32629d86661ae6c23c6 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 14 Jan 2020 18:26:08 -0600 Subject: [PATCH 1/3] make variables using filename_base consistant in length --- fv3_cap.F90 | 5 +++-- io/module_fv3_io_def.F90 | 7 ++++--- io/module_wrt_grid_comp.F90 | 9 +++++---- module_fcst_grid_comp.F90 | 5 +++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index eaf20577f..c7c877bb4 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -32,7 +32,8 @@ module fv3gfs_cap_mod cplprint_flag,output_1st_tstep_rst, & first_kdt - use module_fv3_io_def, only: num_pes_fcst,write_groups, & + use module_fv3_io_def, only: max_filename_len, & + num_pes_fcst,write_groups, & num_files, filename_base, & wrttasks_per_group, n_group, & lead_wrttask, last_wrttask, & @@ -74,7 +75,7 @@ module fv3gfs_cap_mod type(ESMF_GridComp) :: fcstComp type(ESMF_State) :: fcstState - character(len=80), allocatable :: fcstItemNameList(:) + character(len=max_filename_len+14),allocatable :: fcstItemNameList(:) type(ESMF_StateItem_Flag), allocatable :: fcstItemTypeList(:) type(ESMF_FieldBundle), allocatable :: fcstFB(:) integer, save :: FBCount diff --git a/io/module_fv3_io_def.F90 b/io/module_fv3_io_def.F90 index d039ccc73..9ade6833f 100644 --- a/io/module_fv3_io_def.F90 +++ b/io/module_fv3_io_def.F90 @@ -9,20 +9,21 @@ module module_fv3_io_def ! implicit none ! + integer,parameter :: max_filename_len=255 integer :: num_pes_fcst integer :: wrttasks_per_group, write_groups integer :: n_group logical :: write_nemsioflip logical :: write_fsyncflag integer :: num_files - character(255) :: output_grid - character(255) :: output_file + character(len=max_filename_len) :: output_grid + character(len=max_filename_len) :: output_file integer :: imo,jmo integer :: nbdlphys integer :: nsout_io, iau_offset, ideflate, nbits real :: cen_lon, cen_lat, lon1, lat1, lon2, lat2, dlon, dlat real :: stdlat1, stdlat2, dx, dy - character(255),dimension(:),allocatable :: filename_base + character(len=max_filename_len),dimension(:),allocatable :: filename_base ! integer,dimension(:),allocatable :: lead_wrttask, last_wrttask ! diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index d0846be53..5ae33399b 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -38,7 +38,8 @@ module module_wrt_grid_comp nsout => nsout_io, & cen_lon, cen_lat, & lon1, lat1, lon2, lat2, dlon, dlat, & - stdlat1, stdlat2, dx, dy, iau_offset + stdlat1, stdlat2, dx, dy, iau_offset, & + max_filename_len use module_write_nemsio, only : nemsio_first_call, write_nemsio use module_write_netcdf, only : write_netcdf use physcons, only : pi => con_pi @@ -56,7 +57,7 @@ module module_wrt_grid_comp ! !----------------------------------------------------------------------- ! - integer,parameter :: filename_maxstr=255 + real, parameter :: rdgas=287.04, grav=9.80 real, parameter :: stndrd_atmos_ps = 101325. real, parameter :: stndrd_atmos_lapse = 0.0065 @@ -77,7 +78,7 @@ module module_wrt_grid_comp type(wrt_internal_state),pointer :: wrt_int_state ! The internal state pointer. type(ESMF_FieldBundle) :: gridFB integer :: FBcount - character(len=80),allocatable :: fcstItemNameList(:) + character(len=max_filename_len+14),allocatable :: fcstItemNameList(:) ! !----------------------------------------------------------------------- REAL(KIND=8) :: btim,btim0 @@ -1155,7 +1156,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc) logical,save :: first=.true. logical,save :: file_first=.true. ! - character(filename_maxstr) :: filename,compname,bundle_name + character(max_filename_len) :: filename,compname,bundle_name character(40) :: cfhour, cform character(10) :: stepString character(80) :: attrValueS diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index 9dfcbc751..0f618cfff 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -67,7 +67,7 @@ module module_fcst_grid_comp use esmf ! use module_fv3_io_def, only: num_pes_fcst, num_files, filename_base, nbdlphys, & - iau_offset + iau_offset, max_filename_len use module_fv3_config, only: dt_atmos, calendar, restart_interval, & quilting, calendar_type, cpl, & cplprint_flag, force_date_from_configure @@ -189,7 +189,8 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) character(3) cfhour character(4) dateSY character(2) dateSM,dateSD,dateSH,dateSN,dateSS - character(128) name_FB, name_FB1, dateS + character(len=max_filename_len+14) name_FB, name_FB1 + character(len=80) :: dateS real, allocatable, dimension(:,:) :: glon_bnd, glat_bnd character(256) :: gridfile From 4a3b8651cffe0f550eb65e22a492738ac8c98a49 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 15 Jan 2020 06:15:56 -0600 Subject: [PATCH 2/3] replace max_filename_len with esmf_maxstr --- fv3_cap.F90 | 5 ++--- io/module_fv3_io_def.F90 | 8 ++++---- io/module_wrt_grid_comp.F90 | 7 +++---- module_fcst_grid_comp.F90 | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index c7c877bb4..ae22c82b4 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -32,8 +32,7 @@ module fv3gfs_cap_mod cplprint_flag,output_1st_tstep_rst, & first_kdt - use module_fv3_io_def, only: max_filename_len, & - num_pes_fcst,write_groups, & + use module_fv3_io_def, only: num_pes_fcst,write_groups, & num_files, filename_base, & wrttasks_per_group, n_group, & lead_wrttask, last_wrttask, & @@ -75,7 +74,7 @@ module fv3gfs_cap_mod type(ESMF_GridComp) :: fcstComp type(ESMF_State) :: fcstState - character(len=max_filename_len+14),allocatable :: fcstItemNameList(:) + character(len=esmf_maxstr),allocatable :: fcstItemNameList(:) type(ESMF_StateItem_Flag), allocatable :: fcstItemTypeList(:) type(ESMF_FieldBundle), allocatable :: fcstFB(:) integer, save :: FBCount diff --git a/io/module_fv3_io_def.F90 b/io/module_fv3_io_def.F90 index 9ade6833f..74b5b7343 100644 --- a/io/module_fv3_io_def.F90 +++ b/io/module_fv3_io_def.F90 @@ -7,23 +7,23 @@ module module_fv3_io_def ! !------------------------------------------------------------------------ ! + use esmf, only :: esmf_maxstr implicit none ! - integer,parameter :: max_filename_len=255 integer :: num_pes_fcst integer :: wrttasks_per_group, write_groups integer :: n_group logical :: write_nemsioflip logical :: write_fsyncflag integer :: num_files - character(len=max_filename_len) :: output_grid - character(len=max_filename_len) :: output_file + character(len=esmf_maxstr) :: output_grid + character(len=esmf_maxstr) :: output_file integer :: imo,jmo integer :: nbdlphys integer :: nsout_io, iau_offset, ideflate, nbits real :: cen_lon, cen_lat, lon1, lat1, lon2, lat2, dlon, dlat real :: stdlat1, stdlat2, dx, dy - character(len=max_filename_len),dimension(:),allocatable :: filename_base + character(len=esmf_maxstr),dimension(:),allocatable :: filename_base ! integer,dimension(:),allocatable :: lead_wrttask, last_wrttask ! diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index 5ae33399b..9449da701 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -38,8 +38,7 @@ module module_wrt_grid_comp nsout => nsout_io, & cen_lon, cen_lat, & lon1, lat1, lon2, lat2, dlon, dlat, & - stdlat1, stdlat2, dx, dy, iau_offset, & - max_filename_len + stdlat1, stdlat2, dx, dy, iau_offset use module_write_nemsio, only : nemsio_first_call, write_nemsio use module_write_netcdf, only : write_netcdf use physcons, only : pi => con_pi @@ -78,7 +77,7 @@ module module_wrt_grid_comp type(wrt_internal_state),pointer :: wrt_int_state ! The internal state pointer. type(ESMF_FieldBundle) :: gridFB integer :: FBcount - character(len=max_filename_len+14),allocatable :: fcstItemNameList(:) + character(len=esmf_maxstr),allocatable :: fcstItemNameList(:) ! !----------------------------------------------------------------------- REAL(KIND=8) :: btim,btim0 @@ -1156,7 +1155,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc) logical,save :: first=.true. logical,save :: file_first=.true. ! - character(max_filename_len) :: filename,compname,bundle_name + character(esmf_maxstr) :: filename,compname,bundle_name character(40) :: cfhour, cform character(10) :: stepString character(80) :: attrValueS diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index 0f618cfff..91a2902b4 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -67,7 +67,7 @@ module module_fcst_grid_comp use esmf ! use module_fv3_io_def, only: num_pes_fcst, num_files, filename_base, nbdlphys, & - iau_offset, max_filename_len + iau_offset use module_fv3_config, only: dt_atmos, calendar, restart_interval, & quilting, calendar_type, cpl, & cplprint_flag, force_date_from_configure @@ -189,7 +189,7 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) character(3) cfhour character(4) dateSY character(2) dateSM,dateSD,dateSH,dateSN,dateSS - character(len=max_filename_len+14) name_FB, name_FB1 + character(len=esmf_maxstr) name_FB, name_FB1 character(len=80) :: dateS real, allocatable, dimension(:,:) :: glon_bnd, glat_bnd From c91306c9f53a7009b4fd7f70e72b53f98e7b35e9 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 15 Jan 2020 08:28:18 -0600 Subject: [PATCH 3/3] fix syntax --- io/module_fv3_io_def.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/module_fv3_io_def.F90 b/io/module_fv3_io_def.F90 index 74b5b7343..f15161886 100644 --- a/io/module_fv3_io_def.F90 +++ b/io/module_fv3_io_def.F90 @@ -7,7 +7,7 @@ module module_fv3_io_def ! !------------------------------------------------------------------------ ! - use esmf, only :: esmf_maxstr + use esmf, only : esmf_maxstr implicit none ! integer :: num_pes_fcst