Introduction

A bacterial biofilm is a bacterial community attached into a surface through extracellular polymeric materials1. Prior to biofilm formation, bacteria may need to deposit on the surface from their planktonic state. After bacteria deposit on surfaces they may “twitch” or crawl over the surface using appendages called type IV pili (TFP)2,3,4,5 to “explore” the substratum to find suitable sites for growth and thus biofilm formation. Pili emanate from bacterial surface and they can be up to several µm long (though they are nm in diameter6). Bacterial twitching occurs through cycles of polymerization and de-polymerization of type IV pili7,8. Polymerization causes the pilus to elongate and eventually attaching into surfaces. De-polymerization makes the pilus to retract and detaching from the surfaces. Pili retraction produces pulling forces on the bacterium, which will be pulled in the direction of the vector sum of the pili forces, resulting in a jerky movement (Fig. 1). A typical TFP can produce a force exceeding 100 pN9 and then a bundle of pili can produce pulling forces up to several nN10. Bacteria may use pili not only for twitching but also for cell-cell interactions11,12, surface sensing13,14 and DNA uptake15.

Figure 1
figure 1

Bacterial twitching model: (a) Schematic of bacterial twitching; (b) CFD-DEM model. The rod-shaped bacteria are modelled as a group of spherical particles rigidly assembled together. The pili are emanated from the bacterial pole coloured in red. Each pilus is modelled as a dynamic spring which can elongate, attach, retract and detach from the surface.

Twitching motility could depend on many factors including surface properties, pili arrangement on bacterial surface, and environmental conditions such as oxygen concentration and fluid flow rate16. For example, when pili emanate only at the poles of bacteria (e.g., Pseudomonas aeruginosa), the bacteria will have persistent motion17,18. But, if pili are all around the cell body (e.g., Neisseria gonorrhoeae), the bacteria will have trapped or diffusive motion due to the tug of war mechanism19,20. If a pilus detaches while all the pili are in high tension and anti-parallel configuration, the bacterium will suddenly align along the resultant direction of the remaining bounded-pili causing a sudden change of the twitching direction. This is the so called slingshot motion and bacteria may use this mechanism to change crawling direction3,4. Bacterial twitching will depend on some physicochemical and structural properties of the surface. For instance, the pili attachment is enhanced2,18,21 when the substratum is covered by extracellular polymeric materials. Patterned surfaces can be a barrier for bacterial twitching and hence hinder surface exploration by bacteria7,22. Chang, et al.22 have shown that micro-scale surface topography (pillars) appears to be a barrier to the surface motility of Pseudomonas aeruginosa and it may hinder the ability of such cells to explore a surface. However, when the surface has micro-scale grooves, bacteria may display persistent twitching along grooves because cells can be guided by the groove walls2,23. Bacteria can also differently deploy pili17 and change pili retraction speed24 to adapt to nutrient availability. In fluid flow environments, rod-shaped bacteria tend to twitch against the flow because the fluid flow tends to align the bacteria along the flow direction while they are anchored to the tethering points, and then the fluid drag causes bacteria to flip around the anchoring point and twitch upstream (see Fig. 1)25,26,27.

The experimental visualization of pili is difficult requiring great skill and specialised equipment28. Therefore, mathematical modelling of TFP mediated bacterial twitching is vital to understand the twitching mechanism under different environmental conditions. Researchers have already modelled twitching motility of bacteria using a variety of mathematical models. For instance, Marathe, et al.20 modelled Neisseria gonorrhoeae as point particles and used stochastic pili dynamics to simulate a tug of war mechanism with directional memory of twitching action. This work reported that directional memory enhances the surface exploration of bacteria. Molecular dynamics (MD) or discrete element based methods (DEM) have been widely used to understand bacterial twitching. Brill-Karniely, et al.4 used a kinetic Monte Carlo algorithm together with MD to model TFP mediated twitching of Pseudomonas aeruginosa. This work reported that a minimal amount of angular rigidity of pili is needed to produce some experimentally observed behaviours of twitching bacteria. Furthermore, this work revealed that two TFP can produce the recently observed slingshot motion3 when one pilus releases at a high-tension anti-parallel configuration of two pili. More MD based twitching models include de Haan6, Zaburdaev, et al.19, Ryota Morikawa29. However, these very interesting models have not considered interactions of a twitching bacterium and its hydrodynamic environment. This represents an important gap in our knowledge because the hydrodynamic environments can completely change twitching direction (e.g., upstream twitching) as well as influencing deposition and detachment30. In the present work, three-dimensional Computational Fluid Dynamics coupled with Discrete Element Method (CFD-DEM) is used to model rod-shaped bacterial twitching on flat and groove surfaces under various shear flow conditions. Various forms of CFD-DEM models have been employed to study bacterial deposition before31,32,33. The novelty of our model is the use of a three-way coupled (two-way coupled fluid-cell interactions plus cell-cell interactions) CFD-DEM model together with pili dynamics to study bacterial twitching on flat and groove surfaces with fluid flowing over the surfaces. The model is implemented on an open source CFD-DEM package called SediFoam34. The method is used to predict some experimentally observed behaviours of bacteria twitching in shear flows such as upstream twitching26. The model is generic in nature, but the parameters are chosen such that they are relevant to the Pseudomonas aeruginosa.

Results and Discussion

When immotile rod-shaped bacteria move in shear flows they will freely orbit in shear flows30 which is called “Jeffery orbiting”. We first compare the orbiting of a rod-shaped bacterium with theoretical results to validate the CFD-DEM model. Then, the model is used to study bacteria twitching on a rough surface in the presence of a static fluid medium. Finally, the model is employed to investigate bacteria twitching in a flowing environment on a rough-flat and rough-groove surface.

The computational domain for the following simulations is a rectangular box having the dimensions of length × width × height = [0, 50] × [0, 20] × [0, 20] µm3. Bacteria twitch on the bottom x-y surface (see Fig. 1a). Periodic velocity boundary conditions in two horizontal directions (x and y direction) and no-slip and fixed-velocity boundary conditions are applied respectively at the bottom and top walls (z direction). Pressure is periodic in the horizontal directions and zero gradient boundary conditions are applied at the top and bottom walls. The parameters used for the following simulations are listed in Table S1. A single bacterium is simulated unless specified otherwise and the bacterium is initially oriented in the flow direction.

Model validation for Jeffery Orbiting

SediFoam has been extensively validated for spherical particle laden flows34,35,36. We use SediFoam for rod-shaped objects in this work and hence we validate the model for Jeffery orbit before using for bacterial twitching. The analytical expression for orbiting angular velocity (\(\dot{\theta }\)) and period (T) of a rod-shaped bacterium having an aspect ratio of a in a shear rate of \(\dot{\gamma }\) are given by Jeffery37 as

$$\dot{\theta }=\frac{\dot{\gamma }}{(1+{a}^{2})}({a}^{2}co{s}^{2}\theta +si{n}^{2}\theta )$$
(1)
$$T=\frac{2\pi }{\dot{\gamma }}(a+\frac{1}{a})$$
(2)

The CFD-DEM model is validated for the Jeffery orbit at different shear rates and aspect ratio of the cell body. The analytical solution for the orbiting angular velocity and the period of the orbit are compared with the present numerical results. Figure 2(a) shows the numerical and analytical results at a = 3 and \(\dot{\gamma }\) = 1000 s−1 and it can be seen that the present CFD-DEM model can predict the orbit transit of a rod-shaped bacterium in shear flows accurately. Figure 2(b) compares the periods at different aspect ratios and shear rates and it is evident that the model is capable of predicting the theoretical results. The relative error of the maximum and minimum angular velocities are presented in Fig. 2(c) and it can be seen that the relative error is less than 15% for all the cases we have considered here. A relative error as large as 15% would be because the analytical solution is valid only for inertialess rods, the present CFD-DEM model computes only average hydrodynamics around the bacterium, and the shape of the bacterium is not precisely a rod. Therefore, a relative error of 15% would be still acceptable for reasonable predictions of rod-shaped bacteria interaction with fluid flows.

Figure 2
figure 2

Model validation with Jeffery orbit of a rod-shaped bacteria: (a) Transient of the angular velocity at a = 3 and \(\dot{\gamma }=1000\,{{\rm{s}}}^{-1}\); (b) period of the orbit; (c) relative error between analytical and CFD-DEM results for the maximum and minimum of the angular velocity at each case.

Bacterial twitching in static fluid

