Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added

- anthropogenic emissions were added to HEMCO with connectivity to GOCART
- Added the capability to compute LFC in Lightning module, needed for CTM


### Removed
### Changed

Expand Down
99 changes: 52 additions & 47 deletions GEOS_ChemGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module GEOS_ChemGridCompMod
public SetServices

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

! Private state
! -------------
TYPE GEOS_ChemGridComp
Expand All @@ -71,7 +71,7 @@ module GEOS_ChemGridCompMod
LOGICAL :: strict_child_timing ! Call a barrier before and after each child is run
! Only use this to test timings, not operationally
INTEGER :: AERO_PROVIDER
INTEGER :: RATS_PROVIDER ! WARNING: May be multiple RATS_PROVIDERs
INTEGER :: RATS_PROVIDER ! WARNING: May be multiple RATS_PROVIDERs
END TYPE GEOS_ChemGridComp

! Hook for the ESMF
Expand All @@ -82,8 +82,8 @@ module GEOS_ChemGridCompMod

!=============================================================================

! !DESCRIPTION: This gridded component (GC) combines

! !DESCRIPTION: This gridded component (GC) combines
!EOP

! IMPORTANT: If adding a new component, make sure to update private function GetProvider_()
Expand Down Expand Up @@ -124,8 +124,8 @@ subroutine SetServices ( GC, RC )
integer, intent( OUT) :: RC ! return code

! !DESCRIPTION: The SetServices for the Chemistry GC needs to register its
! Initialize and Run. It uses the MAPL\_Generic construct for defining
! state specs and couplings among its children. In addition, it creates the
! Initialize and Run. It uses the MAPL\_Generic construct for defining
! state specs and couplings among its children. In addition, it creates the
! children GCs and runs their respective SetServices.

!EOP
Expand All @@ -148,7 +148,7 @@ subroutine SetServices ( GC, RC )
type (ESMF_Config), target :: CF, myCF

integer :: n, id

INTEGER, PARAMETER :: numRATs = 8
INTEGER :: RATsProviderNumber(numRATs)
CHARACTER(LEN=ESMF_MAXSTR) :: RATsProviderName(numRATs)
Expand All @@ -158,7 +158,7 @@ subroutine SetServices ( GC, RC )
CHARACTER(LEN=ESMF_MAXSTR) :: shortName
CHARACTER(LEN=ESMF_MAXSTR) :: str

!GMI MEGAN isoprene related
!GMI MEGAN isoprene related
CHARACTER(LEN=255) :: gmi_rcfilen = 'GMI_GridComp.rc'
TYPE(ESMF_Config) :: gmi_config
LOGICAL doMEGANemission, doMEGANviaHEMCO
Expand Down Expand Up @@ -216,7 +216,7 @@ subroutine SetServices ( GC, RC )

call ESMF_ConfigGetAttribute(cf, chem_gridcomp_rc_file, label = "GEOS_ChemGridComp_RC_File:", &
default = "GEOS_ChemGridComp.rc", __RC__)

! Identify which children to run
! ------------------------------
myCF = ESMF_ConfigCreate(__RC__)
Expand Down Expand Up @@ -426,7 +426,7 @@ subroutine SetServices ( GC, RC )
IF(MAPL_AM_I_ROOT()) THEN
PRINT *," "
PRINT *, TRIM(Iam)//": strict_child_timing =", myState%strict_child_timing
PRINT *, TRIM(Iam)//": RATs Provider List"
PRINT *, TRIM(Iam)//": RATs Provider List"
DO i = 1, numRATs
PRINT *," "//TRIM(speciesName(i))//": "//TRIM(RATsProviderName(i))
END DO
Expand Down Expand Up @@ -469,13 +469,13 @@ subroutine SetServices ( GC, RC )
DATATYPE = MAPL_StateItem, __RC__ )

#endif

call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'AERO_DP', &
LONG_NAME = 'aerosol_deposition', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsHorzOnly, &
DATATYPE = MAPL_BundleItem, __RC__)
DATATYPE = MAPL_BundleItem, __RC__)
else

