-
Notifications
You must be signed in to change notification settings - Fork 10
Simulate biofilm growth
In this tutorial, we provide step-by-step instructions on how to use NUFEB for simulating a biofilm formation case and then visualising the result with Paraview.
Make sure you have cmake, git, gcc/g++, openmpi, png-dev, ffmpeg and Paraview installed on your system. For example, on Ubuntu:
sudo apt update sudo apt-get install cmake git-core g++ openmpi-bin openmpi-common libopenmpi-dev libpng-dev ffmpeg
on Centos:
sudo yum update sudo yum install cmake git gcc-c++ openmpi openmpi-devel libpng-dev ffmpeg
Some Ubuntu systems also requires OpenGL to be installed manually:
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
For Paraview, we recommend you to download it 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-dev
Build VTK library for visualising simulation result:
cd NUFEB-dev/thirdparty/ ./install-vtk.sh
This installation will take a while (20-60 mins depending on your system) to complete.
Now, we can return to the main directory and build NUFEB software with the VTK support:
cd .. ./install.sh --enable-vtk
This step will generate an executable file named nufeb_mpi in /NUFEB-dev directory.
Let's use the case biofilm-heterotroph provided in /NUFEB-dev/examples/ directory as an example. The model describes a biofilm formation scenario, where the biofilm is grown from 40 initial heterotrophs for 9 days. Extracellular Polymeric Substances (EPS) are also excreted from the heterotrophs during the growth. The simulation takes about 5-10 mins to finish depending on your computer configuration.
To run the simulation, go to the case directory and run the executable by passing in the input file:
cd examples/biofilm-heterotroph mpirun -np 4 ../../nufeb_mpi -in inputscript.lammps
here we are using 4 processors to run the simulation (-np 4), meaning that the computational domain is divided into four sub-domains. Each sub-domain is distributed on a different processor to run a partial (1/4) simulation.
During the simulation, NUFEB will print pre-defined information on the screen such as time step, CPU time, number of microbes:

Microbe and grid information are also saved as VTK format (e.g, vtk, .vti, .vtr) to the /vtk directory.
We use Paraview to read VTK output files and visualise the simulation result.
Open the VTK files in Paraview (File → Open...) by selecting each of the VTK filegroup:

Click button in the Properties panel to apply the files. Then, you should see the domain frame and initial particles in the RenderView window, and you can use
buttons to view the animation:
At this point, particles are represented as points in Paraview. To illustrate them in sphere:
-
Select atom_* item in the Pipeline Browser (note that there are two items named atom_*, one is for bounding box, and the other is for particles. Make sure you choose the one for particles).
-
Select Filters → Alphabetical → Glyph or click on
button. This will create a new item named Glyph1 in the Pipeline Browser.
-
Select Glyph1 item in the Pipeline Browser. Then, in the Properties panel: set Glyph Type to "Sphere", set Scale Array to "diameter", set the value in Scale Factor to 1, and set Glyph model to "All Points".
-
Click
button and particles will be shown as spheres in their own sizes.
-
You can also set coloring scheme in the Coloring section. For example, rendering particle based on their type, in this case, blue is for heterotrophs and red is for EPS:

Next, we show how to visualise grid information which, in this case, is nutrient concentration field:
-
Select all the grid_x_* items in the Pipeline Browser (x is processor ID).
-
Select Filters → Alphabetical → GroupDatasets or click on
button to group the items, then apply the change by clicking
button.
-
Select one of the GroupDatasets1 items in the Pipeline Browser. Then, in the Properties panel: set Representation to "Surface", select any nutrient field you'd like to view in the Coloring section, and adjust Opacity (in some Paraview versions, you may need to select Enable OSPRay to make opacity feature work).
-
Click
button and it will look like:
