Keywords

1 Biofilm Shapes

Understanding how cellular systems evolve to adopt different shapes is an intriguing question which has motivated many theories. Here, we try to unravel this process in simple living beings: bacterial communities called biofilms. Environmental conditions seem to play a key role inducing changes. Biofilms growing in flows often form filaments constrained by the surrounding geometry. They may cross the current in corner flows [9] or wrap around tube walls forming helices [11]. Instead, biofilms spreading on semisolid agar surfaces exhibit different types of wrinkles [5, 20].

To understand the development of a biofilm one must take into account its nature. In a biofilm, bacteria are glued together and to a surface by a self-produced polymeric substance: the EPS matrix. Once the biofilm is formed, it can be seen as a biomaterial whose properties are controlled by the cellular activity [5, 20]. We discuss here how the material properties of a biofilm influence its shape in different environments.

2 Filamentary Structures in Flows

When spreading in flows, biofilms elongate along the current forming threads. The shape of the thread adapts to geometrical constraints, seeking to minimize adequate energies. Its time evolution until an equilibrium shape is reached can be described by discrete rod models. We tackle here two different experimental frameworks: biofilms in networks of cylindrical tubes and biofilms in corner flows.

2.1 Helical Biofilms

Consider the typical flow circuits used in medical systems, see Fig. 1. Injecting inside bacteria of the Pseudomonas genus, tubes fill with helical biofilms which wrap around the walls, see Fig. 2. Even if the Reynolds number is fairly small (\(Re \sim 1\)), the presence of connectors and junctions produces diameter variations, locally narrowing the passage. Vortices form past the stenoses. Vortical motion drives bacteria to the walls creating biofilm nucleation sites [11]. The biofilm then elongates following the streamlines until it undergoes a helical instability. Figure 3 shows the initial stages of the helical instability.

Fig. 1
figure 1

Flow circuit. The fluid mixture flows from an initial reservoir to a pump (or a drip mechanism) that drives the liquid through a network of tubes, which may merge or split

Elastic energies for filaments admit both straight and helical minimizers [7]. The presence of constraints that forbid the straight equilibrium prompt the appearance of helical structures [11]. A coiling effect is usually active at some end due to the presence of constrictions. When the biofilm hits a surface, deceleration results in coiling. Also, the presence of vortices at the stenosis may induce a helical beating of the thread. Additionally, biomass production causes a continuous length increase of the thread between constrictions. Helical shapes allow to allocate the excess length. Uninterrupted biomass production fosters the coarsening of the helical instability until it reaches the tube walls. More biomass is then allocated by narrowing the helix pitch. Notice that a filament of length \(L_f\) wraps around a tube of radius \(r_t\) and length \(L_t\) forming k steps of pitch \(L_t/k\) when \(L_f^2 \sim L_t^2 + 4 \pi ^2 r_t^2 k^2\).

Fig. 2
figure 2

Experimental image showing a biofilm helix wrapped around the tube wall past the junction. No biofilm is formed in the unperturbed branch. Bacteria were injected upstream the junction

Fig. 3
figure 3

Experimental image showing the onset of a helical instability along a biofilm thread in a 2 mm diameter tube

Fig. 4
figure 4

Snapshots illustrating the in silico development and coarsening of a helical instability

Figure 4 illustrates this dynamic process. A filament subject to twist develops a helical instability that coarsens until the helix reaches the tube wall thanks to a continuous length increase. These simulations are performed using the discrete rod model described in Sect. 2.2 [11].

2.2 Discrete Rod Framework

A filament is a geometric shape whose length is much larger than the rest of its dimensions. Any deformation of its cross section is expected to be small compared with variations of the total length. This fact motivates the description of a biofilm thread as a unidimensional curve \(\gamma \) (the centerline, which characterizes its position), plus a reference system at each point \(\{ \mathbf{t}, \mathbf{m}_1, \mathbf{m}_2 \}\) (the material frame, which measures the twist). With this description, the movement of the thread can be fully captured: stretching and bending are computed by deforming the centerline, whereas twisting is captured by the orientation of the material frame. For dynamic simulations we use a discrete rod model [3, 15]. The filament is discretized using a sequence of nodes \({\mathbf x}^i\), \(i=0,\ldots ,n+1\), along the curve \(\gamma \), and a reference system at each one, see Fig. 5. This frame is obtained at each location twisting the Bishop frame (a fixed untwisted frame) a certain angle \({\varvec{\theta }}^i\). The dynamics of the discrete filament is then governed by equations for the angles \({\varvec{\theta }}^i\), and for the node positions \({\mathbf x}^i\). We detail the procedure next.

Fig. 5
figure 5

a  Continuous description of a filament [15]. The Bishop frame \(\{{\mathbf t}, {\mathbf u}, {\mathbf v}\}\) defines the rest orientation at any point of the filament centerline \(\gamma (s)\), parametrized by the arc length in \(I\!\! R^3\). Rotating \(\{{\mathbf u}(s), {\mathbf v}(s)\}\) an angle \({\varvec{\theta }}(s)\) around \({\mathbf t}(s)\) we obtain the material frame characterizing the local orientation \(\{{\mathbf t}(s), {\mathbf m}_1(s), {\mathbf m}_2(s)\}\). b Discrete description of a filament [3]. The centerline is discretized as a set of points \(\{{\mathbf x}^0, {\mathbf x}^1,\ldots , {\mathbf x}^{n+1}\}\) and segments \({\mathbf e}^i = {\mathbf x}^{i+1} - {\mathbf x}^i\). Setting \({\mathbf t}^i = {{\mathbf e}^i \over \Vert {\mathbf e}^i\Vert }\), the unit tangent vector per edge, a local orthonormal material frame \(\{{\mathbf t}^i, {\mathbf m}_1^i, {\mathbf m}_2^i\}\) is assigned to each point

