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:
A Fortran compiler (e.g. GNU Fortran)
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:
EaFort, a collection and wrapper for other libraries
While they are not direct dependencies, Grid2Grid is designed to work on the output of HOS-NWT and HOS-Ocean:
HOS-NWT: repository, documentation and latest release
HOS-Ocean: repository, documentation and latest release
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 ParallelizationHDF5_SUPPORT(default:OFF): Build with HDF5 file format supportALLOW_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:
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.
Compile the code:
cmake --build build
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/..