From 8700936bc1af2c0a52f145b9946e193bd02850d6 Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Tue, 13 Dec 2022 18:22:06 +0000 Subject: [PATCH] Add optional 'time_unlimited' logical flag to model_configure This flag is set to .false.by default. When the user sets it to .true. explicitly in the model_configure file the time dimension in history files will be a record dimension (ie. unlimited) --- fv3_cap.F90 | 5 ++++- io/module_fv3_io_def.F90 | 1 + io/module_write_netcdf.F90 | 16 ++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index b647414a8..731d0e239 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -37,7 +37,8 @@ module fv3gfs_cap_mod num_files, filename_base, & wrttasks_per_group, n_group, & lead_wrttask, last_wrttask, & - nsout_io, iau_offset, lflname_fulltime + nsout_io, iau_offset, lflname_fulltime, & + time_unlimited ! use module_fcst_grid_comp, only: fcstSS => SetServices @@ -322,6 +323,8 @@ subroutine InitializeAdvertise(gcomp, rc) ! if(mype==0) print *,'af nems 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 ! call ESMF_ConfigGetAttribute(config=CF, value=dt_atmos, label ='dt_atmos:', rc=rc) diff --git a/io/module_fv3_io_def.F90 b/io/module_fv3_io_def.F90 index dda5310ad..30fa553f6 100644 --- a/io/module_fv3_io_def.F90 +++ b/io/module_fv3_io_def.F90 @@ -17,6 +17,7 @@ module module_fv3_io_def integer :: nbdlphys integer :: nsout_io, iau_offset logical :: lflname_fulltime + logical :: time_unlimited character(len=esmf_maxstr),dimension(:),allocatable :: filename_base character(len=esmf_maxstr),dimension(:),allocatable :: output_file diff --git a/io/module_write_netcdf.F90 b/io/module_write_netcdf.F90 index 787894ebc..7bf85686e 100644 --- a/io/module_write_netcdf.F90 +++ b/io/module_write_netcdf.F90 @@ -11,7 +11,8 @@ module module_write_netcdf use netcdf use module_fv3_io_def,only : ideflate, nbits, & ichunk2d,jchunk2d,ichunk3d,jchunk3d,kchunk3d, & - output_grid,dx,dy,lon1,lat1,lon2,lat2 + output_grid,dx,dy,lon1,lat1,lon2,lat2, & + time_unlimited use mpi implicit none @@ -896,12 +897,15 @@ subroutine add_dim(ncid, dim_name, dimid, grid, rc) typekind=typekind, itemCount=n, rc=rc); ESMF_ERR_RETURN(rc) if (trim(dim_name) == "time") then - ! using an unlimited dim requires collective mode (NF90_COLLECTIVE) - ! for parallel writes, which seems to slow things down on hera. - !ncerr = nf90_def_dim(ncid, trim(dim_name), NF90_UNLIMITED, dimid); NC_ERR_STOP(ncerr) - ncerr = nf90_def_dim(ncid, trim(dim_name), 1, dimid); NC_ERR_STOP(ncerr) + ! using an unlimited dim requires collective mode (NF90_COLLECTIVE) + ! for parallel writes, which seems to slow things down on hera. + if (time_unlimited) then + ncerr = nf90_def_dim(ncid, trim(dim_name), NF90_UNLIMITED, dimid); NC_ERR_STOP(ncerr) + else + ncerr = nf90_def_dim(ncid, trim(dim_name), 1, dimid); NC_ERR_STOP(ncerr) + end if else - ncerr = nf90_def_dim(ncid, trim(dim_name), n, dimid); NC_ERR_STOP(ncerr) + ncerr = nf90_def_dim(ncid, trim(dim_name), n, dimid); NC_ERR_STOP(ncerr) end if if (typekind==ESMF_TYPEKIND_R8) then