Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Fluidic bacterial diodes rectify magnetotactic cell motility in porous environments

## Abstract

Directed motility enables swimming microbes to navigate their environment for resources via chemo-, photo-, and magneto-taxis. However, directed motility competes with fluid flow in porous microbial habitats, affecting biofilm formation and disease transmission. Despite this broad importance, a microscopic understanding of how directed motility impacts the transport of microswimmers in flows through constricted pores remains unknown. Through microfluidic experiments, we show that individual magnetotactic bacteria directed upstream through pores display three distinct regimes, whereby cells swim upstream, become trapped within a pore, or are advected downstream. These transport regimes are reminiscent of the electrical conductivity of a diode and are accurately predicted by a comprehensive Langevin model. The diode-like behavior persists at the pore scale in geometries of higher dimension, where disorder impacts conductivity at the sample scale by extending the trapping regime over a broader range of flow speeds. This work has implications for our understanding of the survival strategies of magnetotactic bacteria in sediments and for developing their use in drug delivery applications in vascular networks.

## Introduction

Hydraulic networks, ranging from saturated soils and sediments to human tissues and filtration media, play host to diverse swimming microbes1,2,3. To navigate these complex geometries, cells use environmental cues to direct their motility towards favorable conditions via an array of sensing (e.g., chemotaxis)4,5,6 and physical reorientation mechanisms (e.g., magnetotaxis)7. However, directed cell motility can be modified by ambient fluid flows8,9,10,11, which profoundly affects biomass distribution and productivity in the environment6,8. The geometric confinement of these environments regulates fluid flow and consequently, cell growth12 and swimming dynamics13,14,15. Confinement thus plays a central role in coupling directed motility to flow16,17,18,19. For example, in porous media flows, chemotaxis significantly augments the retention of swimming bacteria13,20. Directed microbial motility in porous geometries is integral to ecological, environmental, and biomedical applications3,21. Yet the impact of the microscopic coupling between directed cell swimming and heterogeneous flows on sample-scale cell transport properties remains elusive22.

Magnetotactic bacteria (MTB) naturally biomineralize nano-scale magnets called magnetosomes, which are embedded in their cell membrane. These particles are arranged in a linear array and form a permanent magnet that mechanically and passively aligns MTBs with Earth’s magnetic field7, enabling them to seek out microaerobic conditions in heterogeneous marine sediments23. MTBs provide an ideal physical18 and relevant ecological23,24 model system to probe the effects of directed motility on cell transport in heterogeneous flows: Their primary directional cue—the magnetic field—is purely mechanical, uniform, and independent of the ambient flow field. Beyond gaining insight into the evolutionary advantages of natural magnetotactism, MTBs are a promising candidate in biomedical applications for targeted drug delivery due to their potential to be directed through heterogeneous vascular network flows25,26.

In this study, we use microfluidic experiments (Fig. 1) in 1D porous media to unveil a novel, pore-scale transport mechanism for dilute suspensions of magnetotactic bacteria: cells, directed to swim upstream against a continuous, externally controlled flow, become trapped in striking vortical orbits when traversing a constriction. Vortical localization leads to highly nonlinear bacterial flux through a pore, characterized by three distinct flow regimes: similar to an electrical diode27, the transport is completely halted for a wide range of flow rates. This bacterial diode phenomenon is in stark contrast to linear fluidic network and continuum transport models28,29, which typically stem from a detailed understanding of pore-scale processes30,31,32. Simulations, based on single-cell motility modeling, reveal that cell trapping due to vortical localization is associated with diverging residency times and enhanced dispersion. We experimentally show that vortical trapping persists in higher dimensions (3D packed beds). Further, we extend our simulations to illustrate how disorder greatly broadens the trapping regime to impact sample scale transport, due to the dominance of a few strongly trapping pores. These nonlinear transport properties pose new challenges for modeling directed active matter15,33, far beyond the paradigms of classical passive scalar transport34.

## Results

### Vortical cell trapping at constrictions

A suspension of north-seeking Magnetococcus marinus (MC-1) bacteria35 (swimming speed, Vs = 135 ± 25 μm/s; Supplementary Information) is magnetically guided upstream against a continuous, externally controlled flow through successive pores of a corrugated microchannel, unveiling highly nonlinear directed transport. The dilute concentration of bacteria ( ~106 cells/ml; see “Methods”) ensures that cell−cell interactions are negligible36. The channels (height, h = 110 μm)37,38 comprise semi-circular walls with alternating concavity (Fig. 1c; Supplementary Fig. 1) to form a series of constrictions (throats) and expansions (pores). The throat walls have a fixed radius of curvature (35 μm) and separation distance, wt = 70 μm, while the radius of curvature of the pore walls is adjusted to vary the pore width, wp = 210, 280, and 350 μm. The flow field in the micro-channel is measured by particle tracking velocimetry (Fig. 1c and Supplementary Fig. 2; see also “Methods”), and the flow strength is characterized by the maximum, Umax, and minimum, Umin, centerline flow speeds, measured in the throat and pore, respectively. The magnetic field direction is imposed by a set of Helmholtz coils adapted to the microscope (Fig. 1a), which generate a strong magnetic field strength, B = 1.75 mT ( ≈30 times Earth Magnetic Field). The restoring magnetic torque on the cells competes with stochastic and hydrodynamic body reorientations and aligns the MTB swimming direction upstream.