! Determine Id of the aerosol provider
Expand All @@ -498,7 +498,7 @@ subroutine SetServices ( GC, RC )
! by the other components.
! ----------------------------------------------------------------
if ( AERO_PROVIDER == GOCART2G ) then
call MAPL_AddExportSpec ( GC, TO_NAME = 'AERO_ACI', &
call MAPL_AddExportSpec ( GC, TO_NAME = 'AERO_ACI', &
SHORT_NAME = 'AERO', &
CHILD_ID = AERO_PROVIDER, __RC__ )
else
Expand All @@ -516,7 +516,7 @@ subroutine SetServices ( GC, RC )
CHILD_ID = GOCART, __RC__ )
end if

! Save this information in private state for later use.
! Save this information in private state for later use.
! WARNING: Dangerous if there is more than one RATS_PROVIDER
! ----------------------------------------------------------
myState%RATS_PROVIDER = RATS_PROVIDER
Expand Down Expand Up @@ -582,13 +582,13 @@ subroutine SetServices ( GC, RC )
CALL MAPL_AddConnectivity ( GC, &
SHORT_NAME = (/'AIRDENS ', 'CN_PRCP ', 'NCN_PRCP'/), &
DST_ID = CARMA, SRC_ID = CHEMENV, __RC__ )

if(myState%enable_GOCART2G) then
CALL MAPL_AddConnectivity ( GC, &
SRC_NAME = (/'PSO4'/), &
DST_NAME = (/'CARMA_PSO4TOT'/), &
DST_ID=CARMA, SRC_ID=GOCART2G, __RC__)
endif
endif
if(myState%enable_ACHEM) then
CALL MAPL_AddConnectivity ( GC, &
SRC_NAME = (/'pSOA_ANTHRO_VOC', 'pSOA_BIOB_VOC '/), &
Expand Down Expand Up @@ -728,7 +728,7 @@ subroutine SetServices ( GC, RC )
DST_NAME = (/'O3P ', 'OHSTRAT ', 'O3 ', 'OCS_JRATE'/), &
DST_ID = ACHEM, SRC_ID = GMICHEM, __RC__ )
ENDIF


! GOCART <=> ACHEM (OCS CHEMISTRY)
! ---------------------------------
Expand Down Expand Up @@ -861,7 +861,7 @@ subroutine SetServices ( GC, RC )
SRC_NAME = (/"OX"/), &
DST_NAME = (/"O3"/), &
DST_ID=GOCART, SRC_ID=GMICHEM, __RC__)

END IF

! GMICHEM connections to MAM
Expand Down Expand Up @@ -916,7 +916,7 @@ subroutine SetServices ( GC, RC )
ENDIF
ENDIF

