Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Building WindNinja on Linux
Get WindNinja Source
git clone https://github.com/firelab/windninja.git
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/build_deps.sh to fetch, build, and install third party libraries.
cd windninja/scripts/ && ./build_deps.sh
Create a build directory outside the source tree. For example, if WindNinja is in
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.
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:
- NINJAFOAM = ON
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)
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".
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:
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:
(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 http://openfoam.org/download/2-2-0-source/.
Ubuntu 16.04 requires several fixes prior to compilation of OpenFOAM-2.2.0 and ThirdParty-2.2.0.
Before compiling OpenFOAM (details: https://bugs.openfoam.org/view.php?id=1974):
#Go into OpenFOAM's main source folder cd $WM_PROJECT_DIR #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: https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.2.2/Ubuntu):
The CMake version in 16.04 is too new, so do a custom build.
cd $WM_THIRD_PARTY_DIR wget "https://raw.github.com/wyldckat/scripts4OpenFOAM3rdParty/master/getCmake" chmod +x getCmake sed -i -e 's=\.3=.12.1=' getCmake ./getCmake ./makeCmake cmake-22.214.171.124 foam sed -i -e 's=cmake-2\.8\.4=cmake-126.96.36.199 cmake-2.8.4=' etc/config/paraview.sh wmSET $FOAM_SETTINGS
Be sure the correct QT version is being used and add a few fixes.
cd $WM_THIRD_PARTY_DIR export QT_SELECT=qt4 sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \ ParaView-3.12.0/VTK/Rendering/vtkXOpenGLRenderWindow.cxx
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 wmSET $FOAM_SETTINGS ./Allwclean ./Allwmake
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 wmake
This should build an executable called applyInit in $FOAM_RUN/../platforms/linux64GccDPOpt/bin and a shared library called libWindNinja.so in $FOAM_RUN/../platforms/linux64GccDPOpt/lib.
Be sure that
NINJAFOAM=ON in CMake before building WindNinja.