@@ -66,7 +66,7 @@ module AdvCore_GridCompMod
6666 use fv_grid_utils_mod, only: g_sum
6767
6868 USE FV_StateMod, only: AdvCoreTracers = > T_TRACERS
69- USE FV_StateMod, only: FV_Atm
69+ USE FV_StateMod, only: FV_Atm, FV_setup
7070 use CubeGridPrototype, only: register_grid_and_regridders
7171
7272 implicit none
@@ -129,6 +129,7 @@ subroutine SetServices(GC, rc)
129129 type (ESMF_VM) :: VM
130130 integer :: comm, ndt
131131 integer :: p_split= 1
132+ character (len= ESMF_MAXSTR) :: LAYOUT_FILE
132133
133134! =============================================================================
134135
@@ -253,75 +254,34 @@ subroutine SetServices(GC, rc)
253254 call MAPL_GridCompSetEntryPoint ( gc, ESMF_METHOD_FINALIZE, Finalize, RC= status)
254255 VERIFY_(STATUS)
255256
256- ! Check if AdvCore is running without FV3_DynCoreIsRunning, if yes then setup the MAPL Grid
257- ! ----------------------------------------------------------------------------
257+ ! Check if AdvCore is running without FV3_DynCoreIsRunning, if yes then setup the MAPL Grid
258+ ! ----------------------------------------------------------------------------
258259 call MAPL_GetObjectFromGC (GC, MAPL, RC= STATUS )
259260 VERIFY_(STATUS)
260261 call MAPL_GetResource(MAPL, DYCORE, ' DYCORE:' , default= " " , RC= STATUS )
261262 VERIFY_(STATUS)
262263 call MAPL_GetResource(MAPL, AdvCore_Advection , label= ' AdvCore_Advection:' , &
263264 default= AdvCore_Advection, RC= STATUS )
264265 VERIFY_(STATUS)
265- if (adjustl (DYCORE)==" FV3" ) FV3_DynCoreIsRunning = .true.
266- if (adjustl (DYCORE)==" FV3+ADV" ) FV3_DynCoreIsRunning = .true.
267266
268- ! Start up FMS/MPP
269- !- ------------------------------------------
270- call ESMF_VMGet(VM,mpiCommunicator= comm,rc= STATUS)
271- VERIFY_(STATUS)
272- call fms_init(comm)
267+ ! Setup FMS/FV3
268+ !- -------------
269+ call MAPL_GetResource ( MAPL, LAYOUT_FILE, ' LAYOUT:' , default= ' fvcore_layout.rc' , rc= status )
273270 VERIFY_(STATUS)
271+ call FV_Setup(GC, LAYOUT_FILE)
274272
275- if (.NOT. FV3_DynCoreIsRunning) then
276- ! Make sure FV3 is setup
277- ! -----------------------
278- call register_grid_and_regridders()
279- call fv_init1(FV_Atm, dt, grids_on_my_pe, p_split)
280- ! Get Domain decomposition
281- !- ------------------------
282- call MAPL_GetResource( MAPL, nx, ' NX:' , default= 0 , RC= STATUS )
283- VERIFY_(STATUS)
284- FV_Atm(1 )% layout(1 ) = nx
285- call MAPL_GetResource( MAPL, ny, ' NY:' , default= 0 , RC= STATUS )
286- VERIFY_(STATUS)
287- if (FV_Atm(1 )% flagstruct% grid_type == 4 ) then
288- FV_Atm(1 )% layout(2 ) = ny
289- else
290- FV_Atm(1 )% layout(2 ) = ny / 6
291- end if
292- ! Get Resolution Information
293- !- --------------------------
294- ! FV grid dimensions setup from MAPL
295- call MAPL_GetResource( MAPL, FV_Atm(1 )% flagstruct% npx, ' IM:' , default= 32 , RC= STATUS )
296- VERIFY_(STATUS)
297- call MAPL_GetResource( MAPL, FV_Atm(1 )% flagstruct% npy, ' JM:' , default= 192 , RC= STATUS )
298- VERIFY_(STATUS)
299- call MAPL_GetResource( MAPL, FV_Atm(1 )% flagstruct% npz, ' LM:' , default= 72 , RC= STATUS )
300- VERIFY_(STATUS)
301- ! FV likes npx;npy in terms of cell vertices
302- if (FV_Atm(1 )% flagstruct% npy == 6 * FV_Atm(1 )% flagstruct% npx) then
303- FV_Atm(1 )% flagstruct% ntiles = 6
304- FV_Atm(1 )% flagstruct% npy = FV_Atm(1 )% flagstruct% npx+1
305- FV_Atm(1 )% flagstruct% npx = FV_Atm(1 )% flagstruct% npx+1
306- else
307- FV_Atm(1 )% flagstruct% ntiles = 1
308- FV_Atm(1 )% flagstruct% npy = FV_Atm(1 )% flagstruct% npy+1
309- FV_Atm(1 )% flagstruct% npx = FV_Atm(1 )% flagstruct% npx+1
310- endif
311- endif
273+ ! Register prototype of cubed sphere grid and associated regridders
274+ !- -----------------------------------------------------------------
275+ call register_grid_and_regridders()
312276
277+ ! Read DT in case it is ever used by offline_tracer_advection
278+ !- -----------------------------------------------------------
313279 call MAPL_GetResource( MAPL, ndt, ' RUN_DT:' , default= 0 , RC= STATUS )
314280 VERIFY_(STATUS)
315281 DT = ndt
316282
317- ! Start up FV if AdvCore is running without FV3_DynCoreIsRunning
318- !- -------------------------------------------------
319- if (.NOT. FV3_DynCoreIsRunning) then
320- call fv_init2(FV_Atm, dt, grids_on_my_pe, p_split)
321- end if
322-
323- ! Ending with a Generic SetServices call is a MAPL requirement
324- !- ------------------------------------------------------------
283+ ! Ending with a Generic SetServices call is a MAPL requirement
284+ !- ------------------------------------------------------------
325285 call MAPL_GenericSetServices ( GC, rc= STATUS)
326286 VERIFY_(STATUS)
327287
0 commit comments