Skip to content

Tutorial: simulation of biofilm deformation and detachment

Bowen Li edited this page Oct 31, 2022 · 16 revisions

In this tutorial, we demonstrate how to simulate and visualise a biofilm system in a fluid environment. The simulation requires three solvers:

  1. NUFEB - for the simulation of biofilm formation and particle motion.
  2. OpenFoam - for the fluid flow simulation.
  3. SediFoam - for the coupling between NUFEB and OpenFaom.

1. Installation

Downloading NUFEB

Make sure you have cmake, git, gcc/g++, openmpi and Paraview installed on your system. For example, on Ubuntu:

sudo apt-get install cmake git-core g++ openmpi-bin openmpi-common libopenmpi-dev

on Centos:

sudo yum install cmake git gcc-c++ openmpi openmpi-devel

We recommend you download the Paraview from its website: https://www.paraview.org/download. The executable paraview is located in /ParaView-xxx/bin/ directory.

Get NUFEB source code and submodules for its third-party libraries:

git clone https://github.com/nufeb/NUFEB --recursive

Building SediFoam

The current version of SediFoam is supported by OpenFoam 2.3.0, 2.3.x, 2.4.0. You may refer the website https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.4.0 for installing OpenFoam 2.4.0 on any Linux distributions.

Once OpenFoam is installed, we can build SediFoam using the installation file provided in /NUFEB/thirdparty/ directory:

cd NUFEB
cd thirdparty
./install-sedifoam.sh

Type the following command to check whether the build is successful:

ls $FOAM_USER_APPBIN/

an executable file named lammpsFoam should be in the directory:

2. Running simulation

We consider the case c1-deform-fixwall-0.6u provided in /NUFEB/examples/PAPER-NUFEB-TOOL directory as an example, which models biofilm deformation and detachment in a fluid environment. The model applies fluid flow (Uf = 0.6m/s) to a pre-grown biofilm that consists of heterotrophs and their EPS production. The pre-grown biofilm is generated from the case c1-deform-growth in the same directory and read as a restart file.

To run the simulation, go to the case directory and execute AllrunParallel.sh script file:

cd examples/PAPER-NUFEB-TOOL/c1-deform-fixwall-0.6u
./AllrunParallel.sh

The simulation will run with 4 processes and take about 10 mins to finish due to the complexity of the model. Once it finishes, type the following commands to reconstruct a decomposed case and convert the result into VTK format:

reconstructPar
foamToVTK

The VTK files will be saved in /VTK directory.

3. Visualising result

Now, we use Paraview to visualise the simulation result.

Open the VTK files in Paraview (File → Open...) by selecting two VTK filegroups:

  1. the grid data c1-deform-fixwall-0.6_..vtk in /VTK directory.
  2. the particle data defaultCloud_..vtk in VTK/lagrangian/defaultCloud directory.

Then click button:

Visualising field

To visualise the field data:

  1. Select c1-deform-fixwall-0.6_* item in the Pipeline Browser.

  2. In the Properties panel: set the field you'd like to view in Coloring section (for example, velocity field Ub), and adjust Opacity (in some Paraview versions, you may also need to select Enable OSPRay to make opacity feature work).

  3. Click button.

You can use buttons to play with the simulation:

Visualising particles

Next, we show how to visualise particle information:

  1. Select defaultCloud_* item in the Pipeline Browser.

  2. Select Filters → Alphabetical → Glyph or click on button. This will create a new item named Glyph1 in the Pipeline Browser.

  3. Select Glyph1 item in the Pipeline Browser. Then, in the Properties panel: set Glyph Type to "Sphere", set Scale Array to "d" (diameter), set the value in Scale Factor to 1, set Glyph model to "All Points".

  4. Click button and particles will be shown as spheres in their own sizes.

  5. You can also set coloring scheme in Coloring section. For example, rendering particle based on their type, in this case, blue is for heterotrophs and red is for EPS: