Manual for medFlow2D



medFlow2D is a CFD software capable of solving various two-dimensional flows. It was primarily designed for educational and scientific use, thus easy setup of the flow problems is an expected behaviour.
The solver is built on the lattice Boltzmann method (see Theory Guide for deatils).


Quickstart for Windows

Tested under Windows 7/8.1.


Requirements, solver: the solver has no external dependency.
Requirements, GUI: needs a working python installation with numpy, matplotlib, ImageTk (e.g., Pillow)

Recommended installation:

Quickstart for Linux

Tested on Ubuntu 14.10.

Build under Linux

Extract medFlow2D sources, then:

cd medFlow2D
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release

Start solver control


Set up a new simulation

Use ini definition files to set up the simulation (see the bundled samples).
The geometry is described by a ppm “paintable” bitmap file (for the colour coding see sections below).

Color coding for the geometry

R=0 G=0 B=0 -> Fluid
R=0 G=255 B=255 -> Protected fluid (no coagulation or other special process allowed here)
R=255 G=255 B=255 -> Wall
R=255 G=0 B=0 -> Inlet (velocity boundary, one one of these are allowed)
R=0 G=255 B=0 -> Outlet (pressure boundary)
R=0 G=0 B=255 -> Porous material

Tips for editing the geometry

Available boundary conditions

Install required softwares

The solver itself has no external dependency.
Since it is a command line interface application, you can use it through the command line.

The software package provides further basic tools for visualization, simulation management and monitoring.
However, these tools require the presence of a python interpreter, and a few python packages (tk, pillow).
The recommended python interpreter can be downloaded from:
Python -
During the install select “Add to system PATH”.
You can check if the setup has been completed correctly by asking for the version of the compiler by executing the following in a command line:

python —version

After Anaconda setup is completed, open a new terminal to install the only missing package, Pillow.
To do this, enter the following command to the command line:

pip install Pillow
(You might need a new version of Pillow -> pip install Pillow —upgrade)

Run and control a simulation using the Solver manager

If all required softwares are present on the system you can simply execute ‘startGUI.bat’ (Windows) or ‘’ (Linux/Mac) to start the solver manager application.

Alternatively you can run and control the simulation from command line

This can be useful if you execute the simulation and the monitoring tools on different machines.

  1. Extract the program somewhere.
  2. Pick a simulation in folder ‘data’.
  3. Edit the .ini file for that simulation (e.g., ‘setup_stent.ini’).
  4. Make sure the two output paths are correct and exist in your system:
    ‘base_name’ under [output] will be the directory for the simulation output,
    and ‘currentInfo’ under [monitoring] will hold the monitor files.
  5. In a command line navigate to the ‘bin’ directory.
  6. Run the simulation by executing:
    a. Windows: medFlow2D.exe
    b. Linux/Mac: ./medFlow2D
    where contains the description for the simulation.
  7. Start the monitoring software:
    a. Open a new command line.
    b. Navigate to the ‘tools’ directory.
    c. Execute: python .
  8. You can stop the simulation by pressing CTRL+c in the command line where the simulation runs.

Compilation on Windows

The solver is written in ANSI C. It can be compiled with any standard compatible compiler. The recommended compiler can be downloaded from:
The 64bit version is most likely to be the one you want to download.
During the install select “Add to system PATH”.
You can check if the setup has been completed correctly by asking for the version of the compiler by executing the following in a command line:
gcc —version
The compilation directives are stored in a CMake file. Thus, you can compile the source using CMake. ( CMake - ). Or you can use an IDE that has CMake embedded in. I recommend CLion:
C++ IDE -

Windows FAQ

Q: How to access the command line in windows?
A1: Start menu -> Run (or Win+r keys) then execute ‘cmd’
A2: If you use Total Commander navigate to the desired directory, and execute ‘cmd’ there.

Compilation on Linux

Compilation requires a recent version of the GNU compiler suite.

In the root directory of medFlow2D:

cd bin
cmake ../

Additional general info

Advanced informations

For deatils consult the TheoryGuide.


Known issues

Development TODO