Skip to content

Commit

Permalink
added specialty sims
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Bindle committed May 12, 2019
1 parent 3121bf6 commit 1a8534d
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 16 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ add_subdirectory(History)
add_subdirectory(HEMCO)
add_subdirectory(ISOROPIA)
add_subdirectory(GeosRad)
add_subdirectory(GTMM)
add_subdirectory(GeosCore)

77 changes: 66 additions & 11 deletions CMakeScripts/GC-ConfigureClassicBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,63 @@ elseif("${RUNDIR_GRID}" STREQUAL "025x03125")
set(RUNDIR_GRID "0.25x0.3125")
endif()

# Inspect MECH
inspect_rundir(RUNDIR_MECH 2)
if("${RUNDIR_MECH}" STREQUAL "standard")
# Inspect SIM and select KPP mech
set(STANDARD_MECHS
"standard"
"benchmark"
"aciduptake"
"marinePOA"
"masscons"
"TransportTracers"
"POPs"
"CH4"
"tagCH4"
"tagO3"
"tagCO"
"CO2"
"aerosol"

# TODO: remove
"Hg"
)
set(TROPCHEM_MECHS
"tropchem"
"RRTMG"
"TOMAS15"
"TOMAS40"
"complexSOA"
)
set(SOA_SVPOA_MECHS
"complexSOA_SVPOA"
)
set(CUSTOM_MECHS
"custom"
)

inspect_rundir(RUNDIR_SIM 2)
# Below is an "if in list" switch. Recall CMake lists are ; seperated lists.
if("${STANDARD_MECHS}" MATCHES ".*${RUNDIR_SIM}.*")
set(RUNDIR_MECH "Standard")
elseif("${RUNDIR_MECH}" STREQUAL "tropchem")
elseif("${TROPCHEM_MECHS}" MATCHES ".*${RUNDIR_SIM}.*")
set(RUNDIR_MECH "Tropchem")
elseif("${SOA_SVPOA_MECHS}" MATCHES ".*${RUNDIR_SIM}.*")
set(RUNDIR_MECH "SOA_SVPOA")
elseif("${CUSTOM_MECHS}" MATCHES ".*${RUNDIR_SIM}.*")
set(RUNDIR_MECH "custom")
else()
message(FATAL_ERROR "Unknown simulation type \"${RUNDIR_SIM}\". Cannot determine MECH.")
endif()

# Misc
if("${RUNDIR_SIM}" STREQUAL "masscons")
set_dynamic_default(GC_DEFINES DEFAULT MASSCONS)
elseif("${RUNDIR_SIM}" MATCHES ".*Hg.*")
set_dynamic_default(GC_DEFINES DEFAULT GTMM_Hg)
elseif("${RUNDIR_SIM}" MATCHES "TOMAS15")
set_dynamic_default(GC_DEFINES DEFAULT TOMAS TOMAS15)
set(NC_DIAG_GUESS "FALSE")
elseif("${RUNDIR_SIM}" MATCHES "TOMAS40")
set_dynamic_default(GC_DEFINES DEFAULT TOMAS TOMAS40)
endif()

# Inspect NESTED
Expand Down Expand Up @@ -149,18 +200,17 @@ set_dynamic_option(MECH
DEFAULT "${RUNDIR_MECH}"
LOG GENERAL_OPTIONS_LOG
SELECT_EXACTLY 1
OPTIONS "Standard" "Tropchem" "benchmark" "RRTMG"
OPTIONS "Standard" "Tropchem"
)

if(${MECH} STREQUAL "Tropchem")
set_dynamic_default(GC_DEFINES DEFAULT GRIDREDUCED)
elseif(${MECH} STREQUAL "RRTMG")
# Set GRIDREDUCED for specific simulation types
if("${MECH}" STREQUAL "Tropchem")
set_dynamic_default(GC_DEFINES DEFAULT GRIDREDUCED)
endif()


# Build RRTMG?
if("${MECH}" STREQUAL "RRTMG")
if("${RUNDIR_SIM}" STREQUAL "RRTMG")
set(RRTMG_DEFAULT "TRUE")
else()
set(RRTMG_DEFAULT "FALSE")
Expand All @@ -175,7 +225,7 @@ if(${RRTMG})
set_dynamic_default(GC_DEFINES DEFAULT "RRTMG")
endif()