2.2.1 Reference Frames

We assign to each point a local orthonormal frame (the material frame) \(\{ {\mathbf t}^i, {\mathbf m}^i_1, {\mathbf m}^i_2\}\), \(i=0,\ldots ,n\), describing the centerline orientation as follows. Let us denote by \({\mathbf e}^i= {\mathbf x}^{i+1}- {\mathbf x}^{i}\), \(i=0,\ldots ,n\), the straight segments joining the points \(\{ {\mathbf x}^0, {\mathbf x}^1,..., {\mathbf x}^{n+1} \}\). The unit tangent vector associated to each edge is then \({\mathbf t}^i= { {\mathbf e}^i \over \Vert {\mathbf e}^i \Vert }\), where \(\Vert \Vert \) denotes the euclidean norm. Assuming the Bishop frame \(\{\mathbf{t}^i, \mathbf{u}^i, \mathbf{v}^i\}\) known, the vectors \({\mathbf m}^i_1, {\mathbf m}^i_2\) are obtained rotating \(\mathbf{u}^i, \mathbf{v}^i\) an angle \({\varvec{\theta }}^i\) in the plane orthogonal to \(\mathbf{t}^i\):

$$\begin{aligned} \mathbf {m_1^i} = \cos ({\varvec{\theta }}^i) \mathbf {u}^i + \sin ({\varvec{\theta }}^i) \mathbf {v}^i, \quad \mathbf {m_2^i} = -\!\sin ({\varvec{\theta }}^i) \mathbf {u}^i + \cos ({\varvec{\theta }}^i) \mathbf {v}^i. \end{aligned}$$
(1)

To define a Bishop frame we choose \(\mathbf{u}^0 \perp \mathbf{t}^0\) and set \(\mathbf{v}^0= \mathbf{t}^0 \times \mathbf{u}^0.\) The frames at the remaining edges are constructed by parallel transport [3]. We set

$$\begin{aligned} \mathbf{u}^i = P_i (\mathbf{u}^{i-1}), \quad \mathbf{v}^i= \mathbf{t}^i \times \mathbf{u}^i, \end{aligned}$$
(2)

where \(P_i\) are rotation matrices about the curvature binormal defined by:

$$ P_i (\mathbf{t}^{i-1})= \mathbf{t}^{i}, \quad P_i (\mathbf{t}^{i-1} \times \mathbf{t}^{i})= \mathbf{t}^{i-1} \times \mathbf{t}^{i}. $$

If \(\mathbf{t}^{i-1} = \mathbf{t}^{i}\), \(P_i\) is the identity. The condition \(\mathbf{u}^0 \perp \mathbf{t}^0\) must be maintained during the simulation. This is guaranteed when \(\mathbf{t}^0\) is clamped. Otherwise, it can be reestablished by parallel transport in time (instead of space).

2.2.2 Equations for the Angles

The equations for the angles follow from energy arguments. When the undeformed configuration of the filament is straight and its elastic response is isotropic, the elastic energy due to torsion and bending takes the form [3]:

$$\begin{aligned} E= \sum _{i=1}^n \beta {({\varvec{\theta }}^i - \theta ^{i-1})^2 \over \overline{\ell }^i} + \sum _{i=1}^n {\alpha \over 2 \overline{\ell }^i} \sum _{j=i-1}^i \Vert \mathbf{w}_i^j - \overline{\mathbf{w}}_i^j \Vert ^2, \end{aligned}$$
(3)

where \(\alpha \) and \(\beta \) are the bending and torsion moduli, respectively. We may set \(\alpha =E_YI\) and \(\beta =JG\), being \(E_Y\) the Young modulus of the thread, I the second moment of area, G the shear modulus of the thread and J the torsional rigidity constant. If we consider a thread composed of an isotropic elastic material, the Young modulus and shear modulus are related by the Poisson coefficient \(\nu \) as \(G=\frac{E_Y}{2(1+\nu )}\). For a filled cylinder we have \(J = I\), hence \(\beta =\frac{E_Y}{2(1+\nu )}I\).

In formula (3), \(\overline{\ell }^i\) is the length of the segments \(\overline{\mathbf{e}}^i= \overline{x}^{i+1} - \overline{x}^{i}\) in a reference undeformed configuration \(\{ \overline{\mathbf x}^0, \overline{\mathbf x}^1,..., \overline{\mathbf x}^{n+1} \}\). The vectors \(\mathbf{w}_i^j\), \(\overline{\mathbf{w}}_i^j\), \(j=i-1,i\), are material curvatures in the deformed and undeformed configurations, respectively:

$$\begin{aligned} \mathbf{w}_i^j = \left( (\kappa \mathbf{b})_i \cdot {\mathbf m_2^j}, - (\kappa \mathbf{b})_i \cdot {\mathbf m_1^j} \right) ^t, \quad (\kappa \mathbf{b})_i = { 2 {\mathbf e}^{i-1} \times {\mathbf e}^{i} \over \Vert \overline{\mathbf e}^{i-1}\Vert \Vert \overline{\mathbf e}^{i}\Vert + {\mathbf e}^{i-1} \cdot {\mathbf e}^{i} }, \end{aligned}$$
(4)