Bacterial motility would be affected by the number of pili and how those pili distribute at the bacteria poles2,17. Therefore, the present model is employed to understand how the number of pili and the distribution angle (α) influence twitching characteristics. Bacterial twitching is usually characterised by the Mean Square Displacement (MSD) which can explain the twitching behaviour (diffusive, trapped, and persistent) based on the MSD power (MSD = Ktn, where n is the MSD power, K is a constant, and t is time)4,20. Figure 3 shows the MSD power for different pili distribution angles and pili numbers. As the pili angle increases the MSD power decreases because the cell is more likely to trap between pili which are in force equilibrium. The numbers shown in bars are the R2 value of the regression to compute MSD power and it can be seen that it decreases as the pili distribution angle increases, because the cell has more irregular motion in that case. When the number of pili increases at the same pili angle the MSD power does not change much. The trajectory of the leading and trailing poles are shown in Fig. 3(b) when the pili number is 2 and the pili distribution angle is 30°. The trailing pole moves above the leading pole because of the inclination of the bacterium to the surface, as observed experimentally by others17.

Figure 3
figure 3

Nature of bacterial twitching with different pili distributions: (a) MSD power for different pili angles and pili numbers (MSD = Ktn, where n is the MSD power, K is a constant, and t is the time); (b) When the bacterium is pulled by the pili for an extended period of time, the bacterium gradually gets inclined to the surface and if the period is long enough the bacterium would reach to a vertical orientation. The trajectory of the leading and trailing poles is shown for pili number is 2 and the pili angle is 30 deg.

Figure 4 shows the variation of twitching velocity (Vt) for different pili distribution angles and pili numbers. As expected, the quasi-stationary time (time spent at Vt < 0.01 µm/s) decreases and moving time (time spent at Vt > 0.01 µm/s) increases when the number of pili increases, since the bacterium is pulled by pili more frequently. The pili distribution angle has significant influence on the intermediate velocity (0.01 < Vt < 0.8 µm/s). The average twitching velocity is less than 0.8 µm/s for all the cases (Fig. 4b) which is a realistic prediction for the twitching velocity of Pseudomonas aeruginosa (i.e. 0.3 µm/s) found in Maier and Wong2, Jin, et al.3. The average twitching velocity is more sensitive to the number of pili than the pili distribution angle. These results indicate that the MSD of bacteria can be simply written as MSD = K(Np)tn(α) because the MSD power and the twitching velocity are more sensitive to the pili distribution angle and the numbers of pili, respectively. Here, n(α) is the MSD power and it explains the nature of the twitching motility, which is sub-diffusive (trapped) when n(α) < 1 and super-diffusive (persistent) when 1 < n(α) < 2, diffusive when n(α) = 1 and ballistic when n(α) = 2. If pili are randomly distributed all over the cell body or two poles of the body, it is more likely to observe a diffusive or sub-diffusive motion because of the tug of war mechanism. In the present study, it can be seen that the twitching motility is super-diffusive most of the time (Fig. 3a) and it never has a sub-diffusive motion. This is expected because all the pili are produced at one pole and their distribution angle is also taken from the Normal distribution which means that the pili elongation direction would be biased to the axial direction of the cell. Therefore, bacteria would get forward pulling forces at most of the time, which leads to a persistent motion. There is experimental evidence that Pseudomonas aeruginosa would twitch with a MSD power of 1.55 ± 0.34 when they twitch using unipolar TFP17, which supports our model predictions.

Figure 4
figure 4

Bacterial twitching velocity with different pili distributions: (a) Twitching velocity for different pili distribution angles and pili numbers. As expected, the stationary time (Vt < 0.01 µm/s) decreases and moving time (Vt > 0.8 µm/s) increases as the number of pili increases because the bacterium is pulled by pili more frequently then. Pili distribution angle has significant influence on the intermediate velocity (0.01 < Vt < 0.8 µm/s); (b-c) The average twitching velocity is more sensitive to the number of pili than the pili distribution angle.