if("${MECH}" STREQUAL "benchmark")
if("${RUNDIR_SIM}" STREQUAL "benchmark")
set(TIMERS_DEFAULT "TRUE")
else()
set(TIMERS_DEFAULT "FALSE")
Expand All @@ -193,8 +243,13 @@ endif()


# Get diagnostics
if("${RUNDIR_SIM}" MATCHES "TOMAS")
set(DIAG_DEFAULT "BPCH")
else()
set(DIAG_DEFAULT "NC" "BPCH")
endif()
set_dynamic_option(DIAG
DEFAULT "NC" "BPCH"
DEFAULT ${DIAG_DEFAULT}
OPTIONS "NC" "BPCH"
LOG GENERAL_OPTIONS_LOG
)
Expand Down
60 changes: 60 additions & 0 deletions GTMM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
if(NOT "${RUNDIR_SIM}" MATCHES ".*Hg.*")
return()
else()
list(APPEND GC_EXTRA_TARGETS "Hg")
set(GC_EXTRA_TARGETS "${GC_EXTRA_TARGETS}" PARENT_SCOPE)
endif()

add_library(Hg STATIC
assignAgeClassToRunningPool.F90
assignRanPoolToAgeClass.F90
CasaRegridModule.F90
CleanupCASAarrays.F90
defineArrays.F90
defineConstants.F90
doFPARandLAI.F90
doHerbCarbon.F90
doHerbCarbonHg.F90
doHerbivory.F90
doHgDeposition.F90
doLatitude.F90
doLeafRootShedding.F90
doMaxHg.F90
doNPP.F90
doOptimumTemperature.F90
doPET.F90
dorestart_mod.F90
doSoilMoisture.F90
doTreeCarbon.F90
doTreeCarbonHg.F90
getAgeClassBF.F90
getFireParams.F90
getFuelWood.F90
getSoilMoistParams.F90
getSoilParams.F90
GTMM_coupled.F90
HgOutForGEOS.F90
input_gtmm_mod.F90
loadCASAinput.F90
load_GC_data.F90
loadHgDeposition.F90
organizeAgeClasses.F90
processData.F90
sort_pick_veg.F90
)
target_link_libraries(Hg
PUBLIC
Headers
)


add_executable(gtmm
GTMM.F90
)

target_link_libraries(gtmm
PUBLIC Hg
)
install(TARGETS gtmm
RUNTIME DESTINATION ${RUNDIR}
)
2 changes: 1 addition & 1 deletion GeosCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ add_library(GeosCore STATIC

# TODO: when to omit these?
# exchange_mod.F
$<$<STREQUAL:${MECH},RRTMG>:rrtmg_rad_transfer_mod.F>
$<$<STREQUAL:${RUNDIR_SIM},RRTMG>:rrtmg_rad_transfer_mod.F>
# tomas_mod.F
)
target_link_libraries(GeosCore
Expand Down
6 changes: 2 additions & 4 deletions KPP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Add the correct subdirectory based on ${MECH}
if("${MECH}" STREQUAL "Standard")
add_subdirectory(Standard)
elseif("${MECH}" STREQUAL "benchmark")
add_subdirectory(Standard)
elseif("${MECH}" STREQUAL "RRTMG")
add_subdirectory(Tropchem)
elseif("${MECH}" STREQUAL "Tropchem")
add_subdirectory(Tropchem)
elseif("${MECH}" STREQUAL "SOA_SVPOA")
add_subdirectory(SOA_SVPOA)
else()
message(FATAL_ERROR "KPP build target for MECH=${MECH} is not yet implemented")
endif()
Expand Down
31 changes: 31 additions & 0 deletions KPP/SOA_SVPOA/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Add libKPPFirstPass.a
add_library(KPPFirstPass STATIC
gckpp_Precision.F90
gckpp_Parameters.F90
gckpp_Monitor.F90
)
target_link_libraries(KPPFirstPass
PUBLIC BaseTarget
)

# Add libKPP.a
add_library(KPP STATIC
gckpp_Function.F90
gckpp_Global.F90
gckpp_HetRates.F90
gckpp_Initialize.F90
gckpp_Integrator.F90
gckpp_Jacobian.F90
gckpp_JacobianSP.F90
gckpp_LinearAlgebra.F90
gckpp_Model.F90
gckpp_Monitor.F90
gckpp_Parameters.F90
gckpp_Precision.F90
gckpp_Rates.F90
gckpp_Util.F90
)
target_link_libraries(KPP
PUBLIC GeosUtil2
)

0 comments on commit 1a8534d

Please sign in to comment.