where \(\kappa \mathbf{b}\) is the curvature binormal. For an undeformed straight shape \(\overline{\mathbf{w}}_i^j=0\). The general form of the elastic energy for anisotropic rods that adopt a nonstraight undeformed shape is given in [3].

The material frame is updated in a quasistatic way. Imposing

$$\begin{aligned} {\partial E \over \partial {\varvec{\theta }}^i}=0, \end{aligned}$$
(5)

for all segments i not fixed by a boundary condition, this system of equations determines the angle configuration that minimizes the energy of the thread. Clamped ends are accounted for assigning the material frame for \(i=0\), \(i=n\). No boundary condition corresponds to a stress free end.

2.2.3 Equations for the Positions

We keep track of the filament position displacing the nodes according to Newton’s second law:

$$\begin{aligned} {\mathscr {M}} {d^2\mathbf{x} \over dt^2} = - {d E \over d \mathbf{x}} + \mathbf{F}= \mathbf{F}_T, \end{aligned}$$
(6)

where \(\mathbf {F}\) represents the external forces and \( - {d E \over d \mathbf{x}}\) the elastic forces. Explicit formulas for the elastic forces are given in [3]. \({\mathscr {M}}\) denotes the \(3(n+2) \times 3(n+2)\) mass matrix, we set \({\mathscr {M}}=m {\mathscr {I}}\), where \({\mathscr {I}}\) is the identity matrix. \(\mathbf x = (\mathbf x^0, \ldots , \mathbf x^{n+1})\) denotes the ordered sequence of 3D node coordinates. Notice that \(\mathbf x^i= (x^i_1,x^i_2,x^i_3).\)

To approximate the solution of system (6), we apply a Verlet integrator to estimate the displacements and velocities, and then enforce an inextensibility constraint for each segment by using a manifold projection method [12]. This constraint facilitates a stable evolution from a numerical point of view.

For each new time \(t_{k+1}=t_k +h\), the Verlet scheme provides the prediction:

$$\begin{aligned} \tilde{\mathbf{v}}_{k+1} = \mathbf{v}_{k} + h {\mathscr {M}}^{-1} \mathbf{F}_T(\mathbf{x}_{k}), \quad \tilde{\mathbf{x}}_{k+1} = \mathbf{x}_{k} + h \tilde{\mathbf{v}}_{k+1}, \end{aligned}$$
(7)

starting from previous values \(\mathbf{x}_{k}, \mathbf{v}_{k}\), where \(\mathbf{v}_{k}=\dot{\mathbf{x}}_k\) and h is the time step. The projection method works as follows. We set \(\mathbf{y}_0=\tilde{\mathbf{x}}_{k+1}\). At each step j, we compute the next value \(\mathbf{y}_{j+1}=\mathbf{y}_{j}+ \delta \mathbf{y}_{j+1}\), where

$$\begin{aligned} \delta \mathbf{y}_{j+1} = - h^2 {\mathscr {M}}^{-1} \nabla \mathbf{C}(\mathbf{y}_j)^t \, \delta {\ell }_{j+1}, \end{aligned}$$
(8)

and \(\mathbf{C}(\mathbf{y})\) defines the system of constraints. The vector \(\delta {\ell }_{j+1}\) solves the linear system

$$\begin{aligned} h^2 \nabla \mathbf{C}(\mathbf{y}_j) {\mathscr {M}}^{-1} \nabla \mathbf{C}(\mathbf{y}_j)^t \, \delta {\ell }_{j+1} = \mathbf{C}(\mathbf{y}_j). \end{aligned}$$
(9)

The iteration stops if \(\Vert \mathbf{C}(\mathbf{y}_{j+1})\Vert \le \varepsilon \) for the desired tolerance \(\varepsilon >0\). The constraint enforcing velocity and position are then

$$\begin{aligned} \mathbf{v}_{k+1}= {1\over h} (\mathbf{y}_{j+1}-\tilde{\mathbf{x}}_{k+1}), \quad \mathbf{x}_{k+1} = \mathbf{x}_{k} + h \mathbf{v}_{k+1}. \end{aligned}$$
(10)

If inextensibility is the only constraint, \(\mathbf{C}\) is defined by the system of equations \( \Vert \mathbf{e}^i\Vert ^2 / \Vert \overline{\mathbf{e}}^i\Vert - \Vert \overline{\mathbf{e}}^i\Vert =0\), for each edge i.

2.2.4 Coupling to the Flow

The force exerted by a fluid undergoing a given undisturbed flow on a long slender body is analyzed in [6]. The following asymptotic formula in terms of the ratio of the of the cross-sectional radius to the body length is given:

$$\begin{aligned} \frac{\mathbf{f}^t}{2\pi } \!=\mu _f \lambda \int _0^1 \Big ( \!\Big [ \frac{(\mathbf U \!-\! \mathbf U ^*)^t}{\ln \, \kappa } \!\,+\,\! \frac{(\mathbf U \!-\! \mathbf U ^*)^t \ln (2)}{(\ln \, \kappa )^2} \Big ] \cdot [ \mathbf{t} \, \mathbf{t}^t-2 {\mathscr {I}} ] \!+\! \nonumber \\ \frac{\frac{1}{2}(\mathbf U \!-\! \mathbf U ^*)^t}{(\ln \, \kappa )^2} \cdot [ 3 \mathbf{t} \, \mathbf{t}^t \!-\! 2 {\mathscr {I}} ] \Big ) ds, \end{aligned}$$
(11)