Figure 5 shows the tilt angle for different pili distribution angles and pili numbers. With increasing number of pili the tilt angle distributes in a wide range, while the average tilt angle is still around 5 to 10 degrees. The twitching experimental data of Pseudomonas aeruginosa reported in Ni, et al.17,38 indicated that the average tilt angle would be around 15 degrees and our results are in a reasonable range considering the assumptions of the model. Our results show that as the pili distribution angle and numbers of pili increase there is a tendency for the bacterium to trap in a vertically-oriented configuration (Fig. 5c,d). This is rather similar to the vertically-oriented upright walking of Pseudomonas aeruginosa17,38,39. The model shows that when a cell is trapped between pili for an extended period of time, the cell has more time to rotate around its body and reach a vertical orientation. However, our model is not capable of capturing the upright walking motility of bacteria. In the present model, vertically oriented bacteria remain trapped and then gradually move to the horizontally-oriented configuration and crawl when the trapped-configuration of pili is changed once a new pilus attaches or breaks, and the force becomes unbalanced. It appears that a special pili dynamics mechanism will be needed to capture those vertically-oriented upright walking bacteria and that is out of the scope of this paper.

Figure 5
figure 5

Tilt angle for different pili distribution angles and pili numbers: (a) 0; (b) 30; (c) 60; (d) 90 degrees. Larger the number of pili the tilt angle distributes in a wide range while the average tilt angle is around 5–10 degrees. When the pili distribution angle and the number of pili larger we can see that the bacterium sometimes orients vertically.

Bacterial twitching in flowing fluid

We study bacterial twitching under a range of flow velocity (0–4 mm/s) which corresponds to a range of wall shear stress values (wall shear stress = \(\mu \frac{du}{dy},\frac{du}{dy}\) is the shear rate at the wall). Wall shear stress or the fluid shear rate at the wall will determine the drag forces acting on the bacterium and then it will influence on the twitching behaviour. We study a bacterium having two pili with 30° distribution angle and with increased pili elongation velocity (10 times) for the following reasons. When we add many pili a smaller time step is needed for scaling up (<<0.1 s) to maintain numerical stability which has a significant computational cost when flow fields are taken into account. Even if we use two pili for the model, it does not necessarily mean that the bacterium has only two pili. Because of increased elongation velocity these two pili can mimic several pili in a real system because a new pilus is created faster after the breakage of an existing pilus. Figure S1 shows the main events associated with bacterial twitching in a flow environment, which are upstream twitching, detachment, orbiting in shear flow and re-attachment.

Figure 6 shows the probability of direction of motion of the cell at different wall shear stresses. If the fluid is static (Fig. 6a), the cell can twitch in any direction on the surface because there is no preferential driving force, and therefore the probability of twitching direction being in each angular bin is about 1/12 = 0.08. Then, when the fluid flows, the cell tends to twitch upstream as seen in Fig. 6(b–d) indicating the increased probability of bins from 90° to 270° compared to the no-flow scenario. For the selected wall stresses, the maximum upstream twitching probability occurs at around 0.1 Pa and that probability decreases as the wall stress is either increased or decreased from that value, indicating that there would be an optimal flow condition for bacterial upstream twitching. Figure 7(a) supports this finding and shows a sinusoidal variation of twitching probability with wall shear stress. The probability of upstream twitching decreases and reaches a minimum and then increases to a maximum and then it decreases again. The reason for this behaviour is that the cell is initially headed in the flow direction and at low shear stresses the bacterial cell is not subjected to sufficient shear forces to rotate it in the upstream direction. Therefore, the cell will actively twitch and be passively advected in the flow direction. But, at moderate shear stress, the cell will be rotated and faced in the upstream direction and it will then twitch against the flow. As the fluid flow further increases, the fluid drag forces would tend to dominate over to the pili-based pulling forces and hence upstream twitching decreases again. Figure 7(b) shows the time average velocity in upstream and downstream directions. Upstream twitching velocity is fairly constant for a range of shear stress, in agreement with experimental findings in the literature26. It can be seen that the upstream twitching distance has a unimodal distribution (Fig. 7c) with wall shear stress. The fluid flow conditions, apart from the optimal wall shear stress (that is around 0.1 Pa), may adversely influence upstream twitching. Shen, et al.26 showed that upstream twitching of P. aeruginosa would be most efficient when the wall shear stress is around 0.5 Pa, and our model predictions are also in the same order. It can be seen in Fig. 7(d) that bacteria detach from the wall more frequently when the wall shear stress is more than the optimal stress. This is because the fluid drag is dominant to the pili-based pulling when the stress is far beyond the optimal value.