Starkly different cell trajectories are observed for various flow regimes, parameterized by the maximal channel flow speed normalized by the mean cell swimming speed, Φ = Umax/Vs (Fig. 1d−f). Hydrodynamic torque from the local vorticity modifies the cell orientation and thus swimming dynamics8,9,39 (Fig. 1b). For small flow speeds, the magnetic torque maintains bacterial orientation and enables upstream swimming against the flow (Fig. 1d, Φ = 0.2; Supplementary Movie 1). For large flow speeds, cells are consequently swept downstream (Fig. 1f, Φ = 2.6; Supplementary Movie 3). However, for intermediate flow speeds, the bacteria form localized, vortical swimming orbits (Fig. 1e, Φ = 1.8; Supplementary Movie 2) that persists across pore geometries (wp/wt = 3, 5, 7) and are evident in the spatial distribution of cells (Supplementary Fig. 4). By accounting for hydrodynamic and magnetic torques on individual cells (Fig. 1b), we developed a Langevin model of magnetotactic motility18 (see “Methods” and Supplementary Information; Supplementary Fig. 3), which accurately predicts our experimental observations (Fig. 1g–i; Supplementary Fig. 4). The Langevin model also enables us to explore a broader range of ecologically relevant magnetic field strength (Supplementary Fig. 6) and alignment conditions (Supplementary Fig. 7) and to quantify the long-time cell transport properties of this system, relative to what is achievable by experiments alone.

### Pores act as fluidic diodes for upstream swimming cells

Linearity of fluid and solute transport with the driving pressure is a hallmark of most conventional hydraulic networks40. While bacterial transport is often modeled by simple advection-diffusion processes4, it is not clear whether linear conductivity is maintained in the case of directed swimming cells16,17,18 (Fig. 1d−i). The mean bacterial advection speed, 〈Vx〉, through a pore (Fig. 2a) reveals three distinct transport regimes across different continuous flow strengths, Umax, which bears a striking resemblance to the forward, backward, and breakdown regimes for current flow through an electrical diode27. For a fixed magnetic field and pore geometry, we find: (i) In the upstream regime (Φ = Umax/Vs < 1), the swimming speed is large compared to the flow speed (Fig. 2b, black dashed line), and MTB swim upstream with a net positive mean advection speed, 〈Vx〉 > 0. (ii) The trapping regime (1 < Φ < Φ*) is characterized by a near-zero mean bacterial advection speed, 〈Vx〉 ≈ 0, and coincides with the emergence of bacterial vortices (Fig. 1 e, h). As cells approach the throat, a hydrodynamic torque orients and concentrates the cells toward the channel center line18. Because the throat speed surpasses the swimming speed, Vs < Umax, cells are gated from passing the throat and are swept downstream. Once in the low-speed pore region where Vs > Umin, cells escape from the centerline and swim back upstream against the flow, repeating the cyclic orbit. Thus, Vs = Umin sets the critical non-dimensional flow speed Φ* = Umax/Umin, which defines the trapping regime (Fig. 2b, colored dashed lines) and increases with pore-throat aspect ratio, wp/wt. (iii) In the downstream regime (Φ > Φ*), the flow speed dominates cell swimming speed even in the pore region, Vs < Umin. Bacteria are swept downstream with a negative mean bacterial advection speed, 〈Vx〉 < 0, and the vortical orbits begin to dissipate. In contrast to the linear hydrodynamic conductivity of the carrier fluid (Supplementary Fig. 2), the flow conductivity of directed bacteria through confined pores is highly nonlinear and completely stifled in some cases.

Langevin simulations show that the diode-like transport behavior persists across a broad range of magnetic field strength (Supplementary Fig. 6) and alignment (Supplementary Fig. 7) conditions. Specifically, the strength of the magnetic field dictates the size of the trapping vortices and the efficacy of the trapping. The relatively high magnetic fields investigated in experiments dominate over the rotational noise of the cells, but as the magnetic field strength decreases, cells take larger lateral excursions in the pores (Supplementary Fig. 6f−t). This results in a dilation of the trapping vortices and a reduction in the range of the trapping regime (Supplementary Fig. 6a−e). Physically, as the trapping vortex size becomes larger than the pore size, the trapping strength diminishes. Notably, the diode phenomenon persists at Earth’s magnetic field strength (Supplementary Fig. 6e). In general, the flow direction is not necessarily aligned with the magnetic field direction. Perturbations from the antiparallel orientation explored in experiments reveal that as the angle between the magnetic field and flow directions is increased, one trapping vortex is diminished in favor of the other (Supplementary Fig. 7k−o), but the bacterial diode conductivity profile is preserved (Supplementary Fig. 7a−e). These results suggest that the nonlinear conductivity of directed microbes is robust and relevant to both the physical ecology of MTB in the natural environment7,23,24, and potential biomedical applications26.

