Skip to content

Commit d41df59

Browse files
authored
Merge branch 'develop' into bugfix/mathomp4/v11-snomas-fix
2 parents 5f4b9d7 + 86f63ad commit d41df59

File tree

97 files changed

+5325
-3943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+5325
-3943
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
version: 2.1
22

33
# Anchors in case we need to override the defaults from the orb
4-
#baselibs_version: &baselibs_version v7.17.0
5-
#bcs_version: &bcs_version v11.4.0
4+
#baselibs_version: &baselibs_version v7.27.0
5+
#bcs_version: &bcs_version v11.6.0
66

77
orbs:
8-
ci: geos-esm/circleci-tools@2
8+
ci: geos-esm/circleci-tools@4
99

1010
workflows:
1111
build-test:

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@ set (alldirs
88
GEOSwgcm_GridComp
99
)
1010

11+
option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" OFF)
12+
13+
if (BUILD_WITH_GIGATRAJ)
14+
list(APPEND alldirs GEOSgigatraj_GridComp)
15+
endif()
1116

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

1419
ecbuild_declare_project()
1520
esma_add_library(${this}
1621
SRCS GEOS_GcmGridComp.F90
1722
SUBCOMPONENTS ${alldirs}
18-
DEPENDENCIES MAPL esmf)
23+
DEPENDENCIES MAPL ESMF::ESMF)
24+
25+
target_compile_definitions (${this} PRIVATE $<$<BOOL:${BUILD_WITH_GIGATRAJ}>:HAS_GIGATRAJ>)
1926

2027
ecbuild_install_project( NAME GEOSgcm_GridComp)
2128

GEOS_GcmGridComp.F90

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ module GEOS_GcmGridCompMod
2020
use GEOS_AgcmGridCompMod, only: AGCM_SetServices => SetServices
2121
use GEOS_mkiauGridCompMod, only: AIAU_SetServices => SetServices
2222
use DFI_GridCompMod, only: ADFI_SetServices => SetServices
23+
#ifdef HAS_GIGATRAJ
24+
use GEOS_GigatrajGridCompMod, only: GigaTraj_SetServices => SetServices
25+
#endif
26+
2327
use GEOS_OgcmGridCompMod, only: OGCM_SetServices => SetServices
2428
use GEOS_WgcmGridCompMod, only: WGCM_SetServices => SetServices
2529
use MAPL_HistoryGridCompMod, only: Hist_SetServices => SetServices
@@ -58,6 +62,7 @@ module GEOS_GcmGridCompMod
5862
integer :: ADFI
5963
integer :: WGCM
6064
integer :: hist
65+
integer :: gigatraj
6166

6267
integer :: bypass_ogcm
6368
integer :: k
@@ -251,6 +256,10 @@ subroutine SetServices ( GC, RC )
251256
else
252257
AGCM = MAPL_AddChild(GC, NAME='AGCM', SS=Agcm_SetServices, RC=STATUS)
253258
VERIFY_(STATUS)
259+
#ifdef HAS_GIGATRAJ
260+
gigatraj = MAPL_AddChild(GC, NAME='GIGATRAJ', SS=GigaTraj_SetServices, RC=STATUS)
261+
VERIFY_(STATUS)
262+
#endif
254263
AIAU = MAPL_AddChild(GC, NAME='AIAU', SS=AIAU_SetServices, RC=STATUS)
255264
VERIFY_(STATUS)
256265
ADFI = MAPL_AddChild(GC, NAME='ADFI', SS=ADFI_SetServices, RC=STATUS)
@@ -955,6 +964,10 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
955964
! Recursive setup of grids (should be disabled)
956965
call ESMF_GridCompSet(GCS(AGCM), grid=agrid, rc=status)
957966
VERIFY_(STATUS)
967+
#ifdef HAS_GIGATRAJ
968+
call ESMF_GridCompSet(GCS(gigatraj), grid=agrid, rc=status)
969+
VERIFY_(STATUS)
970+
#endif
958971
call ESMF_GridCompSet(GCS(OGCM), grid=ogrid, rc=status)
959972
VERIFY_(STATUS)
960973
if(.not. DO_DATA_ATM4OCN) then
@@ -1308,15 +1321,17 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
13081321
result=GCM_INTERNAL_STATE%SURF_IMP, rc=status)
13091322
VERIFY_(STATUS)
13101323

1311-
!select TURBULENCE export
1312-
call MAPL_ExportStateGet(GEX, name='TURBULENCE', &
1313-
result=GCM_INTERNAL_STATE%TURB_EXP, rc=status)
1314-
VERIFY_(STATUS)
1324+
if(.not. DO_DATA_ATM4OCN) then
1325+
!select TURBULENCE export
1326+
call MAPL_ExportStateGet(GEX, name='TURBULENCE', &
1327+
result=GCM_INTERNAL_STATE%TURB_EXP, rc=status)
1328+
VERIFY_(STATUS)
13151329

1316-
!select SURFACE import
1317-
call MAPL_ImportStateGet(GC, import=import, name='TURBULENCE', &
1318-
result=GCM_INTERNAL_STATE%TURB_IMP, rc=status)
1319-
VERIFY_(STATUS)
1330+
!select TURBULENCE import
1331+
call MAPL_ImportStateGet(GC, import=import, name='TURBULENCE', &
1332+
result=GCM_INTERNAL_STATE%TURB_IMP, rc=status)
1333+
VERIFY_(STATUS)
1334+
endif
13201335

13211336
!select OCEAN export
13221337
call MAPL_ExportStateGet(GEX, name='OCEAN', &
@@ -2017,10 +2032,23 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
20172032
else
20182033
call MAPL_TimerOn(MAPL,"AGCM" )
20192034
endif
2035+
2036+
#ifdef HAS_GIGATRAJ
2037+
! use agcm export as gigatraj's import to get the initial state.
2038+
! it only runs at the begining of the first time step
2039+
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=1, userRC=status )
2040+
VERIFY_(STATUS)
2041+
#endif
20202042

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

2046+
#ifdef HAS_GIGATRAJ
2047+
! use agcm export as gigatraj's import
2048+
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=2, userRC=status )
2049+
VERIFY_(STATUS)
2050+
#endif
2051+
20242052
if(DO_DATA_ATM4OCN) then
20252053
call MAPL_TimerOff(MAPL,"DATAATM" )
20262054
else

GEOSagcm_GridComp/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_AgcmSimpleGridComp.F90)
1111
esma_add_library (${this}
1212
SRCS GEOS_AgcmSimpleGridComp.F90
1313
SUBCOMPONENTS GEOSsuperdyn_GridComp GEOShs_GridComp
14-
DEPENDENCIES MAPL esmf)
14+
DEPENDENCIES MAPL ESMF::ESMF)
1515

1616
elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_AgcmGridComp.F90)
1717

1818
esma_add_library (${this}
1919
SRCS GEOS_AgcmGridComp.F90
2020
SUBCOMPONENTS ${alldirs}
21-
DEPENDENCIES MAPL GEOS_Shared Chem_Shared esmf)
21+
DEPENDENCIES MAPL GEOS_Shared Chem_Shared ESMF::ESMF)
22+
23+
target_compile_definitions (${this} PRIVATE $<$<BOOL:${BUILD_WITH_GIGATRAJ}>:HAS_GIGATRAJ>)
2224

2325
else ()
2426

GEOSagcm_GridComp/GEOS_AgcmGridComp.F90

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,34 @@ subroutine SetServices ( GC, RC )
790790
RC = STATUS)
791791
VERIFY_(STATUS)
792792

793+
#ifdef HAS_GIGATRAJ
794+
call MAPL_AddExportSpec(GC, &
795+
SHORT_NAME = 'PL', &
796+
CHILD_ID = SDYN, &
797+
RC = STATUS)
798+
VERIFY_(STATUS)
799+
call MAPL_AddExportSpec(GC, &
800+
SHORT_NAME = 'OMEGA', &
801+
CHILD_ID = SDYN, &
802+
RC = STATUS)
803+
VERIFY_(STATUS)
804+
call MAPL_AddExportSpec(GC, &
805+
SHORT_NAME = 'TH', &
806+
CHILD_ID = SDYN, &
807+
RC = STATUS)
808+
VERIFY_(STATUS)
809+
call MAPL_AddExportSpec(GC, &
810+
SHORT_NAME = 'DTDTDYN', &
811+
CHILD_ID = SDYN, &
812+
RC = STATUS)
813+
VERIFY_(STATUS)
814+
call MAPL_AddExportSpec(GC, &
815+
SHORT_NAME = 'ZL', &
816+
CHILD_ID = SDYN, &
817+
RC = STATUS)
818+
VERIFY_(STATUS)
819+
#endif
820+
793821
call MAPL_AddExportSpec( GC, &
794822
SHORT_NAME = 'PS', &
795823
CHILD_ID = SDYN, &

GEOSagcm_GridComp/GEOSphysics_GridComp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/GEOS_PhysicsGridComp.F90)
1515
esma_add_library (${this}
1616
SRCS GEOS_PhysicsGridComp.F90 MBundle_IncrementMod.F90
1717
SUBCOMPONENTS ${alldirs}
18-
DEPENDENCIES MAPL GMAO_mpeu GMAO_stoch esmf)
18+
DEPENDENCIES MAPL GMAO_mpeu GMAO_stoch ESMF::ESMF)
1919

2020
else ()
2121

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOS_PhysicsGridComp.F90

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ subroutine SetServices ( GC, RC )
11701170
VERIFY_(STATUS)
11711171
ENDIF
11721172

