Skip to content

Commit a863d5d

Browse files
committed
Using MAPL_GridGetCoordinates to retrieve lat/lon
Also turned off the timers till new timers are available in MAPL3
1 parent 803e169 commit a863d5d

File tree

2 files changed

+31
-71
lines changed

2 files changed

+31
-71
lines changed

DynCore_GridCompMod.F90

Lines changed: 12 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ 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
4647
use mapl3g_VerticalStaggerLoc, only: VERTICAL_STAGGER_NONE, VERTICAL_STAGGER_CENTER, VERTICAL_STAGGER_EDGE
47-
use mapl3g_Geom_API, only: MAPL_GridGet
48+
use mapl3g_Geom_API, only: MAPL_GridGetCoordinates
4849
use mapl3g_State_API, only: MAPL_StateGetPointer
4950
use mapl3g_Field_API, only: MAPL_FieldCreate
5051
use mapl3g_FieldBundle_API, only: MAPL_FieldBundleAdd
@@ -389,21 +390,6 @@ Subroutine SetServices(gc, rc)
389390
! 6 ints: YYYY MM DD H M S
390391
! 5 ints: I,J,K, KS (num true pressure levels), NQ (num tracers) headers
391392

392-
! ! Set the Profiling timers
393-
! call MAPL_TimerAdd(gc, name="INITIALIZE", _RC)
394-
! call MAPL_TimerAdd(gc, name="RUN", _RC)
395-
! call MAPL_TimerAdd(gc, name="RUN2", _RC)
396-
! call MAPL_TimerAdd(gc, name="-DYN_INIT", _RC)
397-
! call MAPL_TimerAdd(gc, name="--FMS_INIT", _RC)
398-
! call MAPL_TimerAdd(gc, name="--FV_INIT", _RC)
399-
! call MAPL_TimerAdd(gc, name="-DYN_ANA", _RC)
400-
! call MAPL_TimerAdd(gc, name="-DYN_PROLOGUE", _RC)
401-
! call MAPL_TimerAdd(gc, name="-DYN_CORE", _RC)
402-
! call MAPL_TimerAdd(gc, name="-DYN_EPILOGUE", _RC)
403-
! call MAPL_TimerAdd(gc, name="--FV_DYNAMICS", _RC)
404-
! call MAPL_TimerAdd(gc, name="--MASS_FIX", _RC)
405-
! call MAPL_TimerAdd(gc, name="FINALIZE", _RC)
406-
407393
! Register services for this component
408394
call MAPL_GridCompSetEntryPoint(gc, ESMF_Method_Initialize, Initialize, _RC)
409395
call MAPL_GridCompSetEntryPoint(gc, ESMF_Method_Run, Run, phase_name="Run", _RC)
@@ -472,12 +458,10 @@ subroutine Initialize(gc, import, export, clock, rc)
472458
integer :: ifirst, ilast, jfirst, jlast, km
473459
integer :: i, numTracers, status
474460

475-
! ! Start the timers
476-
! call MAPL_TimerOn(MAPL, "TOTAL")
477-
! call MAPL_TimerOn(MAPL, "INITIALIZE")
478-
479461
! Setup FMS/FV3
462+
! call MAPL_GridCompTimerStart(gc, "DynSetup", _RC)
480463
call DynSetup(gc, _RC)
464+
! call MAPL_GridCompTimerStop(gc, "DynSetup", _RC)
481465

482466
! Get the private state
483467
_GET_NAMED_PRIVATE_STATE(gc, DynState, PRIVATE_STATE, self)
@@ -493,9 +477,9 @@ subroutine Initialize(gc, import, export, clock, rc)
493477
! Set Private Internal State from Restart File
494478
call MAPL_GridCompGetInternalState(gc, internal, _RC)
495479

496-
! call MAPL_TimerOn(MAPL, "-DYN_INIT")
480+
! call MAPL_GridCompTimerStart(gc, "DynInit", _RC)
497481
call DynInit(self, clock, import, gc, _RC)
498-
! call MAPL_TimerOff(MAPL, "-DYN_INIT")
482+
! call MAPL_GridCompTimerStop(gc, "DynInit", _RC)
499483

500484
! Create PLE and PREF EXPORT Coupling (Needs to be done only once per run)
501485
call MAPL_StateGetPointer(internal, ak, "AK", _RC)
@@ -593,9 +577,6 @@ subroutine Initialize(gc, import, export, clock, rc)
593577

594578
!========End intermittent replay========================
595579

596-
! call MAPL_TimerOff(MAPL,"INITIALIZE")
597-
! call MAPL_TimerOff(MAPL,"TOTAL")
598-
599580
_RETURN(_SUCCESS)
600581
end subroutine Initialize
601582

@@ -784,7 +765,7 @@ subroutine Run(gc, import, export, clock, rc)
784765
character(len=:), allocatable :: uname, vname, tname, qname, psname, dpname, o3name, rgrid, tvar
785766

786767
! type(MAPL_SunOrbit) :: ORBIT
787-
real(r4), pointer :: lats(:,:), lons(:,:)
768+
real(r4), allocatable :: lats(:,:), lons(:,:)
788769
real(r4), allocatable :: ZTH(:,:), SLR(:,:)
789770

790771
real :: rc_blend_p_above, rc_blend_p_below, sclinc
@@ -814,10 +795,7 @@ subroutine Run(gc, import, export, clock, rc)
814795
call MAPL_GridCompGet(gc, grid=esmfgrid, hconfig=hconfig, logger=logger, _RC)
815796
call ESMF_GridValidate(esmfgrid, _RC)
816797

817-
! call MAPL_TimerOn(MAPL, "TOTAL")
818-
! call MAPL_TimerOn(MAPL, "RUN")
819-
820-
call MAPL_GridGet(esmfgrid, longitudes=lons, latitudes=lats, _RC)
798+
call MAPL_GridGetCoordinates(esmfgrid, longitudes=lons, latitudes=lats, _RC)
821799
call MAPL_StateGetPointer(export, temp2d, "LONS", _RC)
822800
if( associated(temp2D) ) temp2d = lons
823801
call MAPL_StateGetPointer(export, temp2d, "LATS", _RC)
@@ -2785,9 +2763,6 @@ subroutine Run(gc, import, export, clock, rc)
27852763

27862764
call freeTracers(self)
27872765

2788-
! call MAPL_TimerOff(MAPL, "RUN")
2789-
! call MAPL_TimerOff(MAPL, "TOTAL")
2790-
27912766
!if (ADIABATIC) then
27922767
! ! Fill Exports
27932768
! call RunAddIncs(gc, import, export, clock, rc)
@@ -3724,10 +3699,6 @@ subroutine RunAddIncs(gc, import, export, clock, rc)
37243699
class(logger_t), pointer :: logger
37253700

37263701
call MAPL_GridCompGet(gc, grid=esmfgrid, logger=logger, _RC)
3727-
call logger%info("RunAddIncs:: starting...")
3728-
3729-
! call MAPL_TimerOn(GENSTATE,"TOTAL")
3730-
! call MAPL_TimerOn(GENSTATE,"RUN2")
37313702

37323703
! Retrieve the pointer to the internal state
37333704
_GET_NAMED_PRIVATE_STATE(gc, DynState, PRIVATE_STATE, self)
@@ -4276,10 +4247,6 @@ subroutine RunAddIncs(gc, import, export, clock, rc)
42764247

42774248
end if ! .not. SW_DYNAMICS
42784249

4279-
! call MAPL_TimerOff(GENSTATE,"RUN2")
4280-
! call MAPL_TimerOff(GENSTATE,"TOTAL")
4281-
4282-
call logger%info("RunAddIncs:: ...complete")
42834250
_RETURN(_SUCCESS)
42844251
end subroutine RunAddIncs
42854252

@@ -4310,7 +4277,7 @@ subroutine ADD_INCS(esmfgrid, self, import, DT, is_weighted, rc)
43104277
integer :: isd, ied, jsd, jed
43114278
real(r4), allocatable :: fvQOLD(:,:,:), QTEND(:,:,:)
43124279
real(r4), pointer :: tend(:,:,:)
4313-
real(r4), pointer, dimension(:,:) :: lons, lats
4280+
real(r4), allocatable, dimension(:,:) :: lons, lats
43144281
real(r8), allocatable :: DPNEW(:,:,:), DPOLD(:,:,:)
43154282
real(r8), allocatable :: tend_ua(:,:,:), tend_va(:,:,:)
43164283
real(r8), allocatable :: tend_un(:,:,:), tend_vn(:,:,:)
@@ -4341,7 +4308,7 @@ subroutine ADD_INCS(esmfgrid, self, import, DT, is_weighted, rc)
43414308

43424309
! call MAPL_Get( MAPL, LONS=LONS, LATS=LATS, RC=STATUS )
43434310
! VERIFY_(STATUS)
4344-
call MAPL_GridGet(esmfgrid, latitudes=lats, longitudes=lons, _RC)
4311+
call MAPL_GridGetCoordinates(esmfgrid, latitudes=lats, longitudes=lons, _RC)
43454312