! GEOS-Chem import of CO2
! GEOS-Chem import of CO2
! -----------------------------
IF(myState%enable_GEOSCHEM .AND. myState%enable_GOCART .AND. chemReg%doing_CO2) then
CALL MAPL_AddConnectivity ( GC, &
Expand All @@ -936,7 +936,7 @@ subroutine SetServices ( GC, RC )
CALL MAPL_AddConnectivity ( GC, SHORT_NAME = (/ 'AIRDENS', 'BYNCY ' /), DST_ID=HEMCO, SRC_ID=CHEMENV, __RC__)

!!!!!!!!!!!!!!!!!!
! Determine if GOCART or GMI expect data from HEMCO:
! Determine if GOCART or GMI expect data from HEMCO:
! (adapted from HEMCO_GridCompMod.F90)
!!!!!!!!!!!!!!!!!!

Expand Down Expand Up @@ -975,11 +975,16 @@ subroutine SetServices ( GC, RC )
! ---------------
IF( myState%enable_HEMCO .AND. myState%enable_GOCART2G ) THEN
CALL MAPL_AddConnectivity ( GC, &
SHORT_NAME = (/ 'OC_ISOPRENE', 'OC_MTPA ', 'OC_MTPO ', 'OC_LIMO '/), &
SHORT_NAME = [character(len=11) :: &
'OC_ISOPRENE', 'OC_MTPA', 'OC_MTPO', 'OC_LIMO', &
'SU_ANTHROL1', 'SU_ANTHROL2', 'SU_SHIPSO2', &
'OC_ANTEOC1', 'OC_ANTEOC2', 'OC_SHIP', 'BC_ANTEBC1', &
'BC_ANTEBC2', 'BC_SHIP', 'EMI_NH3_EN', 'SU_SHIPSO4'], &
SRC_ID=HEMCO, DST_ID=GOCART2G, __RC__)
END IF

! HEMCO -> GMI

! HEMCO -> GMI
! ------------
IF( myState%enable_HEMCO .AND. myState%enable_GMICHEM ) THEN

Expand All @@ -1000,7 +1005,7 @@ subroutine SetServices ( GC, RC )

call ESMF_ConfigGetAttribute(gmi_config, value=doMEGANviaHEMCO, &
label="doMEGANviaHEMCO:", default=.FALSE., __RC__ )

! make sure we don't have inconsistent HEMCO flags
IF ( GMI_instance_of_HEMCO .neqv. doMEGANviaHEMCO ) THEN
PRINT*,'Inconsistency --- HEMCO GMI instance = ', GMI_instance_of_HEMCO
Expand Down Expand Up @@ -1031,7 +1036,7 @@ subroutine SetServices ( GC, RC )
call MAPL_GenericSetServices ( GC, __RC__ )

RETURN_(ESMF_SUCCESS)

end subroutine SetServices


Expand All @@ -1045,13 +1050,13 @@ subroutine Init ( GC, IMPORT, EXPORT, CLOCK, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_State), intent(inout) :: IMPORT ! Import state
type(ESMF_State), intent(inout) :: EXPORT ! Export state
type(ESMF_Clock), intent(inout) :: CLOCK ! The clock
integer, optional, intent( out) :: RC ! Error code

! !DESCRIPTION: The Initialize method of the Chemistry Composite Gridded
! !DESCRIPTION: The Initialize method of the Chemistry Composite Gridded
! Component. It acts as a driver for the initializtion of the children.

!EOP
Expand All @@ -1077,8 +1082,8 @@ subroutine Init ( GC, IMPORT, EXPORT, CLOCK, RC )
type (GEOS_ChemGridComp_Wrap) :: wrap

!=============================================================================

! Begin...
! Begin...

! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------
Expand Down Expand Up @@ -1134,12 +1139,12 @@ subroutine Init ( GC, IMPORT, EXPORT, CLOCK, RC )
! need to be determined inside the child component.
! --------------------------------------------------------------------------
if (myState%AERO_PROVIDER < 0) then
! Radiation will not call the aerosol optics method
! Radiation will not call the aerosol optics method
! unless this attribute is explicitly set to true.
call ESMF_StateGet(EXPORT, 'AERO', AERO, __RC__)
call ESMF_AttributeSet(AERO, name='implements_aerosol_optics_method', value=.false., __RC__)

! Moist will not call the aerosol activation method
! Moist will not call the aerosol activation method
! unless this attribute is explicitly set to true.
call ESMF_AttributeSet(AERO, name='implements_aerosol_activation_properties_method', value=.false., __RC__)
end if
Expand All @@ -1150,15 +1155,15 @@ subroutine Init ( GC, IMPORT, EXPORT, CLOCK, RC )
! ------------------------
if ( MAPL_am_I_root() ) then

print *, trim(Iam)//": IMPORT State"
print *, trim(Iam)//": IMPORT State"
call ESMF_StatePrint ( IMPORT )
print *, trim(Iam)//": INTERNAL State"
print *, trim(Iam)//": INTERNAL State"
call ESMF_StatePrint ( INTERNAL )
print *, trim(Iam)//": EXPORT State"
print *, trim(Iam)//": EXPORT State"
call ESMF_StatePrint ( EXPORT )

print *, trim(Iam)//": AERO State (EXPORT)"
call ESMF_StateGet ( EXPORT, 'AERO', AERO, __RC__ )
call ESMF_StateGet ( EXPORT, 'AERO', AERO, __RC__ )
call ESMF_StatePrint ( AERO, nestedFlag=.false., __RC__ )
print *, trim(Iam)//": AERO State (PROVIDER)", myState%AERO_PROVIDER
if (myState%AERO_PROVIDER > 0) then
Expand Down Expand Up @@ -1187,7 +1192,7 @@ subroutine Run1 ( GC, IMPORT, EXPORT, CLOCK, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_State), intent(inout) :: IMPORT ! Import state
type(ESMF_State), intent(inout) :: EXPORT ! Export state
type(ESMF_Clock), intent(inout) :: CLOCK ! The clock
Expand Down Expand Up @@ -1226,7 +1231,7 @@ subroutine Run1 ( GC, IMPORT, EXPORT, CLOCK, RC )

!=============================================================================

! Begin...
! Begin...

! Get parameters from generic state. The RUNALARM is used to control
! the calling of the full chemistry
Expand All @@ -1249,7 +1254,7 @@ subroutine Run1 ( GC, IMPORT, EXPORT, CLOCK, RC )

if ( ESMF_AlarmIsRinging (ALARM, RC=STATUS) ) then

! Don't turn alarm off in phase 1, otherwise phase 2 will not be
! Don't turn alarm off in phase 1, otherwise phase 2 will not be
! executed!
! call ESMF_AlarmRingerOff(ALARM, RC=STATUS)
! VERIFY_(STATUS)
Expand Down Expand Up @@ -1287,9 +1292,9 @@ subroutine Run1 ( GC, IMPORT, EXPORT, CLOCK, RC )
if(associated(GCS)) then
NCHLD = SIZE(GCS) ! # of children
IPHASE = 1 ! phase to be called
! do for every child: get child state, determine number of
! do for every child: get child state, determine number of
! of run phases and call phase one if more than one phase
! exists. Also updated MAPL_Get to accept the output
! exists. Also updated MAPL_Get to accept the output
! argument NumRunPhases (ckeller, 09/10/2014)
! --------------------------------------------------------

Expand Down Expand Up @@ -1347,7 +1352,7 @@ subroutine Run2 ( GC, IMPORT, EXPORT, CLOCK, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_State), intent(inout) :: IMPORT ! Import state
type(ESMF_State), intent(inout) :: EXPORT ! Export state
type(ESMF_Clock), intent(inout) :: CLOCK ! The clock
Expand Down Expand Up @@ -1392,15 +1397,15 @@ subroutine Run2 ( GC, IMPORT, EXPORT, CLOCK, RC )
type (GEOS_ChemGridComp_Wrap) :: wrap
type (ESMF_VM) :: VM
!-------------------------------------------------------------------
! Begin...
! Begin...

! Get parameters from generic state. The RUNALARM is used to control
! the calling of the full chemistry
!-------------------------------------------------------------------

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)
call MAPL_Get(MAPL, RUNALARM = ALARM, __RC__ )
call MAPL_Get(MAPL, RUNALARM = ALARM, __RC__ )

