Delft3D 4 Compilation
• Last updated: • Posted in: Software, Hydrodynamics
This tutorial explains how to compile the last tag of the Delft3D 4 source code available on Deltares’ Subversion repository. The kernels created from this source code are compatible with the Delft3D 4 GUI, available free-of-charge from Deltares.
I also have a compilation tutorial for Delft3D Flexible Mesh.
Prerequisites
In order to compile Delft3D 4 kernels tag 142586, the following software is required:
-
Visual Studio Community 2019 (version 16) with workload “Desktop development with C++” and the following additional components:
- C++ MFC for latest v142 build tools (x86 & x64)
- C++/CLI support for v142 build tools (Latest)
- C++ Modules for v142 build tools (x64/x86 - experimental)
-
Intel oneAPI Base Toolkit 2021. To save disk space, I only install the following components:
- Intel oneAPI Math Kernel Library
- Intel Distribution for GDB
-
Intel oneAPI HPC Toolkit 2021. To save disk space, I only install the following components:
- Intel MPI Library
- Intel oneAPI DPC++/C++ Compiler & Intel C++ Compiler Classic
- Intel Fortran Compiler (Beta) & Intel Fortran Compiler Classic
During the Intel oneAPI installation, make sure to activate integration with Visual Studio.
Please do not manually install other dependencies such as CMake.
The components listed above do not guarantee a minimal installation (i.e., some of them may be unnecessary; feel free to test).
Download links
Update A person that followed this tutorial recently told me that the Intel oneAPI links were down. I have copies of the offline installers, so I shared them with the person. However, I do not know if Intel allows redistribution of the installers. Also, I noticed that Deltares is migrating from Subversion to Git; their Subversion repository may stop working.
- Delft3D 4 source code:
- Tag 142586 (use a Subversion client to export it)
- Visual Studio Community 2019:
- Intel oneAPI Base Toolkit:
- Intel oneAPI HPC Toolkit:
Note that after version tag 142586, Delft3D source code repository was migrated from Subversion to Git, and it is now restricted to co-developers and Deltares employees. Therefore, the source code listed above is not from the latest development version.
Compilation
Compilation is straightforward thanks to the build.bat script:
-
Open “Intel oneAPI command prompt for Intel 64 for Visual Studio 2019”.
-
Change the working directory using the
cdcommand to the Delft3D source code folder (wherebuild.batis located).- Make sure that the path does not contain spaces. It is also advisable to use a short path (e.g.,
C:\MyDelft3D\...).
- Make sure that the path does not contain spaces. It is also advisable to use a short path (e.g.,
-
Run
build.bat delft3d4and wait for the automatic preparation and compilation. -
The compiled kernels will be in the
/build_delft3d4/x64subfolder. -
This
x64folder must be merged with thex64folder in the GUI installation directory (replacing existing files) in order to use Delft3D from the graphical interface.
Issues
- File
dioconfig.iniin\x64\dflow2d3d\defaultmust be copied to\x64\dwaves\defaultto run coupled wave-current models from the GUI.
If you find other installation issues, please let me know, and I will update the instructions.
Notes on compatibility
Intel oneAPI 2021 toolkits are not compatible with Visual Studio Community 2019 version 16.11.26 (released on April 11, 2023). Since the Community edition is only supported on the latest version (see Product Lifecycle and Servicing), Microsoft does not provide Community edition installers for earlier versions (e.g., 16.11.25, which is compatible). However, it is still possible to install earlier versions of the Community edition using the installers of other editions (Professional, Enterprise or BuildTools). See earlier Visual Studio 2019 releases and this Stack Overflow question.
The latest version of the Intel oneAPI 2021 toolkits is 2021.4. However, compilation of Delft3D 4 with 2021.4 toolkits seems to be unsupported. Version 2021.3 of the toolkits works without problems.
Delft3D 4 compilation requires Intel Fortran compiler version 2021, 2019, 2018 or 2016. However, on Intel’s website you can only download the latest version (current year) of the oneAPI toolkits. To get installers for previous versions, Intel “suggests” its users to purchase a license from a reseller (see this post). In order to download older versions without purchasing a license, direct download links may be used. The following GitHub repository contains a list of download links for Intel oneAPI toolkits versions 2021.x and 2022.1: github.com/hypersad/oneapi-release-history.
Acknowledgements
These instructions were adapted from Mathew Topper.
I thank Rafael Bueno for testing and providing valuable feedback.