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.
You can find all available download options on the deal.II website.
sudo apt install libdeal.ii-dev libdeal.ii-doc cmake make g++
step-1tutorial of deal.II:
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" \ ../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.
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.
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:
Clone the repository:
git clone https://github.com/precice/dealii-adapter.git
- The solvers are compiled into a single executable. Therefore, get into the top-level directory and configure it with
- If you have deal.II and preCICE installed globally in your system:
- 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 .
*_DIRpoints to your installation (not source) directory. This should be the same as the
CMAKE_INSTALL_PREFIXyou used when installing the respective libraay. If you have set either of these variables globally, you could skip it in the command above.
maketo build the adapter. This will generate the
Ensure that the executable is run-time discoverable by adding it to your
PATHvariable, e.g. for bash
run.sh) in order to start individual cases. The deal.II adapter scripts accept an option
-e=<executable_to_run>to locate the executable, in case it is not globally discoverable.
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.
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
Example cases can be found in our FSI tutorial cases.