! Get my internal state
! ---------------------
Expand All @@ -1421,7 +1426,7 @@ subroutine Run2 ( GC, IMPORT, EXPORT, CLOCK, RC )
! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------
call ESMF_GridCompGet ( GC, name=COMP_NAME, __RC__ )
Iam = trim(COMP_NAME) // "::Run2"
Iam = trim(COMP_NAME) // "::Run2"

! Call Run for every Child. This is either phase 1 (for components
! with only one phase) or phase 2 (for components with two phases).
Expand All @@ -1440,7 +1445,7 @@ subroutine Run2 ( GC, IMPORT, EXPORT, CLOCK, RC )

if(associated(GCS)) then
NCHLD = SIZE(GCS) ! # of children
! do for every child: get child state, determine number of
! do for every child: get child state, determine number of
! run phases and phase to call, execute.
! --------------------------------------------------------

Expand Down Expand Up @@ -1477,7 +1482,7 @@ subroutine Run2 ( GC, IMPORT, EXPORT, CLOCK, RC )
enddo !I
endif

!Compute chemistry tracer increments
!Compute chemistry tracer increments
!---------------------------------------
call Compute_IncBundle(INTERNAL, EXPORT, CHMincR2, MAPL, __RC__)

Expand Down Expand Up @@ -1539,7 +1544,7 @@ subroutine GetProvider_ ( CF, Label, ID, Name, Default, RC )
call ESMF_ConfigGetAttribute(CF, providerName, Default=trim(default), &
Label=Label, __RC__)

ID = -1
ID = -1
name = trim(providerName)

select case ( trim(name) )
Expand Down Expand Up @@ -1582,7 +1587,7 @@ subroutine GetProvider_ ( CF, Label, ID, Name, Default, RC )
__raise__(MAPL_RC_ERROR, message)

end select

if ( ID < 0 ) then
message = "Component "//trim(name)//" is NOT enabled; cannot specify it for "//trim(label)
__raise__(MAPL_RC_ERROR, message)
Expand Down
Loading