Skip to content

Commit

Permalink
Frontend for TSMP2 (#24)
Browse files Browse the repository at this point in the history
* add model components as git submodules

* add component feature to CmakeLists

* add modelcounter in CMakeLists

* implementation of first version of front end

- add shell script build_tsmp2.sh
- CMakeLists.txt adaptations
- Revise README and add quickstart with front-end
- update gitignore

* Update ReadMe

* tip-o fix, clean-up and change to stg2022

* bugfixes for setting `PDAF_SRC`

* use `${PDAF}` instead of `PDAF_SRC` for checking PDAF

* clean-up and ICON build

-clean up confusing messages in CMakeLists.txt
-add message to indicate cmake call
-change ICON build according to model component not comp_srcs

* update readme quickstart and cmake/BuildICON.cmake

* update ReadMe and build_tsmp2.sh (review)

-add version in build_tsmp2.sh
-fix spelling quiet in build_tsmp2.sh
-change bash shebang for more portability in build_tsmp2.sh
-add pipefail in build_tsmp2.sh
-rephrase tip in README
-change header to Building TSMP2 with CMake in README

* take the directory of build_tsmp2.sh for cmake_tsmp2_dir and remove option tsmp2_dir

* rename eTSMP to TSMP2 in xxxx_MODEL_VERSIONS

* add check_build_oasis function

-use function for OASIS3 build check
-shift MODELCOUNT to function
-add TSMP2_ENV output in build_tsmp2.sh log

* fix/unify if-clause in build_tsmp2.sh

* Cloning of component submodules in build_tsmp2.sh

* add branches to submodules

* add --init to submodule overwrite and fix ParFlow component name

* add CLM3.5 and COSMO5.01 as submodules

* update eCLM submodule

* remove source_dir option in build_tsmp2.sh, README typ-o

- take cmake_tsmp2_dir as cmake source directory

* change submodule remote url of COSMO

* fix submodule overwrite prompting

* update models/pdaf submodule

* include --force option when overwriting submodule

---------

Co-authored-by: Johannes Keller <jo.keller@fz-juelich.de>
  • Loading branch information
s-poll and jjokella authored Sep 26, 2024
1 parent 7ea08d8 commit 6afa5c7
Show file tree
Hide file tree
Showing 22 changed files with 517 additions and 97 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
bin/*
bld/*
run/
eCLM/
icon2.6.4_oascoup/
oasis3-mct/
parflow/
CLM3.5/
cosmo5.01_fresh/
pdaf/
32 changes: 32 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[submodule "models/icon"]
path = models/icon
url = https://gitlab.jsc.fz-juelich.de/sdlts/tsmp_components_mirrors/icon2.6.4_oascoup
branch = master
[submodule "models/parflow"]
path = models/parflow
url = https://github.com/parflow/parflow.git
branch = master
[submodule "models/parflow_pdaf"]
path = models/parflow_pdaf
url = https://github.com/HPSCTerrSys/parflow
branch = tsmp-pdaf
[submodule "models/pdaf"]
path = models/pdaf
url = https://github.com/HPSCTerrSys/pdaf.git
branch = tsmp-pdaf-patched
[submodule "models/eCLM"]
path = models/eCLM
url = https://github.com/HPSCTerrSys/eCLM.git
branch = master
[submodule "models/oasis3-mct"]
path = models/oasis3-mct
url = https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct
branch = v5.0_patched
[submodule "models/CLM3.5"]
path = models/CLM3.5
url = https://github.com/HPSCTerrSys/CLM3.5.git
branch = tsmp-patches-v0.1
[submodule "models/cosmo5.01_fresh"]
path = models/cosmo5.01_fresh
url = https://gitlab.jsc.fz-juelich.de/sdlts/tsmp_components_mirrors/cosmo5.01_fresh.git
branch = tsmp-oasis
108 changes: 90 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,56 +1,128 @@
cmake_minimum_required (VERSION 3.21.1)
project(eTSMP LANGUAGES C CXX Fortran)
project(TSMP2 LANGUAGES C CXX Fortran)
include(ExternalProject)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(Utils)

# Prevent in-source builds
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

# set default of components to off
option(ICON "Compile ICON within TSMP2 framework" OFF)
option(COSMO "Compile COSMO within TSMP2 framework" OFF)
option(eCLM "Compile eCLM within TSMP2 framework" OFF)
option(CLM3.5 "Compile CLM3.5 within TSMP2 framework" OFF)
option(ParFlow "Compile ParFlow within TSMP2 framework" OFF)
option(PDAF "Compile PDAF within TSMP2 framework" OFF)


if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE")
endif()

find_package(MPIFortran REQUIRED)
if(DEFINED OASIS_SRC)
include(BuildOASIS3MCT)
list(APPEND MODEL_DEPENDENCIES OASIS3_MCT)
endif()
# init CMAKE internal variables
string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME)
set(MODEL_ID "")

# TODO (for all Build*.cmake scripts):
# - Check validity of compile flags
# - Implement set of compile flags depending on compiler (e.g. GNU, Intel) and
# build configuration (e.g. Debug, Release, Profiling)

if(DEFINED eCLM_SRC)
include(BuildeCLM)
list(APPEND COMPONENT_MODELS "eCLM")
endif()
# model settings
set(MODEL_ID "")

if(DEFINED CLM35_SRC)
include(BuildCLM3.5)
list(APPEND COMPONENT_MODELS "CLM3.5")
find_package(MPIFortran REQUIRED)
check_build_oasis(BUILD_OASIS) # check if >=2 components (ICON, COSMO, eCLM, CLM3.5, ParFlow) are build
if (BUILD_OASIS)
if(NOT DEFINED OASIS_SRC)
set(OASIS_SRC "${CMAKE_SOURCE_DIR}/models/oasis3-mct")
endif()
include(BuildOASIS3MCT)
list(APPEND MODEL_DEPENDENCIES OASIS3_MCT)
endif()

if(DEFINED ICON_SRC)
if (${ICON})
if(NOT DEFINED ICON_SRC)
set(ICON_SRC "${CMAKE_SOURCE_DIR}/models/icon")
endif()
include(BuildICON)
list(APPEND COMPONENT_MODELS "ICON")
if ("${MODEL_ID}" STREQUAL "")
set(MODEL_ID "ICON")
else()
set(MODEL_ID "${MODEL_ID}-ICON")
endif()
endif()

if(DEFINED COSMO_SRC)
if (${COSMO})
if(DEFINED COSMO_SRC)
set(COSMO_SRC "${CMAKE_SOURCE_DIR}/models/cosmo5.01_fresh")
endif()
include(BuildCOSMO)
list(APPEND COMPONENT_MODELS "COSMO5.1")
set(MODEL_ID "${MODEL_ID}COSMO")
endif()

if(DEFINED PARFLOW_SRC)
if (${eCLM})
if(NOT DEFINED eCLM_SRC)
set(eCLM_SRC "${CMAKE_SOURCE_DIR}/models/eCLM")
endif()
include(BuildeCLM)
list(APPEND COMPONENT_MODELS "eCLM")
if ("${MODEL_ID}" STREQUAL "")
set(MODEL_ID "eCLM")
else()
set(MODEL_ID "${MODEL_ID}-eCLM")
endif()
endif()

if (${CLM3.5})
if(DEFINED CLM35_SRC)
set(CLM35_SRC "${CMAKE_SOURCE_DIR}/models/CLM3.5")
endif()
include(BuildCLM3.5)
list(APPEND COMPONENT_MODELS "CLM3.5")
set(MODEL_ID "${MODEL_ID}CLM3.5")
endif()

if (${ParFlow})
if(NOT DEFINED PARFLOW_SRC AND NOT ${PDAF})
set(PARFLOW_SRC "${CMAKE_SOURCE_DIR}/models/parflow")
elseif (NOT DEFINED PARFLOW_SRC AND ${PDAF})
set(PARFLOW_SRC "${CMAKE_SOURCE_DIR}/models/parflow_pdaf")
endif()
include(BuildParFlow)
list(APPEND COMPONENT_MODELS "ParFlow")
if ("${MODEL_ID}" STREQUAL "")
set(MODEL_ID "ParFlow")
else()
set(MODEL_ID "${MODEL_ID}-ParFlow")
endif()
endif()

if(DEFINED PDAF_SRC)
if (${PDAF})
if(NOT DEFINED PDAF_SRC)
set(PDAF_SRC "${CMAKE_SOURCE_DIR}/models/pdaf")
endif()
include(BuildPDAF)
include(BuildPDAFMODEL)
include(BuildPDAFFRAMEWORK)
list(APPEND COMPONENT_MODELS "PDAF")
if ("${MODEL_ID}" STREQUAL "")
set(MODEL_ID "PDAF")
else()
set(MODEL_ID "${MODEL_ID}-PDAF")
endif()
endif()

print_model_versions("${COMPONENT_MODELS}" "${eTSMP_MODEL_VERSIONS}")
# set paths
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE)
endif()

print_model_versions("${COMPONENT_MODELS}" "${TSMP2_MODEL_VERSIONS}")

#message(FATAL_ERROR "at the end of script")
Loading

0 comments on commit 6afa5c7

Please sign in to comment.