Skip to content

Commit

Permalink
Merge pull request #35 from ESCOMP/development
Browse files Browse the repository at this point in the history
HEMCO_CESM 1.3.0: upstream HEMCO 3.8.1; performance timers
  • Loading branch information
jimmielin committed Apr 29, 2024
2 parents e71188c + 09145da commit 3bd9df0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,13 @@

This file documents all notable changes to the HEMCO-CESM interface since late 2022.

## [1.3.0] - 2024-04-29
### Added
- Performance timers using CIME infrastructure for initialization and run of major HEMCO_CESM and HEMCO components.

### Changed
- **Based off upstream HEMCO 3.8.1**. Refer to the HEMCO release notes.

## [1.2.2] - 2024-03-01
### Changed
- **Based off upstream HEMCO 3.8.0**. Release 3.7.x was skipped due to regression in vertical regridding capabilities. Refer to the HEMCO release notes for changes in 3.8.0 release.
Expand Down
2 changes: 1 addition & 1 deletion Externals_HCO.cfg
@@ -1,5 +1,5 @@
[hemco_src]
tag = 3.8.0
tag = 3.8.1
protocol = git
local_path = HEMCO
repo_url = https://github.com/geoschem/hemco.git
Expand Down
57 changes: 41 additions & 16 deletions hemco_interface.F90
Expand Up @@ -268,6 +268,7 @@ subroutine HCOI_Chunk_Init()
use cam_logfile, only: iulog
use spmd_utils, only: masterproc, mpicom, masterprocid
use spmd_utils, only: npes, iam
use perf_mod, only: t_startf, t_stopf

use mpi, only: MPI_INTEGER
use ESMF, only: ESMF_VM, ESMF_VMGetCurrent, ESMF_VMGet
Expand Down Expand Up @@ -358,11 +359,13 @@ subroutine HCOI_Chunk_Init()

!-----------------------------------------------------------------------

call t_startf('HCOI_Chunk_Init')

if(masterproc) then
write(iulog,*) "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
write(iulog,*) "HEMCO: Harmonized Emissions Component"
write(iulog,*) "https://doi.org/10.5194/gmd-14-5487-2021 (Lin et al., 2021)"
write(iulog,*) "HEMCO_CESM interface version 1.2.2"
write(iulog,*) "HEMCO_CESM interface version 1.3.0"
write(iulog,*) "You are using HEMCO version ", ADJUSTL(HCO_VERSION)
write(iulog,*) "ROOT: ", HcoRoot
write(iulog,*) "Config File: ", HcoConfigFile
Expand Down Expand Up @@ -837,6 +840,7 @@ subroutine HCOI_Chunk_Init()
! 4) configuration file initializes ReadList
! 5) universal scale factor for each HEMCO species (Hco_ScaleInit)
!-----------------------------------------------------------------------
call t_startf('HCO_HCOX_Init')
call HCO_Init(HcoState, HMRC)
if(masterproc .and. HMRC /= HCO_SUCCESS) then
write(iulog,*) "******************************************"
Expand All @@ -861,6 +865,7 @@ subroutine HCOI_Chunk_Init()
ASSERT_(HMRC==HCO_SUCCESS)

if(masterproc) write(iulog,*) "> HEMCO extensions initialized successfully!"
call t_stopf('HCO_HCOX_Init')

!-----------------------------------------------------------------------
! Additional exports: Verify if additional diagnostic quantities
Expand Down Expand Up @@ -1051,6 +1056,8 @@ subroutine HCOI_Chunk_Init()
write(iulog,*) "> HEMCO additional exports for CESM2-GC initialized!"
endif
endif

call t_stopf('HCOI_Chunk_Init')
end subroutine HCOI_Chunk_Init
!EOC
!------------------------------------------------------------------------------
Expand Down Expand Up @@ -1140,6 +1147,9 @@ subroutine HCOI_Chunk_Run(cam_in, phys_state, pbuf2d, phase)
use cam_logfile, only: iulog
use spmd_utils, only: masterproc, mpicom, masterprocid, iam

! Performance timers
use perf_mod, only: t_startf, t_stopf

! ESMF
use ESMF, only: ESMF_GridCompRun

Expand All @@ -1164,6 +1174,8 @@ subroutine HCOI_Chunk_Run(cam_in, phys_state, pbuf2d, phase)

logical, save :: FIRST = .true.

call t_startf('HCOI_Chunk_Run')

