Skip to content

Commit

Permalink
Add in option to build MPAS JEDI (#4)
Browse files Browse the repository at this point in the history
* Start to support building with MPAS
  • Loading branch information
CoryMartin-NOAA authored Nov 2, 2023
1 parent 2bf1130 commit ca1b74c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ jedicmake/
land-imsproc/
land-jediincr/
mom6/
/MPAS/
/mpas-jedi/
/mpas-jedi-data/
oops/
saber/
saber-data/
Expand Down
44 changes: 31 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ set( ENABLE_MPI ON CACHE BOOL "Compile with MPI" )
option(BUILD_RDASBUNDLE "Build RDAS Bundle" ON)
option(CLONE_JCSDADATA "Clone JCSDA test data repositories" OFF)
option(WORKFLOW_TESTS "Include regional-workflow dependent tests" OFF)
option(MPAS_DYCORE "Use MPAS" OFF)
option(FV3_DYCORE "Use FV3" ON)

# Initialize bundle
# -----------------
Expand Down Expand Up @@ -79,15 +81,25 @@ if(BUILD_RDASBUNDLE)
option(ENABLE_UFO_DATA "Obtain ufo test data from ufo-data repository (vs tarball)" ON)
ecbuild_bundle( PROJECT ufo GIT "https://github.com/jcsda/ufo.git" BRANCH develop )

if(FV3_DYCORE)
# FMS and FV3 dynamical core
ecbuild_bundle( PROJECT fms GIT "https://github.com/jcsda/FMS.git" BRANCH release-stable )
ecbuild_bundle( PROJECT fv3 GIT "https://github.com/jcsda/GFDL_atmos_cubed_sphere.git" BRANCH release-stable )
ecbuild_bundle( PROJECT fms GIT "https://github.com/jcsda/FMS.git" BRANCH release-stable )
ecbuild_bundle( PROJECT fv3 GIT "https://github.com/jcsda/GFDL_atmos_cubed_sphere.git" BRANCH release-stable )

# fv3-jedi and associated repositories
ecbuild_bundle( PROJECT femps GIT "https://github.com/jcsda/femps.git" BRANCH develop )
ecbuild_bundle( PROJECT fv3-jedi-lm GIT "https://github.com/jcsda/fv3-jedi-linearmodel.git" BRANCH develop )
option(ENABLE_FV3_JEDI_DATA "Obtain fv3-jedi test data from fv3-jedi-data repository (vs tarball)" ON)
ecbuild_bundle( PROJECT fv3-jedi GIT "https://github.com/jcsda/fv3-jedi.git" BRANCH develop )
ecbuild_bundle( PROJECT femps GIT "https://github.com/jcsda/femps.git" BRANCH develop )
ecbuild_bundle( PROJECT fv3-jedi-lm GIT "https://github.com/jcsda/fv3-jedi-linearmodel.git" BRANCH develop )
option(ENABLE_FV3_JEDI_DATA "Obtain fv3-jedi test data from fv3-jedi-data repository (vs tarball)" ON)
ecbuild_bundle( PROJECT fv3-jedi GIT "https://github.com/jcsda/fv3-jedi.git" BRANCH develop )
endif()

if(MPAS_DYCORE)
set(MPAS_DOUBLE_PRECISION "ON" CACHE STRING "MPAS-Model: Use double precision 64-bit Floating point.")
set(MPAS_CORES init_atmosphere atmosphere CACHE STRING "MPAS-Model: cores to build.")
ecbuild_bundle( PROJECT MPAS GIT "https://github.com/JCSDA-internal/MPAS-Model.git" BRANCH release-stable UPDATE )
option(ENABLE_MPAS_JEDI_DATA "Obtain mpas-jedi test data from mpas-jedi-data repository (vs tarball)" ON)
ecbuild_bundle( PROJECT mpas-jedi GIT "https://github.com/JCSDA/mpas-jedi" BRANCH develop UPDATE )
endif()

# Build IODA converters
option(BUILD_IODA_CONVERTERS "Build IODA Converters" ON)
Expand Down Expand Up @@ -126,14 +138,20 @@ if(CLONE_JCSDADATA)
BRANCH ${GIT_BRANCH_FUNC} )
endif()