Despite the stochastic nature of bacterial motility4, the observed vortical localization of the cells suppresses not only their mean advection speed but also the cell escape rate from a pore (Fig. 2c). The statistics of the escape rate, α, reflect the three observed flow regimes for the bacterial conductivity (Fig. 2b), where α = Jout/Nin, Jout is the total cell flux out of a pore, and Nin is the number of cells in the pore (Fig. 2a). For weak flows (Φ < 1) and for strong flows (Φ > Φ*), the escape rate is large owing to the dominance of upstream swimming and downstream advection, respectively. For intermediate flow speeds (1 < Φ < Φ*) in the trapping regime, the escape rate decreases to nearly zero, indicating suppressed transport. Beyond the qualitative agreement in the swimming trajectories (Fig. 1d−i), the strong quantitative agreement between simulations and experiments in capturing 〈Vx〉 and α demonstrates the predictive value of our Langevin model (Fig. 2b, c), which we use to study the long-time dispersive properties of these directed active suspensions.

### Pore-scale trapping increases retention time

Retention of bacteria in porous media has been extensively studied for its environmental and ecological importance41. The dynamical cell trapping investigated here leads to a new mechanism for MTB retention in porous media flows. Phase-space analysis of simulated cell trajectories reveals the swimming dynamics responsible for the modified transport of directed MTB (Fig. 3a−c; see also Supplementary Fig. 5). In the upstream regime, cells migrate unimpeded, and their upstream speed fluctuates within a positive range (Vx/(Vs − Umax) > 0) as they pass through low-speed pores and high-speed throats (Fig. 3a) with normalized cell position, x/wt. As the flow speed increases and the system reaches the trapping regime, vortical cell trajectories (Fig. 1e, h) emerge as bounded orbits in this phase space, with their speed alternating sign as they traverse irregular loops (Fig. 3b; Supplementary Fig. 5). The residency time within a pore thus diverges, corroborating the α ≈ 0 experimentally measured escape rates (Fig. 2c). In the downstream regime, cells begin to escape the vortical orbits (Fig. 3c, upper lobe; Supplementary Fig. 5). Subsequently, the cells are advected downstream, where they sample strictly negative advection speeds (Vx/(Vs − Umax) < 0) on the lower branch of the distribution. Individual cells switch between these two states in a stochastic catch-and-release process.

For the directed MTB motility in porous media investigated here, the average residency time, τres = 1/α, in a pore increases as the normalized flow speed approaches Φ = 1 for every geometry, corresponding to 〈Vs〉 = 0 (Fig. 3d). For comparison, we also examine the MTB residency time in a straight duct, where the effective pore size is defined as a square region with a side length corresponding to the duct width. In the straight duct, the cells are focused in a narrow beam centered in the channel18, and the normalized residency time peaks at a finite value, τresVs/wt = 30, for Φ = 1. Despite the average cell speed going to zero around Φ = 1, their continuous swimming and random reorientations cause the cells to eventually escape the boundaries defined above. For the corrugated channels, on the other hand, there exists a finite regime of 1 ≤ Φ ≤ Φ* over which the normalized retention time appears to diverge and no cells escape within the simulation time, τ ≥ 20,000.

These results identify a new mode of bacterial retention at the pore scale, due to the dynamical trapping of swimming magnetotactic cells. Recently, it has been shown that bacterial retention in porous media flows is enhanced by chemotaxis toward contaminants in the medium20, and likewise, retention is reduced when rinsing with a chemoattractant13. Such chemotactic retention mechanisms are inherently transient, due to both the driving chemoattractant concentration field and bacterial distribution being coupled to the ambient flow. In contrast, the dynamical trapping of MTB shown here is omnipresent, owing to the independence of the directing magnetic field. We expect that this fundamentally new retention mechanism will work in concert and competition with a chemotaxis13,20 and a range of other-directed swimming motilities in confined flows. Retention and intermittent trapping are also expected to enhance the dispersion of the cell population, beyond their random walk motility.

### Anomalous dispersion in corrugated channels

