Installing FLEXPART v11 with ECMWF Support

This post walks through a full FLEXPART v11 installation for ECMWF meteorological data with NetCDF and Fortran support, including resolving common compilation issues. All components were built from source on a Linux HPC system with user-level access.


⚙️ Installation Structure

1
2
export DIR=/data/user/hao_y/lib
export INSTALL_DIR=$DIR

All components (GCC, HDF5, NetCDF, ecCodes, etc.) will be installed under this directory tree.


🔧 Step-by-Step Build Pipeline

1. GCC 13.2.0 (with Fortran Support)

1
2
3
4
5
6
7
8
wget https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
tar -xzf gcc-13.2.0.tar.gz
cd gcc-13.2.0
./contrib/download_prerequisites
mkdir build && cd build
../configure --prefix=$DIR/gcc-13.2.0 --enable-languages=c,c++,fortran,go --disable-multilib
make -j$(nproc)
make install

Export compilers:

1
2
3
4
5
6
7
8
9
export PATH=$DIR/gcc-13.2.0/bin:$PATH
export LD_LIBRARY_PATH=$DIR/gcc-13.2.0/lib64:$LD_LIBRARY_PATH
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export CFLAGS='-gdwarf-2 -gstrict-dwarf'
export FCFLAGS=-m64
export FFLAGS=-m64

2. HDF5 1.14.6

1
2
3
4
5
6
7
8
wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/downloads/hdf5-1.14.6.tar.gz
tar -xzf hdf5-1.14.6.tar.gz
cd hdf5-1.14.6
./configure --prefix=$DIR/hdf5 --enable-cxx --enable-fortran --enable-shared
make -j$(nproc)
make install

h5cc -showconfig ## check whether it is installed properly

3. NetCDF (C + Fortran)

3.1 NetCDF-C

1
2
3
4
5
6
7
8
9
10
11
wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.3.tar.gz -O netcdf-c-4.9.3.tar.gz
tar -xzf netcdf-c-4.9.3.tar.gz
cd netcdf-c-4.9.3
./configure --prefix=$DIR/netcdf \
CPPFLAGS="-I$DIR/hdf5/include" \
LDFLAGS="-L$DIR/hdf5/lib" \
--enable-netcdf-4 --disable-dap
make -j$(nproc)
make install

nc-config --all ## check whether it is installed properly

3.2 NetCDF-Fortran

1
2
3
4
5
6
wget https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz -O netcdf-fortran-4.6.1.tar.gz
tar -xzf netcdf-fortran-4.6.1.tar.gz
cd netcdf-fortran-4.6.1
./configure --prefix=$DIR/netcdf
make -j$(nproc)
make install

4. OpenMPI (Optional for MPI mode)

1
2
3
4
5
6
7
8
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.gz
tar -xzf openmpi-4.1.6.tar.gz
cd openmpi-4.1.6
./configure --prefix=$DIR/libs/openmpi
make -j$(nproc)
make install
export PATH=$DIR/libs/openmpi/bin:$PATH
export LD_LIBRARY_PATH=$DIR/libs/openmpi/lib:$LD_LIBRARY_PATH

5. AEC Library (Required by ecCodes)

1
2
3
4
5
6
wget https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6/libaec-v1.0.6.tar.gz
tar -xzf libaec-v1.0.6.tar.gz
cd libaec-v1.0.6 && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$DIR/libaec
make -j$(nproc)
make install

6. ecCodes (with Fortran and NetCDF)

1
2
3
4
5
6
7
wget https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.33.0-Source.tar.gz
tar -xzf libaec-v1.0.6.tar.gz
# Unpack and build
cd eccodes-2.33.0-source && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$DIR/eccodes -DCMAKE_PREFIX_PATH="$DIR/netcdf;$DIR/hdf5;$DIR/libaec" -DENABLE_NETCDF=ON -DENABLE_FORTRAN=ON -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
make install