# same procedure for fv3-jedi-data
find_branch_name(REPO_DIR_NAME fv3-jedi)
if( NOT DEFINED ENV{LOCAL_PATH_JEDI_TESTFILES} AND NOT DEFINED GIT_TAG_FUNC )
ecbuild_bundle( PROJECT fv3-jedi-data GIT "https://github.com/JCSDA-internal/fv3-jedi-data.git" BRANCH develop )
# same procedure for fv3-jedi-data
if(FV3_DYCORE)
find_branch_name(REPO_DIR_NAME fv3-jedi)
if( NOT DEFINED ENV{LOCAL_PATH_JEDI_TESTFILES} AND NOT DEFINED GIT_TAG_FUNC )
ecbuild_bundle( PROJECT fv3-jedi-data GIT "https://github.com/JCSDA-internal/fv3-jedi-data.git" BRANCH develop )

# If fv3-jedi's current branch is available in ioda-data repo, that branch will be checked out
branch_checkout (REPO_DIR_NAME fv3-jedi-data
BRANCH ${GIT_BRANCH_FUNC} )
# If fv3-jedi's current branch is available in ioda-data repo, that branch will be checked out
branch_checkout (REPO_DIR_NAME fv3-jedi-data
BRANCH ${GIT_BRANCH_FUNC} )
endif()
endif()

if(MPAS_DYCORE)
ecbuild_bundle( PROJECT mpas-jedi-data GIT "https://github.com/jcsda-internal/mpas-jedi-data.git" BRANCH develop UPDATE )
endif()

endif(CLONE_JCSDADATA)
Expand Down
20 changes: 18 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ usage() {
echo " -f force a clean build DEFAULT: NO"
echo " -d include JCSDA ctest data DEFAULT: NO"
echo " -a build everything in bundle DEFAULT: NO"
echo " -m select dycore DEFAULT: FV3"
echo " -h display this message and quit"
echo
exit 1
Expand All @@ -39,8 +40,9 @@ BUILD_VERBOSE="NO"
CLONE_JCSDADATA="NO"
CLEAN_BUILD="NO"
BUILD_JCSDA="NO"
DYCORE="FV3"

while getopts "p:t:c:hvdfa" opt; do
while getopts "p:t:c:m:hvdfa" opt; do
case $opt in
p)
INSTALL_PREFIX=$OPTARG
Expand All @@ -51,6 +53,9 @@ while getopts "p:t:c:hvdfa" opt; do
c)
CMAKE_OPTS=$OPTARG
;;
m)
DYCORE=$OPTARG
;;
v)
BUILD_VERBOSE=YES
;;
Expand Down Expand Up @@ -101,6 +106,18 @@ mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
WORKFLOW_BUILD=${WORKFLOW_BUILD:-"OFF"}
CMAKE_OPTS+=" -DWORKFLOW_TESTS=${WORKFLOW_BUILD}"

# determine which dycore to use
if [[ $DYCORE == 'FV3' ]]; then
CMAKE_OPTS+=" -DFV3_DYCORE=ON"
builddirs="fv3-jedi iodaconv"
elif [[ $DYCORE == 'MPAS' ]]; then
CMAKE_OPTS+=" -DFV3_DYCORE=OFF -DMPAS_DYCORE=ON"
builddirs="mpas-jedi iodaconv"
else
echo "$DYCORE is not a valid dycore option. Valid options are FV3 or MPAS"
exit 1
fi

# JCSDA changed test data things, need to make a dummy CRTM directory
if [[ $BUILD_TARGET == 'hera' ]]; then
mkdir -p $dir_root/test-data-release/
Expand All @@ -121,7 +138,6 @@ set -x
if [[ $BUILD_JCSDA == 'YES' ]]; then
make -j ${BUILD_JOBS:-6} VERBOSE=$BUILD_VERBOSE
else
builddirs="fv3-jedi iodaconv"
for b in $builddirs; do
cd $b
make -j ${BUILD_JOBS:-6} VERBOSE=$BUILD_VERBOSE
Expand Down

0 comments on commit ca1b74c

Please sign in to comment.