43464313
! **********************************************************************
43474314
! **** Use QV from FV3 init when coldstarting idealized cases ****
@@ -4788,21 +4755,11 @@ subroutine Finalize(gc, import, export, clock, rc)
47884755
integer :: status
47894756
class(logger_t), pointer :: logger
47904757

4791-
call MAPL_GridCompGet(gc, logger=logger, _RC)
4792-
call logger%info("Finalize:: starting...")
4793-
4794-
! call MAPL_TimerOn(MAPL,"TOTAL")
4795-
! call MAPL_TimerOn(MAPL,"FINALIZE")
4796-
47974758
! Retrieve the pointer to the state
47984759
_GET_NAMED_PRIVATE_STATE(gc, DynState, PRIVATE_STATE, self)
47994760

48004761
call DynFinalize(self)
48014762

4802-
! call MAPL_TimerOff(MAPL,"FINALIZE")
4803-
! call MAPL_TimerOff(MAPL,"TOTAL")
4804-
4805-
call logger%info("Finalize:: ...complete")
48064763
_RETURN(_SUCCESS)
48074764
end subroutine FINALIZE
48084765

@@ -4959,7 +4916,7 @@ subroutine Coldstart(gc, import, export, clock, rc)
49594916
real(REAL8), pointer :: PE1(:,:,:), PKZ(:,:,:)
49604917
real(REAL8), allocatable :: PE(:,:,:)
49614918
real(REAL4), pointer :: phis(:,:)
4962-
real(REAL4), pointer :: lons(:,:), lats(:,:)
4919+
real(REAL4), allocatable :: lons(:,:), lats(:,:)
49634920

49644921
integer :: i, j, k, n, L
49654922
integer :: is, ie, js, je, ks, ke, im, jm, km, ls
@@ -5004,7 +4961,7 @@ subroutine Coldstart(gc, import, export, clock, rc)
50044961
call MAPL_GridCompGetInternalState(gc, internal, _RC)
50054962

50064963
call MAPL_GridCompGet(gc, grid=esmfgrid, _RC)
5007-
call MAPL_GridGet(esmfgrid, latitudes=lats, longitudes=lons, _RC)
4964+
call MAPL_GridGetCoordinates(esmfgrid, latitudes=lats, longitudes=lons, _RC)
50084965
if (FV_Atm(1)%flagstruct%grid_type == 4) then
50094966
! Doubly-Period setup based on first LAT/LON coordinate
50104967
lons(:,:) = 0.0

FV_StateMod.F90

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module FV_StateMod
1515
use FileIOSharedMod, only: WRITE_PARALLEL
1616

1717
use mapl3g_generic, only: MAPL_GridCompGetResource, MAPL_GridCompGet, MAPL_GridCompGetInternalState
18-
use mapl3g_Geom_API, only: MAPL_GridGet, MAPL_GeomGet
18+
! use mapl3g_generic, only: MAPL_GridCompTimerStart, MAPL_GridCompTimerStop
19+
use mapl3g_Geom_API, only: MAPL_GridGet !, MAPL_GeomGet
1920
use mapl3g_State_API, only: MAPL_StateGetPointer
2021
#endif
2122
use MAPL_ConstantsMod, only: MAPL_CP, MAPL_RGAS, MAPL_RVAP, MAPL_GRAV, MAPL_RADIUS
@@ -331,16 +332,16 @@ subroutine FV_Setup(gc, rc)
331332
call ESMF_VMGetCurrent(vm, _RC)
332333
call MAPL_MemUtilsWrite(vm, trim(Iam), _RC)
333334

334-
! call MAPL_TimerOn(MAPL,"--FMS_INIT")
335335
call ESMF_VMGet(vm, mpiCommunicator=comm, _RC)
336+
! call MAPL_GridCompTimerStart(gc, "fms_init", _RC)
336337
call fms_init(comm)
337-
! call MAPL_TimerOff(MAPL, "--FMS_INIT")
338+
! call MAPL_GridCompTimerStop(gc, "fms_init", _RC)
338339
call MAPL_MemUtilsWrite(vm, 'FV_StateMod::fms_init', _RC)
339340

340341
! Start up FV
341-
! call MAPL_TimerOn(MAPL,"--FV_INIT")
342+
! call MAPL_GridCompTimerStart(gc, "fv_init1", _RC)
342343
call fv_init1(FV_Atm, DT, grids_on_this_pe, p_split)
343-
! call MAPL_TimerOff(MAPL,"--FV_INIT")
344+
! call MAPL_GridCompTimerStop(gc, "fv_init1", _RC)
344345
call MAPL_MemUtilsWrite(vm, 'FV_StateMod::fv_init1', _RC)
345346

