Skip to content

Commit

Permalink
Merge pull request #1043 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 authored Jan 9, 2025
2 parents f26a2d1 + 86f63ad commit b769e44
Show file tree
Hide file tree
Showing 45 changed files with 3,158 additions and 215 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2.1

# Anchors in case we need to override the defaults from the orb
#baselibs_version: &baselibs_version v7.17.0
#bcs_version: &bcs_version v11.4.0
#baselibs_version: &baselibs_version v7.27.0
#bcs_version: &bcs_version v11.6.0

orbs:
ci: geos-esm/circleci-tools@2
ci: geos-esm/circleci-tools@4

workflows:
build-test:
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ set (alldirs
GEOSwgcm_GridComp
)

option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" OFF)

if (BUILD_WITH_GIGATRAJ)
list(APPEND alldirs GEOSgigatraj_GridComp)
endif()

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_GcmGridComp.F90)

Expand All @@ -17,6 +22,8 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_GcmGridComp.F90)
SUBCOMPONENTS ${alldirs}
DEPENDENCIES MAPL ESMF::ESMF)

target_compile_definitions (${this} PRIVATE $<$<BOOL:${BUILD_WITH_GIGATRAJ}>:HAS_GIGATRAJ>)

ecbuild_install_project( NAME GEOSgcm_GridComp)

else ()
Expand Down
26 changes: 26 additions & 0 deletions GEOS_GcmGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ module GEOS_GcmGridCompMod
use GEOS_AgcmGridCompMod, only: AGCM_SetServices => SetServices
use GEOS_mkiauGridCompMod, only: AIAU_SetServices => SetServices
use DFI_GridCompMod, only: ADFI_SetServices => SetServices
#ifdef HAS_GIGATRAJ
use GEOS_GigatrajGridCompMod, only: GigaTraj_SetServices => SetServices
#endif

use GEOS_OgcmGridCompMod, only: OGCM_SetServices => SetServices
use GEOS_WgcmGridCompMod, only: WGCM_SetServices => SetServices
use MAPL_HistoryGridCompMod, only: Hist_SetServices => SetServices
Expand Down Expand Up @@ -58,6 +62,7 @@ module GEOS_GcmGridCompMod
integer :: ADFI
integer :: WGCM
integer :: hist
integer :: gigatraj

integer :: bypass_ogcm
integer :: k
Expand Down Expand Up @@ -251,6 +256,10 @@ subroutine SetServices ( GC, RC )
else
AGCM = MAPL_AddChild(GC, NAME='AGCM', SS=Agcm_SetServices, RC=STATUS)
VERIFY_(STATUS)
#ifdef HAS_GIGATRAJ
gigatraj = MAPL_AddChild(GC, NAME='GIGATRAJ', SS=GigaTraj_SetServices, RC=STATUS)
VERIFY_(STATUS)
#endif
AIAU = MAPL_AddChild(GC, NAME='AIAU', SS=AIAU_SetServices, RC=STATUS)
VERIFY_(STATUS)
ADFI = MAPL_AddChild(GC, NAME='ADFI', SS=ADFI_SetServices, RC=STATUS)
Expand Down Expand Up @@ -955,6 +964,10 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
! Recursive setup of grids (should be disabled)
call ESMF_GridCompSet(GCS(AGCM), grid=agrid, rc=status)
VERIFY_(STATUS)
#ifdef HAS_GIGATRAJ
call ESMF_GridCompSet(GCS(gigatraj), grid=agrid, rc=status)
VERIFY_(STATUS)
#endif
call ESMF_GridCompSet(GCS(OGCM), grid=ogrid, rc=status)
VERIFY_(STATUS)
if(.not. DO_DATA_ATM4OCN) then
Expand Down Expand Up @@ -2019,10 +2032,23 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
else
call MAPL_TimerOn(MAPL,"AGCM" )
endif

#ifdef HAS_GIGATRAJ
! use agcm export as gigatraj's import to get the initial state.
! it only runs at the begining of the first time step
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=1, userRC=status )
VERIFY_(STATUS)
#endif

call ESMF_GridCompRun ( GCS(AGCM), importState=GIM(AGCM), exportState=GEX(AGCM), clock=clock, userRC=status )
VERIFY_(STATUS)

#ifdef HAS_GIGATRAJ
! use agcm export as gigatraj's import
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=2, userRC=status )
VERIFY_(STATUS)
#endif

if(DO_DATA_ATM4OCN) then
call MAPL_TimerOff(MAPL,"DATAATM" )
else
Expand Down
2 changes: 2 additions & 0 deletions GEOSagcm_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_AgcmGridComp.F90)
SUBCOMPONENTS ${alldirs}
DEPENDENCIES MAPL GEOS_Shared Chem_Shared ESMF::ESMF)

target_compile_definitions (${this} PRIVATE $<$<BOOL:${BUILD_WITH_GIGATRAJ}>:HAS_GIGATRAJ>)

else ()

esma_add_subdirectories (${alldirs})
Expand Down
28 changes: 28 additions & 0 deletions GEOSagcm_GridComp/GEOS_AgcmGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,34 @@ subroutine SetServices ( GC, RC )
RC = STATUS)
VERIFY_(STATUS)

#ifdef HAS_GIGATRAJ
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'PL', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'OMEGA', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'TH', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'DTDTDYN', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'ZL', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
#endif

call MAPL_AddExportSpec( GC, &
SHORT_NAME = 'PS', &
CHILD_ID = SDYN, &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,8 @@ subroutine SetServices ( GC, RC )
call MAPL_AddConnectivity ( GC, &
SHORT_NAME = (/ 'RL ', 'QL ', 'QLTOT ', 'DQLDT ', &
'RI ', 'QI ', 'QITOT ', 'DQIDT ', &
'QLCN ', 'PFL_CN ', 'PFL_LSAN', &
'QICN ', 'PFI_CN ', 'PFI_LSAN', &
'QLCN ', 'PFL_CN ', 'PFL_LSAN', 'ZLCL ', &
'QICN ', 'PFI_CN ', 'PFI_LSAN', 'ZLFC ', &
'FCLD ', 'QCTOT ', 'CNV_QC ', &
'REV_LS ', 'REV_AN ', 'REV_CN ', 'TPREC ', &
'Q ', 'DQDT ', 'DQRL ', 'DQRC ', &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ esma_add_library (${this}
SRCS ${srcs}
DEPENDENCIES GEOS_Shared GMAO_mpeu MAPL Chem_Shared Chem_Base ESMF::ESMF)

# We need to add_dependencies for fms_r4 because CMake doesn't know we
# need it for include purposes. In R4R8, we only ever link against
# fms_r8, so it doesn't know to build the target fms_r4
# NOTE NOTE NOTE: This should *not* be included in GEOSgcm v12
# because FMS is pre-built library in that case.
add_dependencies (${this} fms_r4)
get_target_property (extra_incs fms_r4 INCLUDE_DIRECTORIES)
target_include_directories(${this} PRIVATE
$<BUILD_INTERFACE:${extra_incs}>
Expand Down
Loading

0 comments on commit b769e44

Please sign in to comment.