Langevin simulations demonstrate that the MTBs dispersion can be drastically enhanced or suppressed, depending strongly upon the details of the pore-scale flow. Bacterial dispersion coefficients, D, were measured from the linear regime of the mean square displacements along the flow direction, MSD = 〈(Δx − 〈Δx〉)2〉 and normalized by the effective diffusion coefficient, D0, without flow in a straight duct (Fig. 3e). (Fig. 3d, black lines). For comparison with the corrugated channels, we also examine the dispersion of MTB in a straight duct (Fig. 3e, brown), where the normalized dispersion scales as D/D0 ~ Φ−1/2 due to a well-established flow-focusing effect along the flow centerline16,17,18. Corrugation is well known to enhance the dispersion of Brownian particles38, and in the upstream regime, the dispersion coefficient of the actively swimming MTB initially grows with increasing flow speed. However, once the trapping regime (1 < Φ < Φ*) is reached, D/D0 can no longer be defined in our simulations, since the trapping time is longer than the simulation time (Fig. 3d), and the diffusive regime is never reached. In contrast, this is not the case for the straight duct, which always exhibits a finite residency time. As the residency times become finite again in the downstream regime (Φ > Φ*), the diffusive behavior is recovered and exhibits a strikingly large dispersion coefficient (up to D/D0 ≈ 4 × 103; Fig. 3e). The observed dispersion enhancement stems from the catch-and-release of cells through ephemeral retention in localized vortices (Fig. 3c), which drastically spreads out the bacterial population. For Φ  1, D/D0 asymptotically decays to the dispersion in a straight duct. The non-monotonic behavior of the dispersion coefficient stands in stark contrast to classical Taylor dispersion34, further illustrating the challenges for analytical models of active matter transport15,19.

### Vortical trapping in disordered geometries of higher dimensions

Natural microbial habitats are characterized by flows through heterogeneous pore structures31,42, far more complex than the periodic, one-dimensional geometry in which vortical trapping of MTBs was identified above (Figs. 1 and 2). Here, we experimentally demonstrate that this pore-scale effect occurs in disordered and higher dimensional porous media. Polydisperse, transparent hydrogel beads (10−25 μm radius) are randomly packed under flow into a rectangular microfluidic channel (height, 75 μm; width, 1000 μm; Supplementary Information). In a quiescent environment, swimming MTBs invade the entire medium. However, imposing an ambient flow and an opposing magnetic field reveals that only specific pores emerge as trapping sites (Fig. 4a, red hexagons; Supplementary Movie 4), where cells remained for up to several minutes (Fig. 4c; Supplementary Movie 5). In these trapping sites, cells appear to swim along more erratic trajectories compared to the regular vortexes observed in the 1D medium (Fig. 4c), likely due to the 3D flow geometry. Despite the more complex dynamics, the distribution of cell positions within the trapping pores remains narrow (Fig. 4c) at about half of the bead diameter, ≈20 μm. While we cannot entirely rule out other effects, the observed localization appears consistent with the hydrodynamic trapping demonstrated in the 1D corrugated microfluidic channels. Importantly, cells only localize in sporadic pores throughout the medium, suggesting that the heterogeneity of the flow field translates into the coexistence of different diode transport regimes (Fig. 2).

To elucidate the impact of microstructural heterogeneity on MTB transport, we adapt our simulations (see “Methods”) established for the corrugated channels to two different 2D geometries: (i) a regular square lattice of cylindrical obstacles (Fig. 4d) and (ii) a disordered version (Fig. 4e). Both geometries are comprised of 100 obstacles and have a porosity of 0.5. As in the 1D and 3D experiments, vortical trapping is readily observed over a finite range of sample-scale mean flow speeds through the 2D structures (Fig. 4f, g). The positions of these trapping pores are identified in the geometry as regions of high residency time for at least one of the sample-scale mean flow speeds. For the ordered lattice, they appear on the downstream side of the throats between obstacles, where vortexes form when the local pore reaches its trapping regime (Fig. 4f). Due to the high degree of lateral symmetry, the MTB form dual vortexes that exhibit a figure-8 shape, similar to the 1D corrugated channels (Fig. 1). These trapping regions are detected as a single high residency time site in our analysis, giving 100 detected traps for 100 obstacles. In this geometry, all of the pores are identical, and for a given mean sample scale flow speed, they simultaneously exist in one of the three observed diode regimes identified for the 1D corrugated channels. Thus, the nonlinear diode-like conductivity curve persists for directed MTB transport in the ordered 2D lattice (Fig. 4h, red curve).

In the disordered geometry, the same three distinct transport regimes are also observed, but the sample scale conductivity exhibits a marked five-fold increase in the range of the trapping regime (1≤Φ  6; Fig. 4h, blue curve). At the pore scale, adjacent pores simultaneously exist in different transport regimes (see Fig. 4g) with different pores entering and exiting the trapping regime as the sample scale mean flow speed increases (Supplementary Fig. 8). The broken symmetry of the throat flow direction with the magnetic field direction biases the trapping regions toward one side of the throat, which is consistent with 1D simulations in the corrugated channel for non-parallel magnetic field directions relative to the flow (Supplementary Fig. 7). Thus, the pore-scale heterogeneity extends the range of the sample scale trapping regime (Fig. 4h, blue curve). Cell seeding  is homogeneous in the porous media. Due to the periodic boundary conditions, cells circulate through the structures passing through pores in the upstream and downstream regimes, until they encounter a pore in the trapping regime (Fig. 4k, l). Over time, the cell concentration in the strongest trapping pores increases (Fig. 4m). As a result, cells densify in only a fraction of the available high residency sites for the sample scale trapping regime (Fig. 4i, j), while no such selection is observed for the ordered geometry. In disordered media, the local flow conditions that dictate the efficacy of dynamical trapping for directed swimming cells are not only a function of the sample-scale flow but also the local pore-throat structure.

