Skip to content

Commit e2e437c

Browse files
committed
Added timers. Reading topology from hconfig
1 parent ff184e8 commit e2e437c

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

DynCore_GridCompMod.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module FVdycoreCubed_GridComp
4343
use mapl3g_generic, only: MAPL_GridCompSetEntryPoint, MAPL_GridCompGetInternalState
4444
use mapl3g_generic, only: MAPL_GridCompAddSpec, MAPL_STATEITEM_FIELDBUNDLE
4545
use mapl3g_generic, only: MAPL_UserCompSetInternalState, MAPL_UserCompGetInternalState
46-
! use mapl3g_generic, only: MAPL_GridCompTimerStart, MAPL_GridCompTimerStop
46+
use mapl3g_generic, only: MAPL_GridCompTimerStart, MAPL_GridCompTimerStop
4747
use mapl3g_VerticalStaggerLoc, only: VERTICAL_STAGGER_NONE, VERTICAL_STAGGER_CENTER, VERTICAL_STAGGER_EDGE
4848
use mapl3g_Geom_API, only: MAPL_GridGetCoordinates
4949
use mapl3g_State_API, only: MAPL_StateGetPointer
@@ -459,9 +459,9 @@ subroutine Initialize(gc, import, export, clock, rc)
459459
integer :: i, numTracers, status
460460

461461
! Setup FMS/FV3
462-
! call MAPL_GridCompTimerStart(gc, "DynSetup", _RC)
462+
call MAPL_GridCompTimerStart(gc, "DynSetup", _RC)
463463
call DynSetup(gc, _RC)
464-
! call MAPL_GridCompTimerStop(gc, "DynSetup", _RC)
464+
call MAPL_GridCompTimerStop(gc, "DynSetup", _RC)
465465

466466
! Get the private state
467467
_GET_NAMED_PRIVATE_STATE(gc, DynState, PRIVATE_STATE, self)
@@ -477,9 +477,9 @@ subroutine Initialize(gc, import, export, clock, rc)
477477
! Set Private Internal State from Restart File
478478
call MAPL_GridCompGetInternalState(gc, internal, _RC)
479479

480-
! call MAPL_GridCompTimerStart(gc, "DynInit", _RC)
480+
call MAPL_GridCompTimerStart(gc, "DynInit", _RC)
481481
call DynInit(self, clock, import, gc, _RC)
482-
! call MAPL_GridCompTimerStop(gc, "DynInit", _RC)
482+
call MAPL_GridCompTimerStop(gc, "DynInit", _RC)
483483

484484
! Create PLE and PREF EXPORT Coupling (Needs to be done only once per run)
485485
call MAPL_StateGetPointer(internal, ak, "AK", _RC)

DynCore_StateSpecs.rc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ category: EXPORT
5959
ZLE | edge_heights | m | xyz | E | |
6060
ZL | mid_layer_heights | m | xyz | C | |
6161
S | mid_layer_dry_static_energy | m | xyz | C | |
62-
# PLE | edge_pressure | Pa | xyz | E | |
6362
TH | potential_temperature | K | xyz | C | |
6463
PLK | mid-layer_p$^\kappa$ | Pa$^\kappa$ | xyz | C | |
6564
PKE | edge_p$^\kappa$ | Pa$^\kappa$ | xyz | E | |
@@ -100,8 +99,6 @@ category: EXPORT
10099
DQLDTDYN | tendency_of_liquid_water_due_to_dynamics | kg/kg/s | xyz | C | |
101100
DOXDTDYN | tendency_of_ozone_due_to_dynamics | mol mol-1 s-1 | xyz | C | |
102101
PREF | reference_air_pressure | Pa | z | E | |
103-
# AK | hybrid_sigma_pressure_a | 1 | z | E | |
104-
# BK | hybrid_sigma_pressure_b | 1 | z | E | |
105102
PHIS | surface_height | m | xy | N | |
106103
PS | surface_pressure | Pa | xy | N | |
107104
TA | surface_air_temperature | K | xy | N | |

FV_StateMod.F90

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)