where f is the force acting on a filamentous body of length \(\lambda \), \(\mathbf U \) and \(\mathbf U ^*\) are the velocities of the unperturbed fluid and the thread, respectively, at the position \(\gamma (s)\) and \({\mathscr {I}}\) is the \(3\,\times \,3\) identity matrix. We denote by \(\mu _f\) the viscosity of the fluid, \(\gamma (s)\) the position of the thread centerline, s the arclength of the thread (\(0< s < 1\)), \(\mathbf{t}(s)=\frac{d \gamma (s)}{ds}\) the tangent vector at the position \(\gamma (s)\) and \(\kappa =\frac{r}{L}\) the ratio between cross-sectional radius r to characteristic thread length L.

This relation allows us to directly calculate the fluid force \(\mathbf{f}^i\) acting on each node of the thread by using the difference of velocities between the fluid and the thread, the tangent vector at each node and the aspect ratio of the thread, an idea already exploited for filaments in 2D corner flows in [1]. Notice that, at each node \(\mathbf x^i\), the thread velocity \(\mathbf U^*(\mathbf x^i,t)=\mathbf v^i(t)\). In absence of other forces, \(\mathbf{F}=(\mathbf{f}^0,\ldots ,\mathbf{f}^{n+1})\) in Eq. (6).

Biofilm filaments live inside tubes of a certain shape. A simple way to incorporate this restriction is a penalty method. The idea is to include in the force term \(\mathbf{F}\) in Eq. (6) additional forces \(\mathbf{f}_w\) supported on the tube walls that point inside the tube and act on any node hitting the wall, sending it back inside. Alternatively, we might set the position equal to the effective maximum radius and reset the velocity equal to zero.

2.2.5 Increasing the Length

Increase in length of a filament can be due to the combined effect of different mechanisms: biomass production, biomass adhesion, elastic elongation, swelling... To reproduce an increase in length at a certain rate we enlarge the segments joining nodes in a controlled way, redefining the reference lengths at the same time. Directional mass addition may be represented adding nodes at an edge and redefining the reference configuration each time a node is added.

In practice, we alternate steps in which we solve the equations for the evolution of the discrete rod with steps in which we increase the length of the edges or the number of nodes, and reset the reference configuration before computing again the evolution of the enlarged filament.

2.2.6 Overall Procedure

Summarizing, to compute the evolution of a rod we proceed in the following steps:

  • Initialization:

    • Define the Bishop frame at edge 0: \((\mathbf{t^0}, \mathbf{u^0}, \mathbf{v^0})\).

    • Set the position of the undeformed centerline: \(\overline{\mathbf x}^0, \overline{\mathbf x}^1,..., \overline{\mathbf x}^{n+1} \).

    • Select the initial position and velocity of the centerline: \((\mathbf x^0, \dot{\mathbf x}^0), (\mathbf x^1, \dot{\mathbf x}^1), \) \(..., (\mathbf x^{n+1}, \dot{\mathbf x}^{n+1})\).

    • Enforce the boundary conditions for the filament at the initial and final nodes.

    • Set the material curvatures using Eq. (4).

    • Set the material frame by means of Eqs. (1), (2) and (5).

  • Iteration for each new time step:

    • Compute the elastic forces \(- {d E \over d \mathbf{x}}\) acting on the centerline, and possible additional forces \(\mathbf{F}\) (see Sect. 2.2.4).

    • Integrate Newton equations for the centerline (6) enforcing inextensibility and possible additional constraints (see Sect. 2.2.3).

    • Update the Bishop frame using Eq. (2).

    • Update the quasistatic material frame by means of Eqs. (1) and (5).

    • Eventually, increase the length of the edges or the number of nodes, and reset the reference configuration (see Sect. 2.2.5).

The simulations shown in Fig. 4 start from a straight filament placed at the center of the tube. The initial node positions are randomly perturbed to ensure a slight initial excess length with respect to the tube length. A twist angle is imposed at the filament edges. The length of the filament is slowly increased as the helix develops to foster the coarsening process [11]. The unperturbed fluid velocity profile obeys a radial Hagen-Poiseuille distribution. However, the fluid force does not seem to play a role in helix formation, which is driven by elastic forces. It only causes slow downstream motion of the whole structure. Therefore, we may set it equal to zero to simplify the study of helix development. The force term \(\mathbf{F}\) would only account for the presence of the walls in this case, constraining the helix radius. On the contrary, fluid forces are essential to produce the filaments crossing corner flows described in Sect. 2.3.

2.2.7 Nondimensional Equations