Figure 6
figure 6

Probability of the direction of motion of the cell as a function of wall shear stress: (a) If the fluid does not flow, the cell can twitch any direction on the surface (the probability of each angular bin is around 1/12 = 0.08; (bd) As the fluid flow (or wall shear stress) increases, the cell tends to move upstream, the probability of bins from 90 to 270 degrees increases.

Figure 7
figure 7

Effect of fluid flow on bacterial twitching behaviour: (a) As the fluid flow increases, the probability of upstream twitching (Red bars) decreases and reaches a minimum and then increases to a maximum and then it decreases again; (b) Time average velocity in upstream and downstream directions; (c) Upstream twitching distance; (d) Number of twitching events.

Bacterial twitching on a groove surface with fluid flow

It is important to study how imposed fluid flows would influence bacterial twitching on structured surfaces because twitching would be influenced by both structures and moving fluid in this case. Therefore, we study bacterial twitching on a groove surface (Figure S2) when fluid flows across the grooves. The cross section of each groove wall (protrusion) is in the order of bacterial size and it is chosen as 6 × 5 µm2 (wide × height). Bacterial upstream twitching is investigated at two different groove widths (19 and 46 µm, which are about two and four times of the bacterial length, cell body plus pili length) at a wall shear stress of 0.15 Pa. A similar geometry has been experimentally investigated for Escherichia coli deposition in Gu, et al.40. The pili dynamics is similar to the previous case of bacterial twitching on flat surface under shear flows (i.e., two pili with distribution angle of 30°). Four bacteria are randomly seeded on the surface. Figure S2 shows bacterial twitching on flat and groove surfaces. As expected, bacteria are trapped and twitch along the grooves for the non-flat surfaces.

Figure 8 shows the probability of twitching direction at different surface conditions. As also shown in Figs 67, it can be seen that bacteria simply twitch upstream on the flat surface (Fig. 8a). Figure 8(b,c) indicate that the groove width has a vital influence on twitching motility. Upstream twitching is inefficient for the narrow groove (Fig. 8c) and the direction of motility is chaotic in that case. The reason is that bacteria frequently collide on the groove wall because of fluid drag and upstream twitching resulting in the direction of motility change regularly. The groove walls also guide bacteria to twitch along the grooves. These constraints would give bacteria uniform chances to move in any direction on the groove when the groove width is relatively low. Figures S2 and 8(d) indicate that bacteria tend to accumulate downstream of the groove walls. This phenomenon would be theoretically meaningful because the fluid drag behind the walls would be weak and therefore bacteria would not be easily pulled along the flow. Therefore, bacteria that twitch upstream and reach the walls are likely to reside there for an extended period.

Figure 8
figure 8

Effect of surface topography on bacterial upstream twitching at wall shear stress of 0.15 Pa: (a) Flat surface; (b) Groove width is 44 µm; (c) Groove width is 19 µm. It is seen that the bacteria have a chaotic motion when the groove width is smaller; (d) Probability of bacterial residency time at difference places inside the groove; for groove width is either 44 or19 µm. The results indicate that bacteria are likely to accumulate near downstream sides of groove walls.

Conclusion

Bacterial motility shows interesting phenomena when active motility (swimming, twitching and so on) interferes with a surrounding fluid26,30,41. Upstream twitching is a mechanism used by rod-shaped bacteria such as Pseudomonas aeruginosa to colonize upstream sites of flow environments such as catheters. In this work, a CFD-DEM model is used to study bacterial twitching in fluid flows. The model can predict super diffusive motility in static fluid, upstream twitching in fluid flows, and flow-induced cell detachment/re-attachment to the surface. In agreement with experimental findings of Shen, et al.26, our model can predict that there would be an optimal range of wall shear stress in which bacterial upstream twitching is most efficient. When bacteria twitch on a groove surface, the resultant effect of fluid flow and surface topography would decide the nature of twitching and spatial segregation of bacteria on the surface. While our model can predict general characteristics of bacterial twitching, the model should be carefully validated against experimental data before it can be used to gain more detailed insights about bacterial twitching in fluid flows.

Our results give some insight into how Type IV pili distribution on the bacterial pole, in other words, number of pili and pili distribution angle, could be used to select the nature of bacterial twitching motility depending on the environmental conditions. It can be anticipated that pili could be widely distributed on the pole to figure out the direction of motility where more nutrients are available. After the direction is chosen as many as pili could be used to move fast along that preferential direction. Moreover, our results of bacterial twitching on grooved surface indicate that bacteria could be accumulated at some favoured sites and this could be used for cell sorting. Even though our model has been basically used to study upstream twitching, it can give some insights for variety of other twitching phenomena. The modelling framework developed here can be further used or extended and will enable us to predict bacteria twitching under variety of conditions. For example, the present model can be used to investigate bacterial twitching on compliant surfaces and other surfaces with complex micro or nano scale structures. The model can be a robust tool to study twitching motility of different shapes of bacteria (e.g., Neisseria gonorrhoeae and Synechocystis sp PCC 6803)2 and TFP-based colonization of curved shape bacterium Caulobacter crescentus in fluid flows42. Moreover, our model could be easily extended for investigating how the oscillatory localization of TFP (dependent on nutrient conditions) of Pseudomonas aeruginosa and Myxococcus xanthus would interfere with fluid flows17.

Methodology

We have implemented twitching dynamics of bacteria into the existing CFD-DEM platform called SediFOAM34, which couples the molecular dynamic code LAMMPS43 and the well-established CFD package, OpenFOAM44. The present work is an extension for the authors’ Individual-based model of microbial communities implemented on LAMMPS45. SediFOAM has been primarily used to simulate particle sedimentation in fluid. In the present work, we extend SediFOAM to model rod-shaped bacteria twitching in fluid flows. The model components are explained below.

Discrete element modelling (DEM) of bacteria and surface

We model bacteria and solid substratum (flat and groove surfaces) by using spherical particles. Rod-shaped d bacteria are modelled as a rigid assemble of several spherical particles (See Fig. 1). The total force on the rigid body is computed as the sum of the forces on its constituent particles. This idea has been employed before for modelling rod-shaped bacteria33. The translational and rotational movement of the rigid body is calculated based on Newton’s second law as

$${m}_{b}\frac{d{\overrightarrow{u}}_{b}}{dt}={\overrightarrow{f}}_{c,b}+{\overrightarrow{f}}_{fp,b}+{\overrightarrow{f}}_{p,b}+{m}_{b}\overrightarrow{g},$$
(3)
$${I}_{b}\frac{d\overrightarrow{{\theta }_{b}}}{dt}={\overrightarrow{T}}_{c,b}+{\overrightarrow{T}}_{fp,b}+{\overrightarrow{T}}_{p,b}.$$
(4)

Here mb and Ib are the mass and moment of inertia of the bacterium (rigid body), respectively. Equation (3) describes the translational velocity \({\overrightarrow{u}}_{b}\) of the bacterium, and the four terms on the right hand side represent respectively the contact, fluid interaction, TFP pili, and gravitational forces acting on the cell. The rotational movement of the cell body \({\overrightarrow{\theta }}_{b}\) is calculated based on the torque produced by contact forces (\({\overrightarrow{T}}_{c}\)), fluid interaction forces (\({\overrightarrow{T}}_{fp}\)) and pili forces (\({\overrightarrow{T}}_{p}\)). The contact forces are calculated based on Hook’s law depending on the overlap distance between interacting particles. Fluid interaction and pili forces are further explained below.

Computational fluid dynamics (CFD)

The fluid is assumed Newtonian and its flow is described by the locally-average Navier-Stokes equation as

$$\nabla .({\varepsilon }_{s}\overrightarrow{{U}_{s}}+{\varepsilon }_{f}\overrightarrow{{U}_{f}})=0,$$
(5)
$$\frac{\partial ({\varepsilon }_{f}\overrightarrow{{U}_{f}}}{\partial t}+\nabla .({\varepsilon }_{f}\overrightarrow{{U}_{f}}\overrightarrow{{U}_{f}})=\frac{1}{{\rho }_{f}}(-\nabla p+{\varepsilon }_{f}{\rm{\mu }}{\nabla }^{2}\overrightarrow{U}+{\varepsilon }_{f}{\rho }_{f}\overrightarrow{g})+\overrightarrow{{F}_{fp}},$$
(6)

where εs is the solid volume fraction and εf = 1 − εs is the fluid volume fraction. The fluid density ρf and its viscosity μ are assumed as constants. Here \(\overrightarrow{{U}_{s}}\) and \(\overrightarrow{{U}_{f}}\) are the velocity of the solid and fluid phases, respectively. The gravity \(\overrightarrow{g}\) is also included because fluid and bacterial density would be different and hence buoyancy forces would be important. The last term \(\overrightarrow{{F}_{fp}}\) represents fluid-solid interaction forces, which are drag, lift, added mass, and lubrication forces as detailed in the SediFOAM documentation34 and not repeated here. The Eulerian fields εs, \(\overrightarrow{{U}_{s}}\) and \(\overrightarrow{{F}_{fp}}\) are calculated by averaging the information of Lagrangian particles.

Twitching model

The TFP are modelled as dynamic springs emanating from one pole of the bacterium and these springs can elongate, retract, attach and detach from the surface (Fig. 1). Each pilus operates independently from the others. When a new pilus is born at the bacterial pole, its angular direction from the bacterial axis is randomly decided according to a Normal distribution with standard angular deviation of α, N(0, α2). After the pilus elongates at constant velocity ve to a maximum length Lmax, it will attach to the surface with probability pa and then it immediately starts to retract at a variable retraction velocity. A bound retracting pilus can detach (or break) with probability pb. Each un-attached or broken pilus retracts at velocity vr to the pole until it disappears and then a new pilus is born at the same pole at a random direction chosen from the Normal distribution. The total numbers of pili remain constant at any given time.

The pulling force of each pilus is modelled by assuming a linear spring with variable equilibrium length as

$${f}_{p}(t)={k}_{p}(L(t)-{L}_{eq}(t)),$$
(7)

where L(t) and Leq(t) are the total length and equilibrium lengths of the pilus, respectively. The total length is simply the distance between the bacterial pole and the pilus tip. If the pilus is unbounded the equilibrium length is equal to the total length, which means the pulling force is zero. Once the pilus attaches to a surface the equilibrium length decreases representing pili retraction. As the retraction velocity of bounded pili depends on the pulling force7, the equilibrium length is decreased as

$${L}_{eq}(t)={L}_{max}(1-{v}_{r}({f}_{p}(t)/{f}_{stall})t),$$
(8)

where fstall is the maximum pulling force which can be produced by each pilus. A bounded pilus will break in a time interval Δt with probability \({p}_{b}=\Delta t\frac{1}{\tau }{e}^{{f}_{p}(t)/{f}_{stall}}\)11 where τ is the characteristic time of pili detachment.

Scaling-up

The time scale for twitching is much larger than 1 s2,8 and the time scale for fluid flow is much smaller than 1 s. Therefore, twitching dynamics and fluid flow occur at two different time scales and hence it is needed to separate these time scales for the model. The CFD-DEM is run until quasi-steady state and the steady state flow field is calculated for a given bacterial position and orientation (Eqs 36). Then, the bacterial twitching dynamics is calculated with a larger time step (Eqs 7 and 8) and the position and orientation of the bacterium are updated using the velocities calculated from the CFD-DEM. Pili detachment and attachment events are also updated during this step. Next, the flow field is updated according to the new cell position and orientation through CFD-DEM calculations and so on. Therefore, three different time steps are involved in this model: the smallest time step of 10−9 s for DEM (Eqs 3 and 4), an intermediate time step of 10−5 s for CFD, and the largest time step of 0.1 s for pili dynamics (elongation, retraction, attachment, detachment) and scaling-up.

Implementation in SediFoam

We have implemented our rod-shape bacterial model in SediFoam, in particular, in its LAMMPS module. Rod-shaped bacteria are created by assembling spherical particles rigidly by using the constraint fix rigid command provided by LAMMPS. Pili emanate from one pole of the bacterium. The fix spring command of LAMMPS is modified to model dynamic springs for TFP. Rough and irregular substratum is created using spherical stationary particles using the fix move command of LAMMPS (see the LAMMPS documentation at http://lammps.sandia.gov). Then, DEM is resolved by using the Verlet algorithm in LAMMPS; the PISO algorithm is used for solving CFD in OpenFOAM; and SediFOAM acts as an interface to transfer and map the properties of the Eulerian mesh and Lagrangian particles between the two modules.