📃 Environment Exports Summary

Set these variables in your .bashrc or shell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export PATH=$DIR/gcc-13.2.0/bin:$PATH
export LD_LIBRARY_PATH=$DIR/gcc-13.2.0/lib64:$LD_LIBRARY_PATH
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export FFLAGS=-m64

# HDF5
export HDF5_DIR=$DIR/hdf5
export CPATH=$HDF5_DIR/include:$CPATH
export LIBRARY_PATH=$HDF5_DIR/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$HDF5_DIR/lib:$LD_LIBRARY_PATH

# NetCDF
export NETCDF_DIR=$DIR/netcdf
export CPATH=$NETCDF_DIR/include:$CPATH
export LIBRARY_PATH=$NETCDF_DIR/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$NETCDF_DIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$NETCDF_DIR/lib/pkgconfig:$PKG_CONFIG_PATH

# AEC
export CPATH=$DIR/libaec/include:$CPATH
export LIBRARY_PATH=$DIR/libaec/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$DIR/libaec/lib:$LD_LIBRARY_PATH

# ecCodes
export CPATH=$DIR/eccodes/include:$CPATH
export LIBRARY_PATH=$DIR/eccodes/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$DIR/eccodes/lib:$LD_LIBRARY_PATH
export PATH=$DIR/eccodes/bin:$PATH
export PKG_CONFIG_PATH=$DIR/eccodes/lib/pkgconfig:$PKG_CONFIG_PATH

🌐 FLEXPART v11 Compilation (ECMWF Mode)

1
2
3
4
5
wget https://gitlab.phaidra.org/flexpart/flexpart/-/archive/v11/flexpart-v11.tar.gz
tar -xzf flexpart-v11.tar.gz
cd flexpart-v11
# the place to change in the ./src/makefile_gfortran is the F90 = /data/user/hao_y/lib/gcc-13.2.0/bin/gfortran
make -f makefile_gfortran -j4 eta=no ncf=yes
  • eta=no: Use hybrid ECMWF coordinate system
  • ncf=yes: Enable NetCDF support

❌ Common Errors and Fixes

Error Cause Solution
cannot find -leccodes_f90 ecCodes built without Fortran Add -DENABLE_FORTRAN=ON
AEC library not found libaec missing Install libaec and add to CMAKE_PREFIX_PATH
GLIBCXX_3.4.30 not found Old libstdc++ in system Build newer GCC (>=13) and use its lib path
gfortran: command not found GCC built without Fortran Rebuild with --enable-languages=c,c++,fortran

📅 Final Notes

Think of ./configure as the blueprint, make as construction, and make install as moving into your house and wiring the electricity.
You now have a clean, custom-built FLEXPART environment with all dependencies resolved, ready to simulate ECMWF-based transport at scale.

when copy the setting from another PC into the release folder, you need to change the permission of the folder by typing chmod -R 755 ./options and chmod 644./options/RELEASES or any other files.

For multi-core processing, you can use the export OMP_NUM_THREADS=4 to set 4 cores (can set for more) and then with ./FLEXPART command to run FLEXPART with multiple processes.

Sometimes, we will find error of “Program received signal SIGSEGV: Segmentation fault - invalid memory reference.” By typing ulimit -s unlimted, we can solve this problem.

Reference

  1. FLEXPART GitLab repository
    https://gitlab.phaidra.org/flexpart/flexpart
    (Main source code and Makefiles for FLEXPART v10/v11)

  2. FLEXPART Installation Guide (official wiki)
    https://www.flexpart.eu/wiki/FpInstallation
    (Overview of FLEXPART compilation across versions and systems)

  3. ECMWF ecCodes documentation
    https://confluence.ecmwf.int/display/ECC/ecCodes+Home
    (Build instructions, environment variables, and sample readers)

GEOS-Chem Installation and Run log From Formula to Structure: Inferring Compound Class from MS1 + MS2

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×