if(masterproc) then
write(iulog,*) "HEMCO_CESM: Running HCOI_Chunk_Run phase", phase
endif
Expand Down Expand Up @@ -1201,20 +1213,26 @@ subroutine HCOI_Chunk_Run(cam_in, phys_state, pbuf2d, phase)
! hco_pbuf2d => pbuf2d

! Set fields from CAM state before run
call t_startf('HCO_CAM_GetBefore_HCOI')
call CAM_GetBefore_HCOI(cam_in, phys_state, pbuf2d, phase, &
HcoState, ExtState)
call t_stopf('HCO_CAM_GetBefore_HCOI')

! Run the gridded component.
call t_startf('HCO_GridCompRun')
call ESMF_GridCompRun(HCO_GridComp, rc=RC)!importState=HCO_GridCompState, &
!exportState=HCO_GridCompState, &
!rc=RC)
call t_stopf('HCO_GridCompRun')

ASSERT_(RC==ESMF_SUCCESS)
endif

if(masterproc) then
write(iulog,*) "HEMCO_CESM: Leaving HCOI_Chunk_Run"
endif

call t_stopf('HCOI_Chunk_Run')
end subroutine HCOI_Chunk_Run
!EOC
!------------------------------------------------------------------------------
Expand Down Expand Up @@ -1265,27 +1283,30 @@ subroutine HCO_GC_Run(GC, IMPORT, EXPORT, Clock, RC)
!
! !USES:
!
use cam_logfile, only: iulog
use spmd_utils, only: masterproc, iam
use cam_logfile, only: iulog
use spmd_utils, only: masterproc, iam

! Performance timers
use perf_mod, only: t_startf, t_stopf

! HEMCO
use HCO_Interface_Common, only: GetHcoVal, GetHcoDiagn
use HCO_Clock_Mod, only: HcoClock_Set, HcoClock_Get
use HCO_Clock_Mod, only: HcoClock_EmissionsDone
use HCO_Diagn_Mod, only: HcoDiagn_AutoUpdate
use HCO_Driver_Mod, only: HCO_Run
use HCO_EmisList_Mod, only: Hco_GetPtr
use HCO_Calc_Mod, only: Hco_EvalFld
use HCO_FluxArr_Mod, only: HCO_FluxArrReset
use HCO_GeoTools_Mod, only: HCO_CalcVertGrid, HCO_SetPBLm

use HCO_State_Mod, only: HCO_GetHcoId
use HCO_Interface_Common, only: GetHcoVal, GetHcoDiagn
use HCO_Clock_Mod, only: HcoClock_Set, HcoClock_Get
use HCO_Clock_Mod, only: HcoClock_EmissionsDone
use HCO_Diagn_Mod, only: HcoDiagn_AutoUpdate
use HCO_Driver_Mod, only: HCO_Run
use HCO_EmisList_Mod, only: Hco_GetPtr
use HCO_Calc_Mod, only: Hco_EvalFld
use HCO_FluxArr_Mod, only: HCO_FluxArrReset
use HCO_GeoTools_Mod, only: HCO_CalcVertGrid, HCO_SetPBLm

use HCO_State_Mod, only: HCO_GetHcoId

! HEMCO Extensions
use HCOX_Driver_Mod, only : HCOX_Run
use HCOX_Driver_Mod, only: HCOX_Run

! Physical constants
use physconst, only : mwdry
use physconst, only: mwdry

! Necessary imported properties for physics calculations
use hco_cam_convert_state_mod, only: State_HCO_PSFC, State_HCO_TK, State_HCO_PBLH, State_CAM_chmDMS
Expand Down Expand Up @@ -1553,6 +1574,8 @@ subroutine HCO_GC_Run(GC, IMPORT, EXPORT, Clock, RC)
! Run HEMCO!
!-----------------------------------------------------------------------

call t_startf('HCO_HCOX_Run')

! Run HCO core module
! Pass phase as argument. Phase 1 will update the emissions list,
! phase 2 will calculate the emissions. Emissions will be written into
Expand Down Expand Up @@ -1611,6 +1634,8 @@ subroutine HCO_GC_Run(GC, IMPORT, EXPORT, Clock, RC)

if(masterproc .and. nCalls < 10) write(iulog,*) "HEMCO_CESM: HCOX_Run"

call t_stopf('HCO_HCOX_Run')

!-----------------------------------------------------------------------
! Update "autofill" diagnostics.
! Update all 'AutoFill' diagnostics. This makes sure that all
Expand Down

0 comments on commit 3bd9df0

Please sign in to comment.