Skip to content

Building

Gerasimos Chourdakis edited this page Jul 14, 2020 · 23 revisions

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

The adapter currently requires deal.II version 9.2 or later. We also have a separate branch for 9.1, in case you need more time to upgrade.

You can find also more download options on the deal.II website.

Binary packages

deal.II is available in several Linux distribution. For example, if you are using Ubuntu, you can get the libdeal.ii-dev package (latest available in Ubuntu 20.04: v9.1.1):

sudo apt install libdeal.ii-dev

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" \
    ../dealii

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.

Click for more options...

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

Get preCICE from binary packages, or build it from source.

Build the adapter

If you have deal.II and preCICE globally installed in your system, and want a 2D simulation in Debug mode, building the adapter is as simple as cmake . && make:

  1. Clone the repository:

    git clone --branch=master https://github.com/precice/dealii-adapter.git
  2. Each solver in this repository can be built independently. Therefore, get into the directory of a solver and configure it with cmake:

    • If you have deal.II installed globally in your system:
    cmake .
    
    • If you have deal.II installed in a local directory:
    cmake -DDEAL_II_DIR=/path/to/deal.II .
    

    where DEAL_II_DIR points to your installation (not source) directory. This should be the same as the CMAKE_INSTALL_PREFIX you used when installing deal.II. If you have set the variable DEAL_II_DIR globally, you could skip it in the command above.

  3. Run make to build the adapter.

2D vs 3D simulations

By default, the adapter is built as a 2D example in debug 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

If you want to build a release version, use make release.

Next steps

To run the deal.II examples, copy the executable and parameter file (solver.prm) in your target directory, e.g. Solid/. Afterwards, run the executable, e.g. by:

./nonlinear_elasticity path/to/nonlinear_elasticity.prm

Example cases can be found in the tutorial cases for deal.II coupled with OpenFOAM.

Clone this wiki locally