346347
! FV grid dimensions setup from MAPL
@@ -374,10 +375,11 @@ subroutine FV_Setup(gc, rc)
374375
call MAPL_GridCompGetResource(gc, "FIXED_LATS", FV_Atm(1)%flagstruct%deglat, default=FV_Atm(1)%flagstruct%deglat, _RC)
375376

376377
! MPI decomp setup
377-
call MAPL_GridCompGet(gc, geom=geom, _RC)
378-
call MAPL_GeomGet(geom, topology, _RC)
378+
! TODO: pchakrab - FIND A WAY TO RETRIEVE IM_WORLD
379+
! call MAPL_GridCompGet(gc, geom=geom, _RC)
380+
! call MAPL_GeomGet(geom, topology, _RC)
379381
associate(layout => FV_Atm(1)%layout)
380-
layout = topology
382+
layout = [2, 1]
381383
if (FV_Atm(1)%flagstruct%grid_type == 4) then
382384
layout(2) = layout(2) * 6
383385
end if
@@ -665,9 +667,9 @@ subroutine FV_Setup(gc, rc)
665667
endif
666668

667669
! Start up FV
668-
! call MAPL_TimerOn(MAPL,"--FV_INIT")
670+
! call MAPL_GridCompTimerStart(gc, "fv_init2", _RC)
669671
call fv_init2(FV_Atm, DT, grids_on_this_pe, p_split)
670-
! call MAPL_TimerOff(MAPL,"--FV_INIT")
672+
! call MAPL_GridCompTimerStop(gc, "fv_init2", _RC)
671673
call MAPL_MemUtilsWrite(VM, 'FV_StateMod::fv_init2', _RC)
672674

673675
! Force compatibility of gmao_remap and n_zfilter
@@ -1686,7 +1688,8 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
16861688

16871689
! Check Dry Mass (Apply fixer is option is enabled)
16881690
if ( check_mass .OR. fix_mass ) then
1689-
! call MAPL_TimerOn(MAPL,"--MASS_FIX")
1691+
! call MAPL_GridCompTimerStart(gc, "mass_fix", _RC)
1692+
16901693

16911694
if ( FV_Atm(1)%flagstruct%adjust_dry_mass .AND. &
16921695
((.not. FV_Atm(1)%flagstruct%hydrostatic) .OR. FV_Atm(1)%flagstruct%nwat>=6) ) then
@@ -1805,10 +1808,10 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
18051808

18061809
endif
18071810

1808-
! call MAPL_TimerOff(MAPL,"--MASS_FIX")
1811+
! call MAPL_GridCompTimerStop(gc, "mass_fix", _RC)
18091812
endif
18101813

1811-
! call MAPL_TimerOn(MAPL,"--NH_ADIABATIC_INIT")
1814+
! call MAPL_GridCompTimerStart(gc, "NH_ADIABATIC_INIT", _RC)
18121815
if ((.not. FV_Atm(1)%flagstruct%hydrostatic) .and. (FV_Atm(1)%flagstruct%na_init>0)) then
18131816
allocate( DEBUG_ARRAY(isc:iec,jsc:jec,NPZ) )
18141817
call nullify_domain ( )
@@ -1820,9 +1823,9 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
18201823
deallocate( DEBUG_ARRAY )
18211824
FV_Atm(1)%flagstruct%na_init=0
18221825
endif
1823-
! call MAPL_TimerOff(MAPL,"--NH_ADIABATIC_INIT")
1826+
! call MAPL_GridCompTimerStop(gc,"NH_ADIABATIC_INIT", _RC)
18241827

1825-
! call MAPL_TimerOn(MAPL,"--FV_DYNAMICS")
1828+
! call MAPL_GridCompTimerStart(gc, "FV_DYNAMICS", _RC)
18261829
if (.not. FV_OFF) then
18271830
call set_domain(FV_Atm(1)%domain) ! needed for diagnostic output done in fv_dynamics
18281831
allocate ( u_dt(isc:iec,jsc:jec,npz) )
@@ -1929,7 +1932,7 @@ subroutine FV_Run (state, export, clock, gc, ple0, rc)
19291932
call nullify_domain()
19301933

19311934
endif
1932-
! call MAPL_TimerOff(MAPL,"--FV_DYNAMICS")
1935+
! call MAPL_GridCompTimerStop(gc, "FV_DYNAMICS", _RC)
19331936

19341937
SPHU_FILLED = .FALSE.
19351938
QLIQ_FILLED = .FALSE.

0 commit comments

Comments
 (0)