Skip to content

Build the Ocean LETKF

Cheng Da edited this page Mar 29, 2023 · 20 revisions

Lib dependence of Ocean-LETKF

Ocean-LETKF requires 5 packages of libs:

  1. one fortran compiler (e.g., ifort or gfortran)
  2. one MPI implementation with fortran support (e.g., openMPI or MPICH)
  3. NetCDF lib with Fortran support
  4. HDF5 lib with Fortran support, which are used to read SMAP L2 data stored in HDF5 files.
  5. (optional) BUFRLIBS and one C compiler (e.g., gcc or icc) if building Ocean-letkf for the model hycom.

If the local lib of BUFRLIBS is not available, ocean-LETKF will download BUFRLIBS and install it under support/bufr_<version>. Check config/LOCAL_GFORTRAN.bufr.sh for more info.

Models supported by Ocean-LETKF

Ocean-LETKF currently supports the following 8 models:

  • MOM6
  • MOM4
  • HYCOM
  • HYCOM_NRL
  • ROMS
  • NEMO
  • SIS
  • CICE5

Build the Ocean-LETKF with build/make_*.sh tool

  1. Create machine configuration files under config/<machine>.*.sh (e.g., <machine>=LOCAL_GFORTRAN)
  2. Modify MACHINE=<machine> in the file config/machine.sh
  3. build obsop and letkf under build/make_obsop.<model>.sh (e.g., <model>=mom6)
cd build
bash make_obsop.<model>.sh
bash make_letkf.<model>.sh

Build the Ocean-LETKF through CMake

The main usage of CMAKE is to build the MOM6-LETKF as an application of the model GEOS-ESM. Unless you are using GEOS-ESM, you should always build the ocean-letkf through cmake with the option SOLO_BUILD=ON.

Note though libsrc/CMakelists.txt lists several model names, only mom6 has been supported yet

Build MOM6-LETKF as a stand-alone application (SOLO_BUILD=ON)

Most users will probably build MOM6-LETKF with local NetCDF & MPI libs by turning on the option SOLO_BUILD=ON when running cmake

mkdir cbuild && cd cbuild
cmake .. -DCMAKE_Fortran_COMPILER=<your_fortran_compiler> -DSOLO_BUILD=ON -DMODEL=mom6 -DCMAKE_INSTALL_PREFIX=<your_install_location>
make
make install

Add paths of your own built netcdf/hdf5 libraries

If you built the netcdf library under an unusual location or you have multiple netcdf libraries on your current system, you can assign CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH,

mkdir cbuild && cd cbuild
cmake .. -DCMAKE_Fortran_COMPILER=<your_fortran_compiler> -DSOLO_BUILD=ON -DMODEL=mom6 \
         -DCMAKE_INCLUDE_PATH="<your_netcdf_include>;<your_hdf5_include>"  \
         -DCMAKE_LIBRARY_PATH="<your_netcdf_lib>;<your_hdf5_lib>" \
         -DCMAKE_INSTALL_PREFIX=<your_install_location>
make
make install

On building OCEAN-LETKF with EMSA_baselibs on Discover, the command will be like:

mkdir cbuild && cd cbuild
cmake .. -DCMAKE_Fortran_COMPILER=ifort -DSOLO_BUILD=on -DMODEL=mom6 \
-DCMAKE_INCLUDE_PATH="$BASEDIR/Linux/include/netcdf;$BASEDIR/Linux/include/hdf5" \
-DCMAKE_LIBRARY_PATH="$BASEDIR/Linux/lib" \
-DCMAKE_INSTALL_PREFIX=<your_install_location>
make
make install

On Mac with gfortran, the command will be like:

mkdir cbuild && cd cbuild
cmake .. -DCMAKE_Fortran_COMPILER=gfortran -DSOLO_BUILD=on -DMODEL=mom6 \
    -DCMAKE_INCLUDE_PATH="$BASEDIR/Darwin/include/netcdf;$BASEDIR/Darwin/include/hdf5" \
    -DCMAKE_LIBRARY_PATH="$BASEDIR/Darwin/lib" \
    -DCMAKE_INSTALL_PREFIX=<your_install_location>
make
make install

Debug and Release version

Add -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=Release.

Build MOM6-LETKF as a GEOS application (SOLO_BUILD=OFF)

to be tested.

CI automatic build tests

Each push or pull request will trigger the build tests at Github Actions (https://github.com/UMD-AOSC/Ocean-LETKF/actions), to ensure the commit does not break the building process. There are

  • 9 tests for building all models supported by Ocean-LETKF through build/make_*.sh tools.
  • 1 test for building MOM6-LETKF with cmake.