Packaged with the library are a number of example applications that demonstrate the construction of models using the methods available through IBAMR.

Contents

Locations of the examples

Examples can be found in the following locations:

IBAMR_SRC_DIR
|
├── examples
│   ├── adv_diff
│   ├── advect
│   ├── CIB
│   ├── complex_fluids
│   ├── ConstraintIB
│   ├── DLM
│   ├── fe_mechanics
│   ├── IB
│   │   ├── explicit
│   │   └── implicit
│   ├── IBFE
│   │   └── explicit
│   ├── IBLevelSet
│   ├── IIM
│   ├── IMP
│   │   └── explicit
│   ├── level_set
│   ├── multiphase_flow
│   ├── navier_stokes
│   ├── vc_navier_stokes
│   └── wave_tank
├── ibtk
│   ├── examples
│   │   ├── CCLaplace
│   │   ├── CCPoisson
│   │   ├── PETScOps
│   │   │   └── ProlongationMat
│   │   ├── PhysBdryOps
│   │   ├── SCLaplace
│   │   ├── SCPoisson
│   │   └── VCLaplace

Example source code

The example source code can be found in the file named example.cpp in each of these examples.

How to run the examples in the library

when building IBAMR with autotools

To run the examples, navigate to the example you are interested in and run make examples. This will create executables named main2d and main3d (not all examples will generate both, some examples are only 2d or only 3d). You can then run the example by invoking ./main2d input2d or ./main3d input3d

when building IBAMR with CMake (i.e., via autoibamr)

The CMake based build system splits examples into different groups: e.g., to compile all IBFE examples, run make examples-IBFE in the build directory. Similarly, to build all examples, run make examples. As usual these commands work in parallel: i.e., you will probably want to run make -j8 examples-IBFE if your computer has eight cores.

Since target names in CMake are unique, just running make examples in a specific directory doesn’t work.

Translating examples into your own application

Say, for example, you would like to make a model much like the 2D one found in IBAMR_SRC_DIR/examples/IBFE/explicit/ex0.

You could do the following:

$ mkdir ~/my_ibamr_app
$ cd ~/sfw/ibamr/IBAMR/examples/IBFE/explicit/ex0/
$ ls
example.cpp  input2d  Makefile.am  Makefile.in
$ cp example.cpp input2d ~/my_ibamr_app/.
$ ls ~/my_ibamr_app/
example.cpp  input2d

Then, it is necessary to create a Makefile in your application’s directory (for this example, it is ~/my_ibamr_app) that links to the IBAMR libs properly, an example of which can be found here.

Now, with the aforementioned Makefile in place, you can run make main2d and the example will compile and can be run by invoking ./main2d input2d. From there, you can modify the application to meet your needs.

A similar process can be used for 3D versions of the examples using a makefile that links to the 3D libraries.