Building WindNinja on Linux

Natalie Wagenbrenner edited this page Aug 16, 2018 · 26 revisions

Get WindNinja Source

git clone 

Install Third-Party Libraries

Note: These instructions are specific to Ubuntu 16.04, but building on other distributions is possible as well. See the steps in scripts/

Run scripts/ to fetch, build, and install third party libraries.

cd windninja/scripts/ && ./

Start CMake

Create a build directory outside the source tree. For example, if WindNinja is in ~/src/wind/windninja: mkdir ~/src/wind/build.

This build directory is where all of the build-related files will be located (executables, shared libraries, object files, qt moc files, etc.). This is done so that these files don't contaminate the source tree. One advantage of this is that all of these files can be deleted easily by just deleting the build directory.

cd ~/src/wind/build && cmake-gui ../windninja


cd ~/src/wind/build && ccmake ../windninja

Select configure to start the process of setting options and identifying locations of third party libraries, etc. If asked to "Specify the generator for this project" select Unix Makefiles and choose "Use default native compilers".

The general procedure to be used in the cmake gui is to edit the "Value" fields in the Name/Value pair list appropriately, then click the configure button. This procedure must be typically done in an iterative fashion (multiple times) as one edit may add additional requirements. Read below for the possible Options available.

CMake options:

Turn on one or both of the following options:

  • NINJA_QTGUI -- builds the WindNinja GUI
  • NINJA_CLI -- builds the WindNinja CLI

If you plan to use the optional conservation of mass and momentum solver, set:


The CMake build has several other general options which can be set:

  • CMAKE_BUILD_TYPE -- can be set to debug or release
  • CMAKE_INSTALL_PREFIX -- defines the install path
  • ENABLE_CONSOLE -- enables the GUI console on Windows, which can help with debugging
  • OPENMP_SUPPORT -- enables OpenMP support
  • SUPPRESS_WARNINGS -- suppresses common, known warnings that are not thought to affect the build
  • VERBOSE_WARNINGS -- sets warnings to all, and supercedes SUPRESS_WARNINGS (you may also want to enable CMAKE_VERBOSE_MAKEFILE in the advanced options)

Third-party libraries:

CMake will attempt to find all of the third party libraries needed for WindNinja. All are required with the exception of Qt, if the gui is not being built. CMake has default methods for handling libraries. It will usually ask for a path to a lib, a path to an include directory, and possibly a path to a binary that can specify some configuration values for the install. Since all of the libraries are required, the CMake configuration fails when one is not found. This means you must find the paths for each lib in order, as CMake fails each time you click "Configure" on the next unfound lib. After everything is found and set, click "Generate".

Build WindNinja

If you have correctly configured in the cmake gui and clicked "generate", a Makefile will be built in the build directory. Next run:

make && sudo make install

You may also need to run:

sudo ldconfig

make should compile and link WindNinja to all of its dependency libraries. The WindNinja executables should be located in build/src/gui and build/src/cli for the GUI and CLI versions, respectively. The core WindNinja shared library that handles the number crunching part of WindNinja is located in build/src/ninja.

make install should install all of the necessary WindNinja binaries and other files in the location specified earlier in the cmake CMAKE_INSTALL_PREFIX option.

Set Environment Variables

As of WindNinja 2.2.0, the environment variable WINDNINJA_DATA must be set. This points to datasets that WindNinja needs to run certain functions. If the program is installed (i.e., with make install), it is likely that WindNinja will find the path. Otherwise, the environment variable will need to be set:

export WINDNINJA_DATA=~/src/wind/windninja/data

(Optional) Install OpenFOAM 2.2.0

If you want to use the optional conservation of mass and momentum solver, you will need to build and install OpenFOAM 2.2.0. Follow the instructions at

Ubuntu 16.04 requires several fixes prior to compilation of OpenFOAM-2.2.0 and ThirdParty-2.2.0.

Before compiling OpenFOAM (details:

#Go into OpenFOAM's main source folder

#Change how the flex version is checked
find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='

Before compiling ThirdParty (details:

The CMake version in 16.04 is too new, so do a custom build.

wget ""
chmod +x getCmake
sed -i -e 's=\.3=.12.1=' getCmake
./makeCmake cmake-
sed -i -e 's=cmake-2\.8\.4=cmake- cmake-2.8.4=' etc/config/

Be sure the correct QT version is being used and add a few fixes.

export QT_SELECT=qt4
sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \

Build all third-party libraries:

./makeParaView > log.makePV 2>&1
./Allwmake > log.makeAll 2>&1

Update the shell environment and build the plugins

cd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers 

Test with blockMesh --help.

Finally, build our custom libraries and applications. For example:

mkdir -p $FOAM_RUN/../applications
cp -r ~/src/wind/windninja/src/ninjafoam/* $FOAM_RUN/../applications
cd $FOAM_RUN/../applications
wmake libso
cd utility/applyInit

This should build an executable called applyInit in $FOAM_RUN/../platforms/linux64GccDPOpt/bin and a shared library called in $FOAM_RUN/../platforms/linux64GccDPOpt/lib.

Be sure that NINJAFOAM=ON in CMake before building WindNinja.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.