From 7ebd2d95422f078d566f7c5398a1b605cfc16285 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 9 Jul 2026 17:53:41 -0600 Subject: [PATCH 1/2] Confirm that nx*ny matches the number of elements in the model mesh Resolves ESCOMP/CDEPS#418 --- datm/atm_comp_nuopc.F90 | 4 ++-- dglc/glc_comp_nuopc.F90 | 3 ++- dice/ice_comp_nuopc.F90 | 4 ++-- dlnd/lnd_comp_nuopc.F90 | 4 ++-- docn/ocn_comp_nuopc.F90 | 4 ++-- drof/rof_comp_nuopc.F90 | 4 ++-- dshr/dshr_mod.F90 | 4 +--- dwav/wav_comp_nuopc.F90 | 4 ++-- streams/dshr_strdata_mod.F90 | 17 ++++++++++++++--- 9 files changed, 29 insertions(+), 19 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index aa2801466..f49db0ca6 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -450,7 +450,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, compid, and logunit call ESMF_TraceRegionEnter('datm_strdata_init') - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -459,7 +459,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ATM', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ATM', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_strdata_init') diff --git a/dglc/glc_comp_nuopc.F90 b/dglc/glc_comp_nuopc.F90 index de2f1f001..e7ada6953 100644 --- a/dglc/glc_comp_nuopc.F90 +++ b/dglc/glc_comp_nuopc.F90 @@ -400,7 +400,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize stream data type if (trim(datamode) /= 'noevolve') then - call shr_strdata_init_from_config(sdat(ns), streamfilename, model_meshes(ns), clock, 'GLC', logunit, rc=rc) + call shr_strdata_init_from_config(sdat(ns), streamfilename, model_meshes(ns), nx_global(ns), ny_global(ns), & + clock, 'GLC', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index b3dd1dbe7..6a328923e 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -326,7 +326,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('dice_strdata_init') - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -335,7 +335,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ICE', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ICE', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dice_strdata_init') diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 7a7d4d049..045aaeb5c 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -288,7 +288,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat call ESMF_TraceRegionEnter('dlnd_strdata_init') - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) ! Initialize stream data type @@ -296,7 +296,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'LND', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dlnd_strdata_init') diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index e9d275060..013aae46f 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -398,7 +398,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -408,7 +408,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'OCN', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'OCN', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if call ESMF_TraceRegionExit('docn_strdata_init') diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 06d837069..9693778a2 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -287,7 +287,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('drof_strdata_init') - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -296,7 +296,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FOX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ROF', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ROF', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('drof_strdata_init') diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index c0f6afff3..f36ee48b7 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -235,7 +235,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, end subroutine dshr_init !=============================================================================== - subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, model_nyg, & + subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, read_restart, rc) ! ---------------------------------------------- @@ -248,8 +248,6 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo integer , intent(in) :: logunit character(len=*) , intent(in) :: compname !e.g. ATM, OCN, ... character(len=*) , intent(in) :: nullstr - integer , intent(in) :: model_nxg - integer , intent(in) :: model_nyg character(len=*) , intent(in) :: model_meshfile character(len=*) , intent(in) :: model_maskfile type(ESMF_Mesh) , intent(out) :: model_mesh diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index dd0e92c69..39f367a2e 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -279,7 +279,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat - create the model domain mesh and intialize the sdat clock call ESMF_TraceRegionEnter('dwav_strdata_init') - call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', & model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -288,7 +288,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'WAV', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'WAV', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dwav_strdata_init') diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 0085a9952..1489ba918 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -127,8 +127,6 @@ module dshr_strdata_mod type(ESMF_Mesh) :: model_mesh ! model mesh real(r8), pointer :: model_lon(:) => null() ! model longitudes real(r8), pointer :: model_lat(:) => null() ! model latitudes - integer :: model_nxg ! model global domain lon size - integer :: model_nyg ! model global domain lat size integer :: model_nzg ! model global domain vertical size integer :: model_lsize ! model local domain size integer, pointer :: model_gindex(:) ! model global index spzce @@ -188,12 +186,15 @@ type(ESMF_FieldBundle) function shr_strdata_get_stream_fieldbundle(sdat, ns, nam end function shr_strdata_get_stream_fieldbundle !=============================================================================== - subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, compname, logunit, rc) + subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, model_nxg, model_nyg, & + clock, compname, logunit, rc) ! input/output variables type(shr_strdata_type) , intent(inout) :: sdat character(len=*) , intent(in) :: streamfilename type(ESMF_Mesh) , intent(in) :: model_mesh + integer , intent(in) :: model_nxg ! model global domain lon size + integer , intent(in) :: model_nyg ! model global domain lat size type(ESMF_Clock) , intent(in) :: clock character(len=*) , intent(in) :: compname integer , intent(in) :: logunit @@ -250,6 +251,16 @@ subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, call shr_strdata_init_model_domain(sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Verify that the declared global grid dimensions are consistent with the total number of points + ! in the model mesh (model_gsize was just computed by shr_strdata_init_model_domain). + if (model_nxg * model_nyg /= sdat%model_gsize) then + call shr_log_error(subname//' ERROR: for component '//trim(compname)// & + ', nx*ny ('//toString(model_nxg*model_nyg)// & + ') does not equal the total number of points in the model mesh ('// & + toString(sdat%model_gsize)//')', rc=rc) + return + end if + ! Now finish initializing sdat call shr_strdata_init(sdat, clock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 3d766012009c8a01e8dfc36ea797ec1be4bb062e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 10 Jul 2026 11:54:51 -0600 Subject: [PATCH 2/2] Bypass nx*ny check for single-column runs This is a workaround for https://github.com/ESCOMP/CDEPS/issues/419 and can probably be removed once that issue is resolved. --- datm/atm_comp_nuopc.F90 | 6 ++++-- dglc/glc_comp_nuopc.F90 | 2 +- dice/ice_comp_nuopc.F90 | 6 ++++-- dlnd/lnd_comp_nuopc.F90 | 6 ++++-- docn/ocn_comp_nuopc.F90 | 6 ++++-- drof/rof_comp_nuopc.F90 | 6 ++++-- dshr/dshr_mod.F90 | 6 +++++- dwav/wav_comp_nuopc.F90 | 6 ++++-- streams/dshr_strdata_mod.F90 | 30 +++++++++++++++++++++--------- 9 files changed, 51 insertions(+), 23 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index f49db0ca6..da37e5e49 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -433,6 +433,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run integer(i8) :: stepno ! step number real(r8) :: nextsw_cday ! calendar of next atm sw character(CL) :: cvalue ! character string for input config @@ -451,7 +452,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, compid, and logunit call ESMF_TraceRegionEnter('datm_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -459,7 +460,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ATM', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'ATM', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_strdata_init') diff --git a/dglc/glc_comp_nuopc.F90 b/dglc/glc_comp_nuopc.F90 index e7ada6953..dc6de435d 100644 --- a/dglc/glc_comp_nuopc.F90 +++ b/dglc/glc_comp_nuopc.F90 @@ -401,7 +401,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize stream data type if (trim(datamode) /= 'noevolve') then call shr_strdata_init_from_config(sdat(ns), streamfilename, model_meshes(ns), nx_global(ns), ny_global(ns), & - clock, 'GLC', logunit, rc=rc) + is_scol=.false., clock=clock, compname='GLC', logunit=logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 6a328923e..ab5ca3f00 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -310,6 +310,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run real(R8) :: cosarg ! for setting ice temp pattern real(R8) :: jday, jday0 ! elapsed day counters integer :: model_dt ! integer model timestep @@ -327,7 +328,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('dice_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -335,7 +336,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ICE', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'ICE', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dice_strdata_init') diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 045aaeb5c..b4017d31c 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -280,6 +280,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run character(len=cl) :: rpfile ! restart pointer file name character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -289,14 +290,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat call ESMF_TraceRegionEnter('dlnd_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) ! Initialize stream data type streamfilename = 'dlnd.streams'//trim(inst_suffix) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'LND', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dlnd_strdata_init') diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 013aae46f..973843846 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -370,6 +370,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run type(ESMF_Field) :: lfield character(CL) ,pointer :: lfieldnamelist(:) => null() integer :: fieldcount @@ -399,7 +400,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet @@ -408,7 +409,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'OCN', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'OCN', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if call ESMF_TraceRegionExit('docn_strdata_init') diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 9693778a2..1b4330f35 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -280,6 +280,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !-------------------------------- @@ -288,7 +289,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('drof_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -296,7 +297,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FOX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'ROF', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'ROF', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('drof_strdata_init') diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index f36ee48b7..a858721f6 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -236,7 +236,7 @@ end subroutine dshr_init !=============================================================================== subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, read_restart, rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, read_restart, is_scol, rc) ! ---------------------------------------------- ! Initialize model mesh @@ -254,6 +254,7 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, & integer , pointer , intent(out) :: model_mask(:) real(r8), pointer , intent(out) :: model_frac(:) logical , intent(out) :: read_restart + logical , intent(out) :: is_scol ! true if this is a single-column run integer , intent(out) :: rc ! local variables @@ -320,11 +321,14 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, & if (scol_lon > scol_spval .and. scol_lat > scol_spval) then ! This is simply a single point run + is_scol = .true. call dshr_mesh_create_scol(gcomp, compname, scol_lon, scol_lat, model_mesh, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else + is_scol = .false. + ! check that model_meshfile and model_maskfile exists if (my_task == main_task) then inquire(file=trim(model_meshfile), exist=exists) diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 39f367a2e..84b916fb0 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -271,6 +271,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date + logical :: is_scol ! true if this is a single-column run character(len=CL):: rpfile character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -280,7 +281,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat - create the model domain mesh and intialize the sdat clock call ESMF_TraceRegionEnter('dwav_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', & - model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, is_scol, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet @@ -288,7 +289,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) #ifndef DISABLE_FoX streamfilename = trim(streamfilename)//'.xml' #endif - call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, clock, 'WAV', logunit, rc=rc) + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, nx_global, ny_global, is_scol, & + clock, 'WAV', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dwav_strdata_init') diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 1489ba918..99ede852c 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -186,7 +186,7 @@ type(ESMF_FieldBundle) function shr_strdata_get_stream_fieldbundle(sdat, ns, nam end function shr_strdata_get_stream_fieldbundle !=============================================================================== - subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, model_nxg, model_nyg, & + subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, model_nxg, model_nyg, is_scol, & clock, compname, logunit, rc) ! input/output variables @@ -195,6 +195,7 @@ subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, model_ type(ESMF_Mesh) , intent(in) :: model_mesh integer , intent(in) :: model_nxg ! model global domain lon size integer , intent(in) :: model_nyg ! model global domain lat size + logical , intent(in) :: is_scol ! true if this is a single-column run type(ESMF_Clock) , intent(in) :: clock character(len=*) , intent(in) :: compname integer , intent(in) :: logunit @@ -251,14 +252,25 @@ subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, model_ call shr_strdata_init_model_domain(sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Verify that the declared global grid dimensions are consistent with the total number of points - ! in the model mesh (model_gsize was just computed by shr_strdata_init_model_domain). - if (model_nxg * model_nyg /= sdat%model_gsize) then - call shr_log_error(subname//' ERROR: for component '//trim(compname)// & - ', nx*ny ('//toString(model_nxg*model_nyg)// & - ') does not equal the total number of points in the model mesh ('// & - toString(sdat%model_gsize)//')', rc=rc) - return + ! Verify that the declared global grid dimensions are consistent with the total number + ! of points in the model mesh (model_gsize was just computed by + ! shr_strdata_init_model_domain). + ! + ! This check is bypassed for single-column runs as a workaround for a bug in the + ! single-column logic (https://github.com/ESCOMP/CDEPS/issues/419): in single-column + ! runs, model_nxg and model_nyg incorrectly keep their full global grid sizes while + ! the single-column mesh has exactly 1 point. + ! + ! TODO: remove the is_scol bypass (and possibly the is_scol argument) once + ! single-column runs set nx_global and ny_global correctly (i.e., to 1). + if (.not. is_scol) then + if (model_nxg * model_nyg /= sdat%model_gsize) then + call shr_log_error(subname//' ERROR: for component '//trim(compname)// & + ', nx*ny ('//toString(model_nxg*model_nyg)// & + ') does not equal the total number of points in the model mesh ('// & + toString(sdat%model_gsize)//')', rc=rc) + return + end if end if ! Now finish initializing sdat