## Discussion

Linear hydraulic network theory has been instrumental to our understanding of fluid and solute transport in porous media28,40, but active matter poses a host of new theoretical challenges12,15,19,39 when compared to Brownian particle transport43,44. Our results illustrate how the directed motility of individual swimming microorganisms couples to pore geometry and flow, resulting in highly nonlinear dispersion and flow conductivity. The retentive properties of these directed bacterial flows draw parallels to the conductivity of electric diodes, as opposed to the usual analogy of resistor networks for a simple fluid flowing through porous media. While future experiments are necessary to fully discern the effects of magnetic field strength and porous microstructure, the pore-scale trapping of directed, swimming microbes observed here carries clear implications for microbial ecology and evolution. For magnetotactic bacteria, localization in porous sediments23,24 may facilitate niche exploitation through increased residence time and thus the uptake of dissolved matter6. Moreover, these results inform potential control strategies for genetically engineered magnetotactic25,26 and synthetic microswimmer guidance45 in medical applications. We expect that our results are broadly applicable to other physical mechanisms of directed motility that rely on an aligning torque, including gyrotaxis8 for which the directed motility in heterogeneous turbulent flows also leads to the accumulation of organisms46. Sensory-based cell navigation is additionally complicated, for example in chemotaxis, by the coupling of the chemical landscape to fluid advection9,11,13,20. However, phototactic phytoplankton exhibit similar flow coupling behavior17 to magneto-18,33 and gyro-tactic16 microbes, suggesting that this observed nonlinear microbial transport mechanism is indeed widespread. Although the diode phenomenon illustrated here arises from single-cell motility, cell−cell interactions due to a local or global increase in cell concentration are expected to further enrich the nature of microbial transport under confinement47,48. Elucidating the impact of porous media flows on collective cell transport represents an exciting new avenue for this work.

## Methods

### Cell culturing

Magnetotactic bacteria (Magnetococcus marinus, MC-1) are cultivated in standard agarose gels within a chemically imposed oxygen gradient, using well-established protocols35. A stock solution of artificial sea water (16.4 g/l of NaCl, 3.5 g/l of MgCl2, 2.8 g/l of Na2SO4, 0.5 g/l of KCl, 1 g/l of CaCl2) is prepared in a 1 l glass bottle. 100 ml is sampled from this stock solution, to which the following are added: 0.2 g of HEPES, 0.03 g of NH4Cl, 0.5 μl of Wolfe mineral solution, 80 μl of 0.5% resazurin solution, and 300 μl of 0.01 M FeS04 solution. The solution is completed with 180 μl of 0.5 M phosphate buffer (pH 6.8) and 0.16 g of agarose. Separately, 1 g of sodium bicarbonate is inserted into a tightly screwed glass tube. Both the 100 ml solution and the sodium bicarbonate tube are autoclaved. The solution is cooled to 60 C, and 560 μl of a 20% sodium thiosulfate solution, 40 mg of fresh cysteine, and 280 μl of a 10% sodium bicarbonate solution are added. Before gelation, the solution is poured into a 16 ml glass test tube, leaving 1 cm of air space, and capped. An oxygen gradient forms via diffusion and is visualized by the presence of resazurin. Cells grow at the oxic−anoxic transition zone (OATZ), where they form a heterogeneous growth front. After three days of growth, ≈1 μl of cells is sampled from the front via pipette and deposited at the microfluidic channel inlet. Cells are then directed into the corrugated microchannel via an applied magnetic field. These conditions result in a dilute cell concentration of ~106 cells/ml, which enables the tracking of individual cells. Motility media, which is a liquid version of the growth media (without agarose, sodium bicarbonate, and cysteine), was used for flow experiments.

### Microfluidics

Microfluidic channels were fabricated from polydimethylsiloxane (PDMS) using standard soft lithography techniques and plasma bonded to standard 1 mm glass slides. The flow speed in the channels (0 ≤ Umax ≤300 μm/s ± 2 μm/s) is regulated using a precision pressure controller (Elveflow OB-1), where the dynamic range (0 ≤ P ≤ 150 mbar) is set by an additional resistor channel (Supplementary Fig. 1) and calibrated for each channel geometry (Supplementary Fig. 2). Microfluidic packed beds were formed by jamming a suspension of crosslinked agarose hydrogel beads (Agarose Bead Technologies) in a straight microfluidic channel having a constriction at one end (0.4−0.44, estimated porosity). For each experiment, the motility media is injected at one end of the channel, and the cells are magnetically guided upstream through the channel from the open outlet.