It is convenient to nondimesionalize Eqs. (3), (6) and (11) for numerical purposes. The change of variables \(x = { \lambda } x'\) , \(t = T t'\), \(\mathbf{U} = U_0 \mathbf{U}'\), \(E = {\alpha \over { \lambda }} E'\), \(\mathbf{F} = \mu _f { \lambda } U_0 \mathbf{F}'\) yields:

$$\begin{aligned} {d^2\mathbf{x'} \over dt'^2} = - {T^2 \over m { \lambda }^2} {d E \over d \mathbf{x'}} + {T^2 \over m { \lambda }} \mathbf{F} = - {\alpha T^2 \over m { \lambda }^3} {d E' \over d \mathbf{x'}} + {\mu _f U_0 T^2 \over m} \mathbf{F'}, \end{aligned}$$
(12)

where the force term includes the force exerted by the fluid \(\mathbf{f}\) plus possible penalty forces \(\mathbf{f}_w\) at the walls, that is, \(\mathbf{F}=\mathbf{f} + \mathbf{f}_w\). In view of the definition (3) of the energy E, this change introduces the controlling parameters \(\alpha ' = {\alpha T^2 \over m { \lambda }^3}\), \(\beta ' = {\beta T^2 \over m { \lambda }^3}\) and \(\delta '={\mu _f U_0 T^2 \over m}\), \(U_0\) being a characteristic velocity. Determining ranges of values of \(\alpha '\), \(\beta '\) that lead to different types of filamentary structures we would obtain ranges for \(\alpha \), \(\beta \) whenever the density \(\rho \) and radius r of the filaments are experimentally quantified. Working with one dimensional filaments, we neglect the cross-sections. A three-dimensional cylindrical thread of density \(\rho \), radius r, and length \( L \gg r\) is approximated in this setting by a discrete rod with \(n+2\) nodes and \(n+1\) edges, with mass \(m = \rho \pi r^2 L /(n+1)\). From identities (3) and (12), the characteristic time associated to the elastic deformation of the thread can be estimated as \(T_{elast}=\sqrt{\frac{m{ \lambda }^3}{E_YI}}\). If this value is chosen as characteristic time in our system and we use formula (11) we arrive at:

$$\begin{aligned} {d^2\mathbf{x'} \over dt'^2} = - {d E' \over d \mathbf{x'}} + \eta \mathbf{F'}, \end{aligned}$$
(13)

where \(\eta =\frac{\mu _f U_0{ \lambda }}{\frac{E_YI}{{ \lambda }^2}}\) is the ratio of viscous forces to elastic forces, see [1].

Fig. 6
figure 6

a Normalized velocity modulus in the mid-plane of the there dimensional channel. b Initial filament configuration in the corner flow simulations

2.3 Biofilm Threads in Corner Microflows

The situation described in Sect. 2.1 for helical biofilms is partly reminiscent of the observations made with Pseudomonas Aeruginosa in a laminar corner microflow [9]. Bacteria are driven to the wall by small secondary vortices past the corner, creating nucleation sites. Once a biofilm seed forms, threads made of bacteria joined by EPS matrix are issued. Initially, they align with the streamlines, like streamers. Unlike the case of helical biofilms, which are triggered by elastic forces and constrained by the tube walls, biofilm threads cross the streamlines of corner flows driven by the fluid force acting on them, as a result of the interaction fluid-structure. A two-dimensional model of an elastic filament in a corner flow shows that under certain conditions filaments cross the main stream and reach the opposite corner [1]. When the filament is long enough, it reaches the opposite corner adopting the equilibrium shape of an elastic rod in a corner flow. As in the case of helices, the final configuration seems to be a minimum of an elastic energy.

Fig. 7
figure 7

Effect of the initial thread geometry on its dynamics during the simulation: a Length L and b angle \({\varvec{\theta }}\). Parameter values are \(\alpha '=1\), \(\beta '=0.358\), \(n=100\), \(\eta =3000\), \(\kappa =0.05\), \(\varDelta t'=10^{-3}\) time units. A final state joining opposite corners is reached depending on the initial orientation and length, although these constraints may change with the initial velocity of the thread

The 3D model summarized in Sect. 2.2 reproduces this behavior provided we include in the equations of motion (6) the force due to the fluid [6], given by (11). The pressure driven fluid velocity field \({\mathbf U}\) may be computed using finite element software such as COMSOL multiphysics in the unperturbed channel geometry, see Fig. 6a. We use this reference flow field during the whole simulation, ignoring perturbations due to the presence of the thin biofilm thread, as in [1, 6]. Figure 6b represents the initial biofilm configuration used in the simulations. Keeping the same parameters as in the experiments [1], we can study the influence of variables like the initial angle or length on the filament evolution. Figure 7 shows some possible configurations. To obtain it, we integrated the evolution Eq. (13) setting the characteristic spatial length \(\lambda = 1 \upmu \)m and the characteristic time of the system equal to the elastic deformation time \(T_{elas}\), which yields \(\alpha '=1\), \(\beta '=\beta /\alpha \), \(\delta '=\eta \).

As observed in [1], the parameter \(\eta \) regulates the effect on the fluid on the thread dynamics. For values of \(\eta \le 4000\), the contact of the thread with the opposite corner is only dependant of the filament initial position and length. A minimum length and angle are needed for the thread to reach the opposite corner. Within the range \(4000<\eta <8000\) the fluid can substantially modify the trajectory of the thread. For \(\eta > 8000\) the fluid strongly drags the thread in the direction of the stream, avoiding contact with the opposite corner. A steady position for the thread parallel to the streamlines was found for \(\eta \sim 30,000\). These results are obtained setting the initial velocity of the thread equal to the fluid velocity at the node positions. The initial thread velocity affects the results. Setting it equal to zero, very low values of \(\eta \) would be required to cross the streamlines.

If we start from a short thread and implement directional mass increase adding nodes at an edge and redefining the reference configuration each time a node is added, then we can see the filament grow as it moves towards the opposite corner.

3 Wrinkled Biofilms on Agar

Whereas biofilms in flows tend to form filamentary structures, biofilms spreading on agar/air interfaces adopt wrinkled shapes [2, 5, 20]. Descriptions of their behavior may be made more precise than in the previous case due to an increasing amount of experimental evidence. Cell death has been shown to play a role on the onset of wrinkles in Bacilus Subtilis biofilms. The biofilm is formed by bacteria immersed in a polymer matrix, which gives the mixture a certain elastic cohesion. Dividing cells produce compression stresses. In addition, cells may die due to biochemical stress associated with high cell density, high waste and toxin concentration, and lack of resources. Dead areas allow to relieve that stress forming wrinkles. This explains the onset of wrinkles [2] but not the branching arrangements observed [10]. These arrangements can be understood incorporating information on cellular activity in mechanical models of biofilm expansion on a substrate, as we explain next.

3.1 Föppl-Von Karman Models

Let us consider a biofilm layer spreading on an agar substratum. We can reproduce wrinkle branching in the expanding biofilm resorting to Föppl-Von Karman descriptions of the interface biofilm/agar [8, 14, 17]:

$$\begin{aligned} {\partial \xi \over \partial t}= & {} {1 - 2 \nu _v \over 2 (1-\nu _v)} {h_v \over \eta _v} \Bigg [ D (- \varDelta ^2 \xi + \varDelta C_M) + h {\partial \over \partial x_{\beta }} \left( \sigma _{\alpha ,\beta }(\mathbf{u}) {\partial \xi \over \partial x_{\alpha }}\right) \Bigg ] -{\mu _v \over \eta _v} \xi , \end{aligned}$$
(14)
$$\begin{aligned} {\partial \mathbf{u} \over \partial t}= & {} {h_v h \over \eta _v} \nabla \cdot {\varvec{\sigma }(\mathbf{u}) } - {\mu _v \over \eta _v} \mathbf{u}, \end{aligned}$$
(15)

where \(h_v\) is the thickness of the viscoelastic substratum and \(\mu _v\), \(\nu _v\), \(\eta _v\) its rubbery modulus, Poisson ratio, and viscosity, respectively. The bending stiffness is \(D={Eh^3 \over 12 (1-\nu ^2)}\), where E and \(\nu \) represent the Young are Poisson moduli of the biofilm, whereas h is the film thickness. In these equations, \(\xi \) stands for the out of plane displacement and \(\mathbf{u}\) for the in-plane displacement. \(\alpha \) and \(\beta \) stand for xy and summation over repeated indices is intended. Stresses \(\varvec{\sigma }\) and strains \(\varvec{\varepsilon }\) are defined in terms of in-plane displacements \(\mathbf{u}=(u_x,u_y)\) [8, 16]:

$$\begin{aligned} \varepsilon _{\alpha ,\beta }={1\over 2} \left( {\partial u_{\alpha } \over \partial x_{\beta }} + {\partial u_{\beta } \over \partial x_{\alpha }} + {\partial \xi \over \partial x_{\alpha }} {\partial \xi \over \partial x_{\beta }} \right) + \varepsilon _{\alpha ,\beta }^0,\end{aligned}$$
(16)
$$\begin{aligned} \sigma _{xx}= {E \over 1-\nu ^2} (\varepsilon _{xx}+ \nu \varepsilon _{yy}), \quad \sigma _{xy}= {E \over 1+\nu } \varepsilon _{xy}, \quad \sigma _{yy}= {E \over 1-\nu ^2} (\varepsilon _{yy}+ \nu \varepsilon _{xx}). \end{aligned}$$
(17)

The residual strains \(\varepsilon _{\alpha ,\beta }^0\) are expressed in terms of the growth tensor [8] as:

$$\begin{aligned} \varepsilon _{\alpha ,\beta }^0= -{1\over 2} \left( {\mathscr {G}}_{\alpha \beta } + {\mathscr {G}}_{\beta \alpha } + {\mathscr {G}}_{z \alpha } {\mathscr {G}}_{z \beta } \right) , \end{aligned}$$
(18)

and should be computed from the cellular activity in the spreading biofilm configuration.

3.2 Bacterial Activity

Bacterial activity can be represented exploiting different agent based models. Cellular automata descriptions, for instance, provide a simple framework allowing for an easy transfer of information into macroscopic models. The biofilm is divided in cubic tiles, each of them containing a few cells. To simplify further, we may identify each tile with one cell. This approach has two advantages. First, we can use the same grid of tiles to discretize the equations for the relevant chemical concentrations and the displacements, and then solve them numerically. Second, we can calculate the growth tensors due to cell division, death, and other processes, and use them to estimate the residual stresses that enter the Föppl-Von Karman equations for the deformations. We have to decide for each cell which is its status. It may secrete chemicals, deactivate, divide creating a newborn cell that displaces the rest or die, being eventually reabsorbed by the rest. This may be done resorting to dynamic energy budget descriptions [4] or according to probabilities that depend on the relevant concentrations [10].

When there is an excess of oxygen, the concentration of nutrients \(c_n\) becomes the limiting concentration that restricts biofilm growth. The evolution of the concentration \(c_n\) in the biofilm/agar system is governed by

$$\begin{aligned} c_{n,t} - \mathrm{div} (D_{n} \nabla c_n) = r_n(c_n), \end{aligned}$$
(19)

where \(r_n(c_n) = - \tilde{k}_n {c_n\over c_n+K_n}\), and \(\tilde{k}_n\) is the uptake rate, equal to \(k_n\) at each alive cell location and zero otherwise. \(D_n\) and \(K_n\) denote the diffusion and half-saturation coefficients. No-flux boundary conditions are imposed at the interface with air. The evolution of the concentration of waste \(c_W\) in the biofilm/agar system is governed by

$$\begin{aligned} c_{w,t} - \mathrm{div} (D_{w} \nabla c_w) = r_w(c_w), \end{aligned}$$
(20)

where \(r_w(c_w) = \tilde{k}_w \), and \(\tilde{k}_w\) is the waste production rate, equal to \(k_w\) at each alive cell location and zero otherwise. No-flux boundary conditions are imposed at the interface with air. The diffusion coefficients \(D_w\) and \(D_n\) may vary across the biofilm/agar system.

In the simplest cellular automata approach, tiles \({\mathscr {C}}\) occupied by alive cells are assumed to divide with probability [13]:

$$\begin{aligned} P_d({\mathscr {C}}) = {c_n({\mathscr {C}}) \over c_n({\mathscr {C}}) + a_n}, \end{aligned}$$
(21)

\(c_n\) being the limiting concentration and \(a_n>0\). Newborn cells inside the biofilm are reallocated by pushing existing cells in the direction of minimum mechanical resistance, that is, the shortest distance to the biofilm-air interface or to dead cells. Taking the concentration of waste \(c_w\) at a location as an indicator of death, a cell \({\mathscr {C}}\) is scheduled to die with probability:

$$\begin{aligned} P_w({\mathscr {C}}) = {c_w({\mathscr {C}}) \over c_w({\mathscr {C}}) + a_w}, \end{aligned}$$
(22)

\(c_w\) being the waste concentration and \(a_w>0\). Dead cells surrounded by enough alive neighbors may be reabsorbed by the rest, and its place occupied by a newborn cell. Otherwise, necrotic regions are created. This process may be further refined to account for cell differentiation into producers of different types of autoinducers [4, 10].

For a fixed distribution of cell types, the concentrations \(c_n\) and \(c_w\) relax fast to stationary values, which may be approximated by explicit finite difference schemes. Once the concentration values are calculated, we go through all the cells forming the film, creating new cells or killing existing ones with the selected probabilities. Then, a growth tensor may be defined at each tile by keeping track of all the new tiles created and the direction in which their predecessors where shifted. First we introduce a vector \(\mathbf{w}=(w_1,w_2,w_3) a,\) where a is the tile size. \(w_1\) is evaluated at each location by adding \(\pm 1\) cumulatively for each tile shifted in the x direction in the positive or negative sense, respectively. \(w_2\) and \(w_3\) are calculated in a similar way, along the y and z directions, respectively. The resulting vector \(\mathbf w\) is normalized to have norm a. Next, we compute \(\nabla \mathbf{w}\) approximating the derivatives by finite differences. To estimate the growth tensor \({\mathscr {G}}(x,y)\) we average all the contributions from \(\nabla \mathbf{w}(x,y,z)\) varying z.

Fig. 8
figure 8

a Biofilm containing regions where the cell density is higher. dx represents the spatial step. b \(\varepsilon _{xx}^{0,av}\) component of the residual strain tensor due to growth with \(N=1\). c Averaged \(\varepsilon _{xx}^{0,av}\) component with \(N=100\). d Filtered \(\varepsilon _{xx}^{0,fil}\) component with \(N=1\). e Filtered \(\varepsilon _{xx}^{0,fil}\) component with \(N=10\). The depressions correspond to the initial mounds and appear due to cell death caused by lack of resources. Strains are higher in the outer ring due to higher availability of resources, which results in higher division rates. The same scale of colors is used in all of them ranging from 3 (light yellow) to \(-3\) (dark green)

3.3 Residual Strains

The residual strains defined in (18) can be computed using the growth tensor \({\mathscr {G}}\) introduced in Sect. 3.2. However, stochastic variations make it unsuitable to be inserted directly in the Föppl-Von Karman equations (14)–(15) because they cause numerical instability.

To smooth out the residual strains and visualize the underlying spatial variations, we average them over a number of runs of the step in which new cells are created or killed according to the selected probabilities, keeping the same initial configuration in all of them:

$$\begin{aligned} \varepsilon ^{0,av}= {1\over N}\sum _{j=1}^N \varepsilon ^{0,j}, \end{aligned}$$
(23)

where \(\varepsilon ^{0,j}\) stands for the residual strain at trial j. Performing such ensemble averages for N large enough the averaged strains reproduce spatial variations reflecting cellular activity, see Fig. 8b, c. The resulting average becomes smoother as the number of runs N increases. However, the computational cost of this process is high.

Instead, we filter the residual fields using image processing techniques. This strategy yields smooth approximations with a clear spatial structure averaging just a few runs, see Fig. 8. The idea is to formulate a denoising problem: given an observed field \(f^{obs}=f+n\), we seek the underlying smooth structure f obtained removing the noise n. To solve this problem we apply a split Bregman method to a ROF (Rudin, Osher, Fatemi) model of the denoising problem [19]. The ROF model consists in solving the variational problem: Find f minimizing

$$ \int |\nabla f| + {\mu \over 2} \int |f-f^{obs}|^2 = TV(f) + {\mu \over 2} \Vert f-f^{obs}\Vert _{L^2}^2, $$

for \(\mu >0\) large. The split Bregman reformulation adds the constraint \(d=\nabla f\), sets \(s(b,f,d)= \int |b + \nabla f -d|^2 \) and introduces the iteration:

$$\begin{aligned} (f^{(k+1)},d^{(k+1)}) = \mathrm{Argmin}_{(f,d)} \{ |d| + {\mu \over 2} \Vert f^{obs} - f \Vert _{L_2}^2 + {\lambda \over 2} s(b^{(k)},f,d) \},\\ b^{(k+1)} = b^{(k)} + \nabla f^{(k+1)} - d^{(k+1)}. \end{aligned}$$

We split the minimization procedure to solve for each variable separately:

$$\begin{aligned} f^{(k+1)} = \mathrm{Argmin}_{f} \{ {\mu \over 2} \Vert f^{obs} - f \Vert _{L_2}^2 + {\lambda \over 2} s(b^{(k)},f,d^{(k)}) \}, \\ d^{(k+1)} = \mathrm{Argmin}_{d} \{ |d| + {\lambda \over 2} s(b^{(k)},f^{(k+1)},d)\}, \\ b^{(k+1)} = b^{(k)} + \nabla f^{(k+1)} - d^{(k+1)}. \end{aligned}$$

The first functional is differentiable, therefore, we can write the Euler-Lagrange equation and evaluate \(f^{(k+1)}\) with a Gauss-Seidel method. The second optimization problem can be solved using shrinkage operators:

$$\begin{aligned} d^{(k+1)} = \text{ shrink } (b^{(k)}+ \nabla f^{(k+1)}, {1 \over \lambda }), \\ \text{ shrink }(x,\gamma ) = {x \over |x|} \text{ max }(|x|-\gamma ,0). \end{aligned}$$

The filtered fields reproduced in Fig. 8 have been produced setting \(f^{obs} =\varepsilon _{xx}^{0,av}\) over the 2D grid in the plane XY, relabeling to transform it into a 1D vector, and using the algorithm:

  • Initial guess \(f^{(0)} = f^{obs}\), \(d^{(0)}=0\), \(b^{(0)}=0.\)

  • While \(\Vert f^{(k)} - f^{(k-1)} \Vert _{L_2} > Tol\)

    • \(f^{(k+1)} = G^{(k)}\), where, for \(j=1, \ldots , M,\)

      $$\begin{aligned} G^{(k)}_j = {\lambda \over \mu \!+\! 2\lambda } \Big (f_{j+1}^{(k)} + f_{j-1}^{(k)} \!-\! (d_j^{(k)}\!\!-\!d_{j-1}^{(k)}) \!+\! (b_j^{(k)}\!\!-\!b_{j-1}^{(k)})\Big ) \!+\! {\mu \over \mu \!+\! 2 \lambda } f_j^{obs}, \end{aligned}$$

      with \(\nabla f^{(k+1)}_j = f^{(k+1)}_{j+1} - f^{(k+1)}_j,\)

    • \(d^{(k+1)} = \mathrm{shrink}(b^{(k)} + \nabla f^{(k+1)}, {1\over \lambda })\),

    • \(b^{(k+1)} = b^{(k)} + \nabla f^{(k+1)} - d^{(k+1)}\).

  • If \(\Vert f^{(k)} - f^{(k-1)} \Vert _{L_2} \le Tol\), we set \(f^{fil}=f^{(k)}.\)

The resulting fields are smooth enough to be plugged in Eqs. (14)–(15) through (16)–(17) without causing numerical instability, allowing us to reproduce behaviors that resemble observed patterns.

Our simulations of biofilm behavior alternate steps in which we update the configuration of biofilm tiles, creating and killing cells, and then evaluate the resulting stresses, with steps in which the biofilm shape is deformed as determined by the Föppl-Von Karman equations, see [10] for details. Figure 9 shows wrinkles coarsening and opening up in radial branches. This phenomenon is associated to compression fronts expanding at certain speeds. Other observed arrangements, such as wrinkled coronas, that is, a corona of radial wrinkles surrounding a central core [5], can be reproduced varying the Young modulus as usual in corona instabilities: a swollen corona with diminished Young modulus around a harder core [10]. Two phase models have been proposed to describe swelling processes in [18]. However, an adequate way to handle water migration processes is still missing in our description.

Fig. 9
figure 9

In silico wrinkle coarsening and successive branching in a biofilm spreading on agar. The height of the wrinkles ranges from \(-5\) to 5 dx and the final radius is about 250 dx, dx being the size of the tiles in the spatial discretization employed to evaluate the cellular activity

4 Conclusions

Summarizing, we have shown that inserting in plate and rod models information from the cellular activity and the interaction with the environment we gain insight on biofilm shapes.

Coupling discrete rod models to the forces exerted by surrounding fluids and incorporating external constraints such as the presence of walls and constrictions, we are able to reproduce experimentally observed filamentary patterns. Helical biofilms in flows arise as elastic instabilities that coarsen as the length of the biofilm thread increases due to biomass production and finally wrap around tube walls reducing their pitch to accommodate more biomass. The main role of the flow in this case is to promote biofilm filament nucleation past constrictions and to provide mechanisms for twist at the filament edges. Instead, biofilm threads are seen to cross 3D corner microflows to join opposite corners as a result of the interaction fluid/structure, in agreement with experiments and previous 2D studies.

Whereas biofilms in flows tend to form filaments, biofilms on agar surfaces often spread forming wrinkled patterns. Successive radial wrinkle branching is associated to expanding compression fronts and can be reproduced by inserting residual stresses caused by cell division and death in Föppl-Von Karman descriptions of the out of plane displacements of the interface biofilm/agar. These residual stresses are obtained from growth tensors, computed here using the information on the cellular activity provided by a simple cellular automata model. To avoid instability caused by stochasticity and be able to visualize the spatial variations caused by the cellular activity, such residual stresses are smoothed out combining ensemble averages and denoising algorithms. More realistic models of cellular activity could be considered at the expense of increasing the computational cost. Additional processes affecting biofilm shapes such as water migration through the agar/biofilm system are missing in our description and should be the object of further consideration.