Skip to main content

Prerequisites

AMR Multiphase is built on top of IBAMR, a framework for developing fluid-structure interaction codes on block-structured AMR grids. You must install IBAMR and all of its required dependencies before compiling this library.
IBAMR must be compiled with CMake. AMR Multiphase is not compatible with IBAMR builds that use autoconf.
The table below lists the three dependencies you need before building.
Unless you intend to actively develop IBAMR itself, build an optimized release of IBAMR and its dependencies. Using -O3 -march=native at the IBAMR build stage significantly reduces simulation runtimes.

Compiling the library

1

Create a build directory

From the root of the repository, create a build directory. This keeps all object files, CMake cache files, and compiled executables separate from the source tree.
2

Configure with CMake

Enter the build directory and run cmake, pointing it at your IBAMR installation. For best performance, pass the optimization flags -O3 -march=native.
Replace /path/to/ibamr/install/dir with the actual prefix you used when installing IBAMR (the directory that contains lib/cmake/IBAMR/).
The -march=native flag generates code optimized for the CPU on your build machine. Do not use it if you intend to copy the binaries to a different machine with a different CPU architecture.
3

Build a target

Run make with the name of the target you want to compile. For example, to build the four-roll-mill example:
CMake first builds the MultiphaseLib static library (if not already built), then links the requested executable against it.

Available build targets

The root CMakeLists.txt defines MultiphaseLib and includes four example subdirectories, each with its own targets. To build all targets at once, run make without arguments from the build directory.

Library source files

MultiphaseLib is compiled from the following source files under src/:
Public headers are installed from the include/ directory and are available to downstream targets via the MultiphaseLib CMake target.

Optimized builds

For production simulations, use the following CMake invocation:
This enables the compiler to apply loop vectorization, inlining, and hardware-specific SIMD instructions. Observed speedups over a debug build are typically 3–10× for compute-intensive simulation runs.