Skip to content

Building

Gerasimos Chourdakis edited this page Jun 8, 2018 · 26 revisions

To build the adapter, you need to install a few dependencies and then execute the Allwmake script.

  1. Download the adapter or (better) install git and clone this repository: git clone https://github.com/precice/openfoam-adapter.git.
  2. Install the latest yaml-cpp headers and shared library, preferably from your Linux distribution's repository. (at least yaml-cpp 0.5.x)
    • If you use Boost >= 1.67, you also need yaml-cpp >= 0.6 (read more here).
    • If you are using Ubuntu (and Boost < 1.67), you are looking for the package libyaml-cpp-dev. For example, run sudo apt install libyaml-cpp-dev.
    • If you want to build yaml-cpp from source, you need to build it as a shared library (cmake -DBUILD_SHARED_LIBS=ON). You also need to set it in your CPLUS_INCLUDE_PATH and LD_LIBRARY_PATH:
      export CPLUS_INCLUDE_PATH="path/to/yaml-cpp/include:${CPLUS_INCLUDE_PATH}"
      export LD_LIBRARY_PATH="path/to/yaml-cpp/build:${LD_LIBRARY_PATH}"
      
  3. Install the preCICE headers and library, following its building instructions.
    • If you want to use preCICE as a static library, check and adjust its dependencies in Allwmake (ADAPTER_PRECICE_DEP).
  4. Install an OpenFOAM distribution. For example, read the instructions for openfoam.org on Ubuntu. See also the sections "User Configuration" and "Getting Started". Read more in Notes on OpenFOAM.
  5. Execute the build script: ./Allwmake.
    • See and adjust the configuration in the beginning of the script first, if needed.
    • If everything goes well, you will receive a success message.
    • If you receive a message that there were undefined symbols, this probably means that you used preCICE as a static library, but you didn't specify its dependencies correctly.
    • In any case, make sure that your OpenFOAM environment is loaded correctly (e.g. see the WM_PROJECT_VERSION value in the beginning of the Allwmake output).

Note: If any dependencies are not installed in the standard system paths, the locations of their headers need to be specified in the CPLUS_INCLUDE_PATH and of their libraries in the LIBRARY_PATH or LD_LIBRARY_PATH.

The -DADAPTER_DEBUG_MODE flag inside ADAPTER_PREP_FLAGS activates additional debug messages. You may also change the target directory or specify the number of threads to use for the compilation. See the comments in Allwmake for more.

In order to upgrade the adapter, or before you build for another OpenFOAM version, run ./Allclean first. Get the latest version using git pull.

Next: configure and load the adapter or run a tutorial.