### Video microscopy and cell tracking

Cells were imaged using phase-contrast microscopy (10×, 0.3 NA; Nikon Ti-e), and videos of cell motility (≥400 frames each) were captured (Andor Zyla camera) at frame rates ≥30 frames/s. Cells were tracked using a predictive particle tracking algorithm implemented in a custom MATLAB code9. Cell trajectories lasting more than ≥0.3 s were analyzed, and cell speeds were obtained using a Savitsky−Golay filter over five video frames.

### Flow field measurement

Flow fields (Fig. 1c) in the corrugated channels are measured by particle tracking velocimetry (PTV). Following cell motility experiments, cells were washed from the channel, and a dilute suspension of fluorescent tracer particles (0.5 μm diameter; Invitrogen) was introduced into the channel. Tracers were flowed at a range of applied pressures (Supplementary Fig. 2) and imaged using fluorescence microscopy (10×, 0.30 NA objective). Measured particle velocities (2000 frames per applied pressure condition) were binned in a regular grid to obtain the velocity field.

### Langevin simulations

A Langevin model of swimming MTB9,18,39 was constructed by considering the forces and torques (Fig. 1b) acting upon on a single cell resulting in translational and rotational dynamics. For each geometry (1D corrugated channels and 2D porous structures) and flow condition, individual bacterial trajectories were computed numerically by solving the stochastic equations of motion in the plane:

$$\dot{x}={V}_{s}\cos \theta +u(x,y)$$
(1)
$$\dot{y}={V}_{s}\sin \theta +v(x,y)$$
(2)
$$\dot{\theta }=\frac{\omega (x,y)}{2}+{\mu }_{r}MB\sin (\theta )+\sqrt{2{D}_{r}}\xi (t)$$
(3)

The translational dynamics of the cells are modeled by a superposition of swimming speed, Vs, and local fluid velocity, u and v. The orientational dynamics are governed by hydrodynamic rotation due to vorticity, ω, magnetic field alignment due to a magnetic torque, and rotational noise that encompasses Brownian rotational diffusion and flagellar-induced orientational fluctuations of the cells (Fig. 1b). The flow field, u and v, and vorticity, ω, are determined from finite element simulations in each geometry (Supplementary Information and Supplementary Fig. 2) and vetted by particle tracking velocimetry measurements (Fig. 1c). The ensemble average effective rotational diffusion coefficient of the cells, Dr = 0.25 ± 0.05 s−1, is measured from MTB swimming trajectories in the absence of both external flow and applied magnetic field (Supplementary Fig. 3). While the magnetic moment, M, and the hydrodynamic rotational mobility of the cells, μr, are not readily accessible individually, their product is easily obtained from cell tracking measurements in a calibrated magnetic field (Supplementary Fig. 3). The equations of motion are integrated by a fourth-order Runge-Kutta method. In the corrugated channels, the total dimensionless simulation time was set to τ = tVs/wt = 20,000 with a time step δτ = 0.005. In the 2D structures, the total dimensionless simulation time was set to τ = tVs/2R = 256, 5 times the necessary time for a cell to swim from one end to the other. Steric boundary conditions prevent cells from entering the solid surfaces in our simulations. A Weeks−Chandler−Andersen repulsive potential was implemented:

$${{{{{{{{\bf{F}}}}}}}}}_{W}({{{{{{{\bf{r}}}}}}}})=-\nabla {U}_{r}({{{{{{{\bf{r}}}}}}}})$$
(4)
$${U}_{r}(d)=\left\{\begin{array}{ll}4\epsilon \left[{\left(\frac{a}{d}\right)}^{1/6}-{\left(\frac{a}{d}\right)}^{1/12}\right]&+\epsilon ,d < {2}^{1/16}a\\ &0,d\ge {2}^{1/16}a\end{array}\right.$$
(5)

where d is the distance to the closest solid surface, a is the bacterial radius, and ϵ is the hardness (see Supplementary Information for details).

### Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.

## Data availability

The figure source data files generated in this study have been deposited in the Harvard Dataverse database https://doi.org/10.7910/DVN/YR7CPE. The raw experimental data (cell trajectories in time) and simulation data are available from the corresponding authors upon reasonable request.

## Code availability

The codes associated with source data generated in this study have been deposited in the Harvard Dataverse database https://doi.org/10.7910/DVN/YR7CPE. All other codes used in this study are available from the corresponding authors upon reasonable request.

## References

1. 1.

Uppaluri, S. et al. Flow loading induces oscillatory trajectories in a bloodstream parasite. Biophys. J. 103, 1162–1169 (2012).

2. 2.

Pandey, P. K., Kass, P. H., Soupir, M. L., Biswas, S. & Singh, V. P. Contamination of water resources by pathogenic bacteria. AMB Express 4, 51 (2014).

3. 3.

Hall-Stoodley, L., Costerton, J. W. & Stoodley, P. Bacterial biofilms: from the natural environment to infectious diseases. Nat. Rev. Microbiol. 2, 95–108 (2004).

4. 4.

Berg, H. C. & Brown, D. A. et al. Chemotaxis in Escherichia coli analysed by three-dimensional tracking. Nature 239, 500–504 (1972).

5. 5.

Tsang, A. C., Lam, A. T. & Riedel-Kruse, I. H. Polygonal motion and adaptable phototaxis via flagellar beat switching in the microswimmer euglena gracilis. Nat. Phys. 14, 1216–1222 (2018).

6. 6.

Stocker, R. Marine microbes see a sea of gradients. Science 338, 628–633 (2012).

7. 7.

Blakemore, R. Magnetotactic bacteria. Science 190, 377–379 (1975).

8. 8.

Durham, W. M., Kessler, J. O. & Stocker, R. Disruption of vertical motility by shear triggers formation of thin phytoplankton layers. Science 323, 1067–1070 (2009).

9. 9.

Rusconi, R., Guasto, J. S. & Stocker, R. Bacterial transport suppressed by fluid shear. Nat. Phys. 10, 212–217 (2014).

10. 10.

Ford, R. M. & Harvey, R. W. Role of chemotaxis in the transport of bacteria through saturated porous media. Adv. Water Resour. 30, 1608–1617 (2007).

11. 11.

Bearon, R. & Pedley, T. Modelling run-and-tumble chemotaxis in a shear flow. Bull. Math. Biol. 62, 775 (2000).

12. 12.

Coyte, K. Z., Tabuteau, H., Gaffney, E. A., Foster, K. R. & Durham, W. M. Microbial competition in porous environments can select against rapid biofilm growth. Proc. Natl Acad. Sci. USA 114, E161–E170 (2017).

13. 13.

de Anna, P., Pahlavan, A. A., Yawata, Y., Stocker, R. & Juanes, R. Chemotaxis under flow disorder shapes microbial dispersion in porous media. Nat. Phys. 17, 1−6 (2020).

14. 14.

Figueroa-Morales, N. et al. Living on the edge: transfer and traffic of e. coli in a confined flow. Soft Matter 11, 6284–6293 (2015).

15. 15.

Bechinger, C. et al. Active particles in complex and crowded environments. Rev. Mod. Phys. 88, 045006 (2016).

16. 16.

Kessler, J. O. Hydrodynamic focusing of motile algal cells. Nature 313, 218–220 (1985).

17. 17.

Garcia, X., Rafaï, S. & Peyla, P. Light control of the flow of phototactic microswimmer suspensions. Phys. Rev. Lett. 110, 138106 (2013).

18. 18.

Waisbord, N., Lefèvre, C. T., Bocquet, L., Ybert, C. & Cottin-Bizonne, C. Destabilization of a flow focused suspension of magnetotactic bacteria. Phys. Rev. Fluids 1, 053203 (2016).

19. 19.

Dehkharghani, A., Waisbord, N., Dunkel, J. & Guasto, J. S. Bacterial scattering in microfluidic crystal flows reveals giant active Taylor–Aris dispersion. Proc. Natl Acad. Sci. USA 116, 11119–11124 (2019).

20. 20.

Adadevoh, J. S., Ramsburg, C. A. & Ford, R. M. Chemotaxis increases the retention of bacteria in porous media with residual napl entrapment. Environ. Sci. Technol. 52, 7289–7295 (2018).

21. 21.

Smith, P. et al. Biogeochemical cycles and biodiversity as key drivers of ecosystem services provided by soils. Soil Discuss. 2, 537–586 (2015).

22. 22.

Tufenkji, N. Modeling microbial transport in porous media: traditional approaches and recent developments. Adv. Water Resour. 30, 1455–1469 (2007).

23. 23.

Lefèvre, C. T. & Bazylinski, D. A. Ecology, diversity, and evolution of magnetotactic bacteria. Microbiol. Mol. Biol. Rev. 77, 497–526 (2013).

24. 24.

Fassbinder, J. W., Stanjekt, H. & Vali, H. Occurrence of magnetic bacteria in soil. Nature 343, 161–163 (1990).

25. 25.

Kolinko, I. et al. Biosynthesis of magnetic nanostructures in a foreign organism by transfer of bacterial magnetosome gene clusters. Nat. Nanotechnol. 9, 193–197 (2014).

26. 26.

Felfoul, O. et al. Magneto-aerotactic bacteria deliver drug-containing nanoliposomes to tumour hypoxic regions. Nat. Nanotechnol. 11, 941–947 (2016).

27. 27.

Braun, F. Ueber die stromleitung durch schwefelmetalle. Ann. Phys. 229, 556–563 (1875).

28. 28.

Darcy, H. Les Fontaines Publiques de la Ville de Dijon (Dalmont, 1856).

29. 29.

Bear, J. Dynamics of Fluids in Porous Media (American Elsevier Publishing Company, 1972).

30. 30.

Aminpour, M., Galindo-Torres, S., Scheuermann, A. & Li, L. Pore-scale behavior of Darcy flow in static and dynamic porous media. Phys. Rev. Appl. 9, 064025 (2018).

31. 31.

Alim, K., Parsa, S., Weitz, D. A. & Brenner, M. P. Local pore size correlations determine flow distributions in porous media. Phys. Rev. Lett. 119, 144501 (2017).

32. 32.

Lester, D., Metcalfe, G. & Trefry, M. Is chaotic advection inherent to porous media flow? Phys. Rev. Lett. 111, 174101 (2013).

33. 33.

Meng, F., Matsunaga, D. & Golestanian, R. Clustering of magnetic swimmers in a poiseuille flow. Phys. Rev. Lett. 120, 188101 (2018).

34. 34.

Taylor, G. I. Dispersion of soluble matter in solvent flowing slowly through a tube. Proc. R. Soc. Lond. A 219, 186–203 (1953).

35. 35.

Meldrum, F. C., Mann, S., Heywood, B. R., Frankel, R. B. & Bazylinski, D. A. Electron microscopy study of magnetosomes in a cultured coccoid magnetotactic bacterium. Proc. R. Soc. Lond. B 251, 231–236 (1993).

36. 36.

Drescher, K., Dunkel, J., Cisneros, L. H., Ganguly, S. & Goldstein, R. E. Fluid dynamics and noise in bacterial cell−cell and cell-surface scattering. Proc. Natl. Acad. Sci. USA 108, 10940–5 (2011).

37. 37.

Yang, X. et al. Hydrodynamic and entropic effects on colloidal diffusion in corrugated channels. Proc. Natl Acad. Sci. USA 114, 9564–9569 (2017).

38. 38.

Mangeat, M., Guérin, T. & Dean, D. S. Geometry controlled dispersion in periodic corrugated channels. Europhys. Lett. 118, 40004 (2017).

39. 39.

Zöttl, A. & Stark, H. Nonlinear dynamics of a microswimmer in poiseuille flow. Phys. Rev. Lett. 108, 218104 (2012).

40. 40.

Fatt, I. et al. The network model of porous media. AIME Petroleum Trans. 207, 144–181 (1956).

41. 41.

Stevik, T. K., Aa, K., Ausland, G. & Hanssen, J. F. Retention and removal of pathogenic bacteria in wastewater percolating through porous media: a review. Water Res. 38, 1355–1367 (2004).

42. 42.

Katz, A. J. & Thompson, A. H. Fractal sandstone pores: implications for conductivity and pore formation. Phys. Rev. Lett. 54, 1325–1328 (1985).

43. 43.

Reimann, P. et al. Giant acceleration of free diffusion by use of tilted periodic potentials. Phys. Rev. Lett. 87, 010602 (2001).

44. 44.

Lee, S.-H. & Grier, D. G. Giant colloidal diffusivity on corrugated optical vortices. Phys. Rev. Lett 96, 190601 (2006).

45. 45.

Palagi, S. & Fischer, P. Bioinspired microrobots. Nat. Rev. Mater. 3, 113–124 (2018).

46. 46.

De Lillo, F. et al. Turbulent fluid acceleration generates clusters of gyrotactic microorganisms. Phys. Rev. Lett. 112, 044502 (2014).

47. 47.

Wioland, H., Woodhouse, F. G., Dunkel, J. & Goldstein, R. E. Ferromagnetic and antiferromagnetic order in bacterial vortex lattices. Nat. Phys. 12, 341–345 (2016).

48. 48.

Secchi, E. et al. Intermittent turbulence in flowing bacterial suspensions. J. R. Soc. Interface 13, 20160175 (2016).

## Acknowledgements

We thank C. Lefevre for providing magnetotactic bacteria, and J. Dunkel and D. M. Walkama for useful discussions. This work was supported by National Science Foundation awards (to J.S.G.) CBET-1511340, CAREER-1554095, CBET-1701392, and OCE-1829827.

## Author information

Authors

### Contributions

N.W. and J.S.G. designed the research. N.W. performed the experiments and analyzed the experimental data. N.W. and A.D. performed the simulations and analyzed the numerical data. N.W. and J.S.G. wrote the paper.

### Corresponding authors

Correspondence to Nicolas Waisbord or Jeffrey S. Guasto.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

Peer review informationNature Communications thanks the anonymous reviewer(s) for their contribution to the peer review of this work.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Waisbord, N., Dehkharghani, A. & Guasto, J.S. Fluidic bacterial diodes rectify magnetotactic cell motility in porous environments. Nat Commun 12, 5949 (2021). https://doi.org/10.1038/s41467-021-26235-6