Packaged with the library are a number of example applications that demonstrate the construction of models using the methods available through IBAMR.
Contents
- Where are the examples?
- Which of the files contains the source code?
- How to run the examples in the library
- Translating examples into your own application
Locations of the examples
Examples can be found in the following locations:
IBAMR_SRC_DIR
|
├── examples
│ ├── adv_diff
│ ├── advect
│ ├── CIB
│ ├── ConstraintIB
│ ├── complex_fluids
│ ├── IB
│ │ ├── explicit
│ │ └── implicit
│ ├── IBFE
│ │ └── explicit
│ ├── 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
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
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.