Installation

Pre-built binaries

Pre-built binaries (library and executables) for several systems can be downloaded from the Releases page.

Building from source

Dependencies

To compile Grid2Grid, you will need the following tools:

Additionally, Grid2Grid relies on the following library, which is expected to be present on the system (are is generally easily installed via package managers):

Note

When compiling with Intel Fortran, the MKL library can be used as a FFTW3 implementation. To enable this, the ALLOW_MKL CMake option must be set to ON (see Build Grid2Grid).

Optionally, Grid2Grid can be compiled with the following libraries for additional features (also generally available via package managers):

The following libraries are used by Grid2Grid but are automatically downloaded and compiled during the build process:

While they are not direct dependencies, Grid2Grid is designed to work on the output of HOS-NWT and HOS-Ocean:

Download Grid2Grid

The source code of the latest Grid2Grid release can be downloaded from the Releases page or cloned using Git from the GitLab repository.

Build Grid2Grid

Options

To compile Grid2Grid with additional features, the following options can be passed to CMake:

  • BUILD_SHARED_LIBS (default: ON): Build shared libraries (only build the static version if you know what you are doing)

  • MPI_SUPPORT (default: ON): Build with MPI Parallelization

  • HDF5_SUPPORT (default: OFF): Build with HDF5 file format support

  • ALLOW_MKL (default: OFF): Allows MKL to be used as a FFTW3 implementation (mainly useful when compiling with Intel Fortran)

To pass one of these options to CMake, use -D<option_name>=<option_value> during the configuration step.

Compilation

To compile Grid2Grid, follow these steps:

  1. Configure the build with CMake:

cmake -S. -Bbuild

Note

If you want to enable additional features, pass the corresponding options to CMake. For example, to enable HDF5 support, use cmake -S. -Bbuild -DHDF5_SUPPORT=ON.

  1. Compile the code:

cmake --build build
  1. optionally, install the compiled binaries:

cmake --install build

Note

By default, the binaries will be installed in an appropriate location selected by CMake depending on the system. To install them in a different location, use the --prefix option when configuring the build with CMake. For example, to install the binaries in a local install directory, use cmake --install build --prefix install.

To install Grid2Grid for OpenFOAM, use:

cmake --install build --prefix $FOAM_USER_LIBBIN/..