@@ -15,7 +15,7 @@ module FV_StateMod
1515 use FileIOSharedMod, only: WRITE_PARALLEL
1616
1717 use mapl3g_generic, only: MAPL_GridCompGetResource, MAPL_GridCompGet, MAPL_GridCompGetInternalState
18- ! use mapl3g_generic, only: MAPL_GridCompTimerStart, MAPL_GridCompTimerStop
18+ use mapl3g_generic, only: MAPL_GridCompTimerStart, MAPL_GridCompTimerStop
1919 use mapl3g_Geom_API, only: MAPL_GridGet ! , MAPL_GeomGet
2020 use mapl3g_State_API, only: MAPL_StateGetPointer
2121#endif
@@ -322,8 +322,7 @@ subroutine FV_Setup(gc, rc)
322322 character (len= :), allocatable :: DYCORE
323323 real (FVPRC) :: DT
324324 real :: temp_real
325- integer :: comm, ndt, nx, ny, status, p_split= 1 , im_world, num_levels
326- integer , allocatable :: topology(:)
325+ integer :: comm, ndt, nx, ny, status, p_split= 1 , im_world, num_levels, topology(2 )
327326 class(logger_t), pointer :: logger
328327
329328 call MAPL_GridCompGet(gc, logger= logger, _RC)
@@ -333,20 +332,20 @@ subroutine FV_Setup(gc, rc)
333332 call MAPL_MemUtilsWrite(vm, trim (Iam), _RC)
334333
335334 call ESMF_VMGet(vm, mpiCommunicator= comm, _RC)
336- ! call MAPL_GridCompTimerStart(gc, "fms_init", _RC)
335+ call MAPL_GridCompTimerStart(gc, " fms_init" , _RC)
337336 call fms_init(comm)
338- ! call MAPL_GridCompTimerStop(gc, "fms_init", _RC)
337+ call MAPL_GridCompTimerStop(gc, " fms_init" , _RC)
339338 call MAPL_MemUtilsWrite(vm, ' FV_StateMod::fms_init' , _RC)
340339
341340 ! Start up FV
342- ! call MAPL_GridCompTimerStart(gc, "fv_init1", _RC)
341+ call MAPL_GridCompTimerStart(gc, " fv_init1" , _RC)
343342 call fv_init1(FV_Atm, DT, grids_on_this_pe, p_split)
344- ! call MAPL_GridCompTimerStop(gc, "fv_init1", _RC)
343+ call MAPL_GridCompTimerStop(gc, " fv_init1" , _RC)
345344 call MAPL_MemUtilsWrite(vm, ' FV_StateMod::fv_init1' , _RC)
346345
347346 ! FV grid dimensions setup from MAPL
348347 call MAPL_GridCompGet(gc, hconfig= hconfig, num_levels= num_levels, _RC)
349- im_world = get_im_world (hconfig, _RC)
348+ call get_im_world_and_topology (hconfig, im_world, topology , _RC)
350349 associate(flags = > FV_Atm(1 )% flagstruct)
351350 flags% npx = im_world
352351 flags% npy = im_world * 6
@@ -379,7 +378,7 @@ subroutine FV_Setup(gc, rc)
379378 ! call MAPL_GridCompGet(gc, geom=geom, _RC)
380379 ! call MAPL_GeomGet(geom, topology, _RC)
381380 associate(layout = > FV_Atm(1 )% layout)
382- layout = [ 2 , 1 ]
381+ layout = topology
383382 if (FV_Atm(1 )% flagstruct% grid_type == 4 ) then
384383 layout(2 ) = layout(2 ) * 6
385384 end if
@@ -667,9 +666,9 @@ subroutine FV_Setup(gc, rc)
667666 endif
668667
669668 ! Start up FV
670- ! call MAPL_GridCompTimerStart(gc, "fv_init2", _RC)
669+ call MAPL_GridCompTimerStart(gc, " fv_init2" , _RC)
671670 call fv_init2(FV_Atm, DT, grids_on_this_pe, p_split)
672- ! call MAPL_GridCompTimerStop(gc, "fv_init2", _RC)
671+ call MAPL_GridCompTimerStop(gc, " fv_init2" , _RC)
673672 call MAPL_MemUtilsWrite(VM, ' FV_StateMod::fv_init2' , _RC)
674673
675674 ! Force compatibility of gmao_remap and n_zfilter
@@ -701,14 +700,15 @@ subroutine FV_Setup(gc, rc)
701700 _RETURN(_SUCCESS)
702701 end subroutine FV_Setup
703702
704- function get_im_world (hconfig , rc ) result( im_world)
703+ subroutine get_im_world_and_topology (hconfig , im_world , topology , rc )
705704 type (ESMF_HConfig), intent (in ) :: hconfig
706705 integer , optional , intent (out ) :: rc
707- integer :: im_world ! result
706+ integer , intent (out ) :: im_world
707+ integer , intent (out ) :: topology(2 )
708708
709709 type (ESMF_HConfig) :: geometry_cfg, geom_cfg
710710 logical :: has_section
711- integer :: status
711+ integer :: nx_face, ny_face, status
712712
713713 has_section = ESMF_HConfigIsDefined(hconfig, keyString= " geometry" , _RC)
714714 _ASSERT(has_section, " hconfig is missing geometry section" )
@@ -718,12 +718,15 @@ function get_im_world(hconfig, rc) result(im_world)
718718 geom_cfg = ESMF_HConfigCreateAt(geometry_cfg, keyString= " esmf_geom" , _RC)
719719
720720 im_world = ESMF_HConfigAsI4(geom_cfg, keyString= " im_world" , _RC)
721+ nx_face = ESMF_HConfigAsI4(geom_cfg, keyString= " nx_face" , _RC)
722+ ny_face = ESMF_HConfigAsI4(geom_cfg, keyString= " ny_face" , _RC)
723+ topology = [nx_face, ny_face]
721724
722725 call ESMF_HConfigDestroy(geometry_cfg, _RC)
723726 call ESMF_HConfigDestroy(geom_cfg, _RC)
724727
725728 _RETURN(_SUCCESS)
726- end function get_im_world
729+ end subroutine get_im_world_and_topology
727730
728731 subroutine FV_InitState (state , clock , import , gc , rc )
729732
@@ -1688,7 +1691,7 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
16881691
16891692 ! Check Dry Mass (Apply fixer is option is enabled)
16901693 if ( check_mass .OR. fix_mass ) then
1691- ! call MAPL_GridCompTimerStart(gc, "mass_fix", _RC)
1694+ call MAPL_GridCompTimerStart(gc, " mass_fix" , _RC)
16921695
16931696
16941697 if ( FV_Atm(1 )% flagstruct% adjust_dry_mass .AND. &
@@ -1808,10 +1811,10 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
18081811
18091812 endif
18101813
1811- ! call MAPL_GridCompTimerStop(gc, "mass_fix", _RC)
1814+ call MAPL_GridCompTimerStop(gc, " mass_fix" , _RC)
18121815 endif
18131816
1814- ! call MAPL_GridCompTimerStart(gc, "NH_ADIABATIC_INIT", _RC)
1817+ call MAPL_GridCompTimerStart(gc, " NH_ADIABATIC_INIT" , _RC)
18151818 if ((.not. FV_Atm(1 )% flagstruct% hydrostatic) .and. (FV_Atm(1 )% flagstruct% na_init> 0 )) then
18161819 allocate ( DEBUG_ARRAY(isc:iec,jsc:jec,NPZ) )
18171820 call nullify_domain ( )
@@ -1823,9 +1826,9 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
18231826 deallocate ( DEBUG_ARRAY )
18241827 FV_Atm(1 )% flagstruct% na_init= 0
18251828 endif
1826- ! call MAPL_GridCompTimerStop(gc,"NH_ADIABATIC_INIT", _RC)
1829+ call MAPL_GridCompTimerStop(gc," NH_ADIABATIC_INIT" , _RC)
18271830
1828- ! call MAPL_GridCompTimerStart(gc, "FV_DYNAMICS", _RC)
1831+ call MAPL_GridCompTimerStart(gc, " FV_DYNAMICS" , _RC)
18291832 if (.not. FV_OFF) then
18301833 call set_domain(FV_Atm(1 )% domain) ! needed for diagnostic output done in fv_dynamics
18311834 allocate ( u_dt(isc:iec,jsc:jec,npz) )
@@ -1932,7 +1935,7 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
19321935 call nullify_domain()
19331936
19341937 endif
1935- ! call MAPL_GridCompTimerStop(gc, "FV_DYNAMICS", _RC)
1938+ call MAPL_GridCompTimerStop(gc, " FV_DYNAMICS" , _RC)
19361939
19371940 SPHU_FILLED = .FALSE.
19381941 QLIQ_FILLED = .FALSE.
0 commit comments