1173-
IF (DO_OBIO /= 0) THEN
1173+
IF (DO_OBIO /= 0) THEN
11741174
call MAPL_AddConnectivity ( GC, &
11751175
SHORT_NAME = (/'DROBIO', 'DFOBIO'/), &
11761176
SRC_ID = RAD, &
@@ -1215,8 +1215,8 @@ subroutine SetServices ( GC, RC )
12151215
call MAPL_AddConnectivity ( GC, &
12161216
SHORT_NAME = (/ 'RL ', 'QL ', 'QLTOT ', 'DQLDT ', &
12171217
'RI ', 'QI ', 'QITOT ', 'DQIDT ', &
1218-
'QLCN ', 'PFL_CN ', 'PFL_LSAN', &
1219-
'QICN ', 'PFI_CN ', 'PFI_LSAN', &
1218+
'QLCN ', 'PFL_CN ', 'PFL_LSAN', 'ZLCL ', &
1219+
'QICN ', 'PFI_CN ', 'PFI_LSAN', 'ZLFC ', &
12201220
'FCLD ', 'QCTOT ', 'CNV_QC ', &
12211221
'REV_LS ', 'REV_AN ', 'REV_CN ', 'TPREC ', &
12221222
'Q ', 'DQDT ', 'DQRL ', 'DQRC ', &
@@ -1245,7 +1245,7 @@ subroutine SetServices ( GC, RC )
12451245

12461246
call MAPL_AddConnectivity ( GC, &
12471247
SHORT_NAME = (/ 'LWI ', 'FRLAND ', 'FRLANDICE', &
1248-
'FROCEAN ', 'FRLAKE ', 'WET1 ', &
1248+
'FROCEAN ', 'FRLAKE ', &
12491249
'GRN ', 'USTAR ', 'U10M ', &
12501250
'V10M ', 'SH ', 'Z0H ', &
12511251
'LAI ', 'TSOIL1 ', 'FRACI ', &
@@ -1262,6 +1262,18 @@ subroutine SetServices ( GC, RC )
12621262
RC=STATUS )
12631263
VERIFY_(STATUS)
12641264

1265+
! NOTE: GOCART's dust code expects WET1 to have all the cells with MAPL_UNDEF
1266+
! (aka not land) to be replaced with 1.0. We want WET1 to have
1267+
! MAPL_UNDEF over non-land points, so we need a separate export to pass
1268+
! to GOCART which is WET1 with all non-land points set to 1.0.
1269+
call MAPL_AddConnectivity ( GC, &
1270+
SRC_NAME = [ 'WET1_FOR_CHEM' ], &
1271+
SRC_ID = SURF, &
1272+
DST_NAME = [ 'WET1' ], &
1273+
DST_ID = CHEM, &
1274+
RC=STATUS )
1275+
VERIFY_(STATUS)
1276+
12651277
if (DO_CO2CNNEE == 1) then
12661278
call MAPL_AddConnectivity ( GC, &
12671279
SHORT_NAME = (/'CNNEE'/), &
@@ -1432,7 +1444,7 @@ subroutine SetServices ( GC, RC )
14321444
CHILD = TURBL, &
14331445
RC=STATUS )
14341446
VERIFY_(STATUS)
1435-
endif
1447+
endif
14361448

14371449
call MAPL_TerminateImport ( GC, &
14381450
SHORT_NAME = (/'TR ','TRG','DTG' /), &
@@ -1981,10 +1993,10 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
19811993
! The original 3D increments:
19821994

19831995
call Initialize_IncBundle_init(GC, GIM(MOIST), EXPORT, MTRIinc, __RC__)
1984-
1996+
19851997
#ifdef PRINT_STATES
19861998
call ESMF_StateGet(EXPORT, 'MTRI', iBUNDLE, rc=STATUS)
1987-
VERIFY_(STATUS)
1999+
VERIFY_(STATUS)
19882000

19892001
call WRITE_PARALLEL ( trim(Iam)//": MTRI - Convective Transport and Scavenging 3D Tendency Bundle" )
19902002
if ( MAPL_am_I_root() ) call ESMF_FieldBundlePrint ( iBUNDLE, rc=STATUS )
@@ -1996,7 +2008,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
19962008

19972009
#ifdef PRINT_STATES
19982010
call ESMF_StateGet(EXPORT, 'MCHEMTRI', iBUNDLE, rc=STATUS)
1999-
VERIFY_(STATUS)
2011+
VERIFY_(STATUS)
20002012

20012013
call WRITE_PARALLEL ( trim(Iam)//": MCHEMTRI - Convective Transport and Scavenging 2D Tendency Bundle" )
20022014
if ( MAPL_am_I_root() ) call ESMF_FieldBundlePrint ( iBUNDLE, rc=STATUS )

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSgwd_GridComp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install( FILES ${resource_files}
2828
DESTINATION etc
2929
)
3030

31-
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES GEOS_Shared MAPL esmf NetCDF::NetCDF_Fortran)
31+
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES GEOS_Shared MAPL ESMF::ESMF NetCDF::NetCDF_Fortran)
3232

3333
# CMake has an OpenMP issue with NAG Fortran: https://gitlab.kitware.com/cmake/cmake/-/issues/21280
3434
if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG")

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,19 @@ endif ()
2929
# and 10 minutes at O2. But only 7 seconds with O1. So we compile at O1
3030
if (CMAKE_Fortran_COMPILER_ID MATCHES Intel AND CMAKE_BUILD_TYPE MATCHES Release)
3131
set_source_files_properties(GEOS_BACM_1M_InterfaceMod.F90 PROPERTIES COMPILE_OPTIONS ${FOPT1})
32-
set_source_files_properties(GEOS_MGB2_2M_InterfaceMod.F90 PROPERTIES COMPILE_OPTIONS ${FOPT1})
32+
# set_source_files_properties(GEOS_MGB2_2M_InterfaceMod.F90 PROPERTIES COMPILE_OPTIONS ${FOPT1})
3333
endif ()
3434

3535
esma_add_library (${this}
3636
SRCS ${srcs}
37-
DEPENDENCIES GEOS_Shared GMAO_mpeu MAPL Chem_Shared Chem_Base esmf)
37+
DEPENDENCIES GEOS_Shared GMAO_mpeu MAPL Chem_Shared Chem_Base ESMF::ESMF)
3838

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

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/ConvPar_GF_GEOS5.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,8 @@ SUBROUTINE CUP_gf(its,ite,kts,kte ,itf,ktf, mtp &
34723472
dp=100.*(po_cup(i,k)-po_cup(i,k+1))
34733473
!--- add congestus and deep plumes, and convert to kg/kg/s
34743474
revsu_gf(i,k) = revsu_gf(i,k) + evap_flx(i,k)*g/dp
3475-
prfil_gf(i,k) = prfil_gf(i,k) + prec_flx(i,k)*g/dp
3475+
!--- leave precip flux in kg/m2/s
3476+
prfil_gf(i,k) = prfil_gf(i,k) + prec_flx(i,k)
34763477
enddo
34773478
enddo
34783479

0 commit comments

Comments
 (0)