Use CMake to install deal.II and build the individual programs.

This adapter is a collection of examples of a deal.II solver adapted for preCICE. To build the adapter, we first need to get the deal.II and preCICE header files and libraries. Afterwards, we can build the adapter using CMake and we can run a tutorial.

Get deal.II

Building the adapter requires deal.II version 9.2 or greater. You can find all available download options on the deal.II website.

Binary packages

deal.II is available in several Linux distributions. For example, if you are using Ubuntu, you can get the libdeal.ii-dev package (see also the backports ppa):

sudo apt install libdeal.ii-dev libdeal.ii-doc cmake make g++
cp -r /usr/share/doc/libdeal.ii-doc/examples/step-1 .
cd step-1
cmake .
make run

Building from source

Get the latest release from the deal.II repository and build using CMake:

git clone https://github.com/dealii/dealii.git
mkdir build
cd build/

cmake \
    -D DEAL_II_WITH_UMFPACK="ON" \
    -D DEAL_II_WITH_THREADS="ON" \
    -D DEAL_II_COMPONENT_EXAMPLES="OFF" \
    ..

make -j 4

The direct solvers in this examples require UMFPACK. The nonlinear-solver utilizes a shared-memory parallelization. We disable building the examples only to significantly reduce the building time and storage needs.

Advanced: Building in production

If you want to use deal.II in production, there may be several options you may want to tune. In this case, use ccmake or check the deal.II CMake documentation. For example:

cmake \
    -D CMAKE_BUILD_TYPE="DebugRelease" \
    -D CMAKE_CXX_FLAGS="-march=native" \
    -D DEAL_II_CXX_FLAGS_RELEASE="-O3" \
    -D DEAL_II_WITH_UMFPACK="ON" \
    -D DEAL_II_WITH_THREADS="ON" \
    -D DEAL_II_COMPONENT_EXAMPLES="OFF" \
    -D CMAKE_INSTALL_PREFIX=/path/install/dir \
    ../dealii

make -j 4

Detailed installation instructions are given in the installation section of the deal.II webpage.

Get preCICE

Have a look at our preCICE installation guide.

Build the adapter

If you have deal.II and preCICE globally installed in your system and want to run a tutorial, building the adapter is as simple as cmake . && make:

  1. Clone the repository and navigate to the top-level directory

    git clone https://github.com/precice/dealii-adapter.git && cd dealii-adapter
    
  2. The solvers are compiled into a single executable. Configuration is carried out using cmake:
    • If you have deal.II and preCICE installed globally on your system:
    cmake .
    
    • If you have deal.II and preCICE installed in a local directory:
    cmake -DDEAL_II_DIR=/path/to/deal.II -DpreCICE_DIR=/path/to/precice .
    

    where *_DIR points to your installation (not source) directory. This should be the same as the CMAKE_INSTALL_PREFIX you used when installing the respective library. If you have set either of these variables globally, you could skip it in the command above.

  3. Run

    make
    

    to build the adapter. This will generate the elasticity executable.

  4. Ensure that the executable is run-time discoverable by adding it to your PATH variable, e.g. for bash

    export PATH="/path/to/the/directory/containing/elasticity:${PATH}"
    

2D vs 3D simulations

By default, the adapter is built as a 2D example in release mode. If you want to run a 3D example (quasi 2D, meaning that the out-of-plane direction is clamped but we use real cells for the calculation), you can define this when configuring:

cmake -DDIM=3 .

Note that you need to run make distclean if you switch from one to another dimension in order to overwrite the dimension value.

Debug vs Release mode

You can switch between debug and release mode using make debug or make release. By default, programs are built in release mode.

Next steps

To run the deal.II codes, copy the parameter file (parameters.prm) into your target directory, e.g. solid-dealii/. Afterwards, run the executable as

./elasticity path/to/parameters.prm

Example cases can be found in our FSI tutorial cases.