-
Notifications
You must be signed in to change notification settings - Fork 16
Tutorial: simulation of 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 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
on Centos:
sudo yum update sudo yum install cmake git gcc-c++ openmpi openmpi-devel
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 --recursive
Build VTK library for visualising simulation result:
cd NUFEB cd 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 lmp_mpi in /NUFEB/lammps/src/ directory.
Let's use the case biofilm-het provided in /NUFEB/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.
Note: the simulation takes about 5-10 mins to finish depending on your computer configuration. We also provide a simplified version /NUFEB/examples/simple-growth with smaller domain and mesh size which takes less than 1 min to finish. The execution process for the two cases are identical.
To run the simulation, go to the case directory and run the executable by passing in the input file:
cd examples/biofilm-het mpirun -np 4 lmp_mpi -in Inputscript-vtk.lammps
or
cd examples/biofilm-simple mpirun -np 4 lmp_mpi -in Inputscript-vtk.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:

In the meantime, microbe and grid information are frequently saved as VTK format (e.g, vtk, .vti, .vtr) in the case 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:
