Introduction

Flow interactions are thought to allow flying and swimming animals to derive energetic benefits when moving in groups [1]. However, direct assessment of such benefits is challenging, chiefly because animal groups do not generally conform to regular patterns – individuals in these groups dynamically change their position relative to their neighbors [26]. Also, because direct energetic measurements in moving animals, flying or swimming, are notoriously difficult and often unreliable as proxy for hydrodynamic energy savings [4, 713]. These difficulties hinder a direct mapping from the spatial pattern of the group to the energetic benefits or costs incurred at each position within the group.

An understanding of how the spatial arrangement of individuals within a group influences their cost of locomotion can provide insights into the evolution of social structures, resource allocation, and overall fitness of each individual in cooperative activities such as foraging, mating, and evasion [1420]. It could also guide the design of bio-inspired engineering systems and algorithms that steer groups of entities, such as swarms of autonomous robotic vehicles, underwater or in flight, that collaborate to achieve a desired task while minimizing energy consumption and improving the overall system efficiency [2125].

To understand the potential energetic benefits of group movement, various direct and indirect ap-proaches have been employed. Li et al. [9] associated energy savings in pairs of flapping robotic swim-mers with a linear relationship between their flapping phase lag and relative distance. Based on this, a strategy, called Vortex Phase Matching, was extrapolated for how fish should behave to maximize hydrodynamic benefits: a follower fish should match its tailbeat phase with the local vorticity created by a leader fish. Pairs of freely swimming fish seemed to follow this linear phase-distance relationship even with impaired vision and lateral line sensing, that is, in the absence of sensory cues about their relative position and neighbor-generated flows. Interestingly, the same linear phase-distance relation-ship was uncovered independently in flapping hydrofoils and accredited solely to flow interactions [2628]. It is therefore unclear whether vortex phase matching is an active strategy, mediated by sensing and feedback control, that fish employ to minimize energy expenditure, or if it arises passively through flow interactions between flapping swimmers. Importantly, active or passive, it is unclear if this strategy scales to groups larger than two.

In an effort to directly gauge the energetic benefits of schooling, metabolic energetic measure-ments were recently performed in solitary and groups of eight fish, and impressive energetic savings were attributed to schooling compared to solitary swimming when the fish were challenged to swim at high speeds [12]. Lamentably, the study made no mention of the spatial patterns assumed by these physically-thwarted individuals [12]. In an independent previous study [5], changes in spatial patterns and tailbeat frequencies were reported in similar experiments, albeit with no energetic measurements. Specifically, [5] showed that, when challenged to sustain higher swimming speeds, the fish in a group rearranged themselves in a side-by-side pattern as the speed increased, presumably to save energy.

Taking together the results of [5, 12], are we to conclude that side-by-side formations are more energetically beneficial than, say, inline or diagonal formations? The answer is not simple! The metabolic measurements of [4] in a school of eight fish report that side-by-side formations, though beneficial, produce the least energetic savings compared to diagonal formations [1]. In an experimental study of a single fish interacting with a robotic flapping foil, the freely-swimming fish positioned itself in an inline formation in the wake of the flapping foil, supporting the hypothesis that swimming in the wake of one another is an advantageous strategy to save energy in a school [11]. Why did the fish in the experiments of [5] self-organize in a side-by-side formation when challenged to swim at higher swimming speeds?

The answer is not simple because ample hydrodynamic mechanisms for energy savings in fish schools have been stipulated for each possible configuration – side-by-side, inline and diagonal (see, e.g., Fig. 1 of [12]) – but no assessment is provided of the relative advantage of these configurations. For example, side-by-side formations, where fish mirror each other by flapping antiphase, are thought to create a wall-like effect that reduces swimming cost [12, 29]. A fish swimming in the wake between two leading fish encounters a reduced oncoming velocity, leading to reduced drag and thrust production [1]. Inline formations, where fish swim in tandem, are thought to provide benefits to both leader and follower, by an added mass push from follower to leader [29, 30] and a reduced pressure on the follower [31]. All of these mechanisms can in principle be exploited by schooling fish as they dynamically change their relative spacing in the group. But are these mechanisms equally advantageous? Or is there a hierarchy of hydrodynamic benefits depending on the relative position within the school? The literature offers no comparative analysis of the energetic savings afforded by each of these configurations.

Flow-coupled swimmers self-organize into stable pairwise formations

A. inline ( = 0, ϕ = π/2), B. diagonal ( = L/2, ϕ = 0), C. inphase side-by-side ( = L/2, ϕ = 0) and D. antiphase side-by-side ( = L/2, ϕ = π) in CFD (left) and VS (right) simulations. Power savings at steady state relative to respective solitary swimmers are reported in Fig. 3. Parameter values are A = 15, Re=2πρAf L/µ = 1645 in CFD, and diss = 2.45 in VS simulations. Corresponding hydrodynamic moments are given in Fig. 1.S4. Simulations at different Reynolds numbers and dissipation times are given in Figs. 1.S1, 1.S2 and 1.S3.

The study of [4] is arguably the closest to addressing this question, but, to map the energetic ben-efits for pairwise configurations, the authors employed statistical averages in a school of eight fish, thus inevitably combining the various hydrodynamic mechanisms at play and cross-polluting the estimated benefits of each configuration. A cleaner analysis in pairs of flapping foils shows that these relative positions – side-by-side, inline, and diagonal – all emerge spontaneously and stably due to flow inter-actions [28], but provides no method for estimating the energetic requirements of these formations, let alone comparing them energetically. Even vortex phase matching makes no distinction between side-by-side, inline, or diagonal pairs of fish [9]. It simply postulates that an unknown amount of energetic benefit is acquired when the linear phase-distance relationship is satisfied. Thus, to date, despite the widespread notion that group movement saves energy, a direct comparison of the energetic savings afforded by different spatial formations remains lacking. Importantly, it is unknown whether and how the postulated benefits scale with increasing group size.

Here, to circumvent the challenges of addressing these questions in biological systems, we formu-late computational models that capture the salient hydrodynamic features of single and pairs of swim-ming fish. Namely, we represent each fish as a freely-swimming hydrofoil undergoing pitching oscil-lations about its leading edge. A single flapping hydrofoil shares many hydrodynamic aspects with its biological counterpart, including an alternating, long-lived pattern of vorticity in its wake [3236]. These similarities have been demonstrated repeatedly, within biologically relevant ranges of flapping parame-ters [32, 37], for different geometries [3841], material properties [4143], and flapping kinematics [4446]. In this study, we show, based on our own simulations and by conducting a thorough literature survey, that flow interactions, with no sensing and feedback control, lead to emergent formations that preserve the linear phase-distance relationship uncovered independently in live and robotic fish [9, 11] and in flapping hydrofoils [2628]. This relationship is preserved irrespective of geometry [27, 28, 47], material properties [26, 4850], and flapping kinematics [51, 52]. The universality of this relationship serves as strong validation of our models and anchors our subsequent exploration of the opportunities for hydrodynamic benefits available in a given flow field.

Importantly, we go beyond two swimmers to investigate flow interactions in larger groups and find that inline formations differentially distribute hydrodynamic savings to members within the school, favoring trailing swimmers, but only up to a certain school size, while side-by-side formations equally distribute hydrodynamic savings and scale to arbitrary number of swimmers without loss of cohesion. Our findings provide a direct mapping from the school’s spatial pattern to the energetic savings experienced by its members. Importantly, our results raise an interesting hypothesis that the dynamic repositioning of members within a fish school could be driven by greed and competition to occupy hydrodynamically advantageous positions and open up opportunities for analyzing the role of flow physics in the evolution of cooperative versus greedy behavior in animal groups.

Results

Mathematical models of flow-coupled flapping swimmers

Inspired by the experiments of [9, 27], we study self-organization in the context of flapping swimmers, coupled passively via the fluid medium, with no mechanisms for visual [5357], flow sensing [5861], or feedback control [24, 62, 63] (Fig. 1). The swimmers are rigid, of finite body length L and mass per unit depth m, and undergo pitching oscillations of identical amplitude A and frequency f in the (x, y)-plane of motion, such that the pitching angle for swimmer j is given by θj = A sin(2πft + ϕj), j = 1, 2, . . . , N, where N is the total number of swimmers. In pairwise interaction, we set ϕ1 = 0 and ϕ2 = −ϕ, with ϕ being the phase lag between the oscillating pair. We fixed the lateral distance between the swimmers to lie in the range ℓ ∈ [−L, L], and allowed the swimmers to move freely in the x-direction in an unbounded two-dimensional fluid domain of density ρ and viscosity µ.

When unconstrained, the swimmers may drift laterally relative to each other, as illustrated in dipole models [64, 65] and high-fidelity simulations of undulating swimmers [62, 66]. However, this drift oc-curs at a slower time scale than the swimming motion, and can, in principle, be corrected by separate feedback control mechanisms [67]. Here, we focus on the dynamics in the swimming direction.

Hereafter, all parameters are scaled using the body length L as the characteristic length scale, flapping period T = 1/f as the characteristic time scale, and ρL2 as the characteristic mass per unit depth. Accordingly, velocities are scaled by Lf, forces by ρf 2L3, moments by ρf 2L4, and power by ρf 3L4.

The equations governing the free motion xj(t) of swimmer j are given by Newton’s second law (here, the downstream direction is positive),

The hydrodynamic forces on swimmer j are decomposed into a pressure force Fj acting in the direction normal to the swimmer and a viscous drag force Dj acting tangentially to the swimmer. These forces depend on the fluid motion, which, in turn, depends on the time history of the states of the swimmers. To maintain their pitching motions, swimmers exert an active moment Ma about the leading edge, whose value is obtained from the balance of angular momentum. The hydrodynamic power P expended by a flapping swimmer is given by P = Ma.

To compute the hydrodynamic forces and swimmers’ motion, we used two fluid models (Figs. 1, 1.S1, 1.S2 and 1.S3). First, we employed a computational fluid dynamics (CFD) solver of the Navier-Stokes equations tailored to resolving fluid-structure interactions (FSI) based on an adaptive mesh implemen-tation of the immersed boundary method [6870]. Then, we solved the same FSI problem, in the limit of thin swimmers, using the more computationally-efficient inviscid vortex sheet (VS) model [51, 7174]. To emulate the effect of viscosity in the VS model, we allowed shed vorticity to decay after a dissipation time τdiss; larger τdiss correlates with larger Reynolds number Re in the Navier-Stokes model; see SI for a brief overview of the numerical implementation and validation of both methods.

Flow coupling leads to stable emergent formations

We found, in both CFD and VS models, that pairs of swimmers self-organize into relative equilibria at a streamwise separation distance d that is constant on average, and swim together as a single formation at an average free-swimming speed U (Figs. 1 and 2). We distinguished four types of relative equilibria: inline, diagonal, side-by-side inphase and side-by-side antiphase (Fig. 1).

Emergent equilibria in pairwise formations

A. Time evolution of scaled streamwise separa-tion distance d/UT for a pair of inline swimmers at ϕ = 0. Depending on initial conditions, the swimmers converge to one of two equilibria at distinct separation distance. B. At = L/2, d/UT changes slightly compared to inline swimming in panel A. Importantly, a new side-by-side inphase equilibrium is now possible where the swimmers flap together at a slight shift in the streamwise direction. C. Starting from the first equilibrium in panel A, d/UT increases linearly as we increase the phase lag ϕ between the swimmers.

Inline formations at = 0 arise when the follower positions itself, depending on its initial distance from the leader, at one of many inline equilibria, each with its own basin of attraction (Fig. 2A). These inline equilibria occur at average spacing d that is approximately an integer multiple of UT, consistent with previous experimental [27, 47, 75] and numerical [26, 4951, 76, 77] findings.

When offsetting the swimmers laterally at ≠ 0 (Fig. 2B), the leader-follower equilibria that arise at = 0 shift slightly but persist, giving rise to diagonal leader-follower equilibria [28]. Importantly, at a lateral offset , inphase swimmers (ϕ = 0) that are initially placed side-by-side reach a relative equilibrium where they travel together at a close, but non-zero, average spacing d ≤ L. That is, a perfect side-by-side configuration of inphase flapping swimmers is unstable but the more commonly-observed configuration [9] where the two swimmers are slightly shifted relative to each other is stable. This configuration is fundamentally distinct in terms of cost of transport from the mirror-symmetric side-by-side configuration that arises when flapping antiphase at ϕ = π (Fig.3A). Both side-by-side equilibria were observed experimentally in heaving hydrofoils [28], albeit with no assessment of the associated hydrodynamic power and cost of transport.

Hydrodynamic benefits and linear phase-distance relationship in pairs of swimmers

A. change in cost of transport compared to solitary swimmers for the inline, diagonal, side-by-side inphase and side-by-side antiphase formations shown in Fig. 1. B. Emergent formations in pairs of swimmers in CFD and VS models satisfy a linear phase-distance relationship, consistent with experimental [9, 11, 27, 47, 52] and numerical [4851] studies. With the exception of the antiphase side-by-side formation, swimmers in these formations have a reduced average cost of transport compared to solitary swimming.

We next examined the effect of varying the phase ϕ on the emergent traveling formations. Starting from initial conditions so as to settle on the first equilibrium d/UT ≈ 1 when ϕ = 0, and increasing ϕ, we found, in both CFD and VS simulations, that the spacing d/UT at equilibrium increased with increasing ϕ (Fig. 2C). This increase is linear, as evident when plotting d/UT as a function of ϕ (Fig. 3B). Indeed, in Fig. 3B, we plotted the emergent average separation distance d/UT as a function of ϕ for various values of . Except for the antiphase side-by-side formation, the linear phase-distance relationship ϕ/2πd/UT persisted for ≠ 0.

The key observation, that pairs of flapping swimmers passively self-organize into equilibrium forma-tions, is independent of both scale and fluid model. In our CFD simulations (Fig. 1.S1 and 1.S3), we tested a range of Reynolds number Re = ρUL/µ from 200 to 2000, which covers the entire range of exist-ing CFD simulations [50, 75], where Re ∼ O(102), and experiments [27, 28, 75], where Re ∼ O(103). In our VS simulations, we varied τdiss from 2.45T to (Figs. 1.S2 and 1.S3). Note that the separation dis-tance d is scale-specific and increases with Re; at low Re, a compact inline formation is reached where the two swimmers “tailgate” each other, as observed in [49]. However, the scaled separation distance d/UT remains nearly constant for all Re and τdiss (Fig. 1.S3).

The fact that these equilibria emerge in time-forward simulations is indicative of stability [78]. A more quantitative measure of linear stability can be obtained numerically by perturbing each equilibrium, ei-ther by applying a small impulsive or step force after steady state is reached [28] or by directly applying a small perturbation to the relative equilibrium distance between the two swimmers and examining the time evolution of d and F to quantify variations in hydrodynamic force δF as a function of signed variations in distance δd from the equilibrium [51]. In either case, we found that the force-displacement response to small perturbations at each equilibrium exhibited the basic features of a linear spring-mass system, where δF/δd is negative, indicating that the hydrodynamic force acts locally as a restoring spring force that causes the initial perturbation to decay and that stabilizes the two swimmers together at their equilib-rium relative position. Larger values of |δF/δd| imply faster linear convergence to the stable equilibrium and thus stronger cohesion of the pairwise formation. Results of this quantitative stability analysis are discussed in subsequent sections.

Emergent formations save energy compared to solitary swimming

We evaluated the hydrodynamic advantages associated with these emergent formations by computing the hydrodynamic power Psingle of a solitary swimmer and Pj of swimmer j in a formation of N swimmers. We calculated the cost of transport COTj = Pj/mU, of swimmer j and the change in COT compared to solitary swimming ΔCOTj = (COTsingle COTj)/COTsingle (Fig. 3A). We also calculated the average change in cost of transport for each formation (Fig. 3B). In all cases, except for the antiphase side-by-side formation, in both CFD and VS simulations, the swimmers traveling in equilibrium formations save power and cost of transport compared to solitary swimming. The savings are larger at tighter lateral spacing .

For inline and diagonal formations, these hydrodynamic benefits are granted entirely to the follower, whose hydrodynamic savings can be as high as 60% compared to solitary swimming (Fig. 3A) [51]. In-tuitively, because in 2D flows, vortex-induced forces decay with the inverse of the square of the distance from the vortex location, flow coupling between the two inline or diagonal swimmers is non-reciprocal; the follower positioned in or close to the leader’s wake interacts more strongly with that wake than the leader interaction with the follower’s wake (Figs. 1A, B and 1.S4A, B).

In side-by-side formations, by symmetry, flow coupling between the two swimmers is reciprocal, or nearly reciprocal in inphase flapping (Figs. 1C, D and 1.S4C, D). Thus, hydrodynamics benefits or costs are expected to be distributed equally between the two swimmers. Indeed, for inphase flapping, the hydrodynamic benefits are shared equally between both swimmers. For antiphase flapping the cost is also shared equally (Fig. 3A).

The biased distribution of benefits in favor of the follower in inline and diagonal formations could be a contributing factor to the dynamic nature of fish schools [3, 6]. The egalitarian distribution of benefits in the inphase side-by-side formation could explain the abundance of this pairwise configuration in natural fish populations [9] and why groups of fish favor this configuration when challenged to swim at higher speeds [5, 57].

Linear phase-distance relationship in emergent formations is uni-versal

To probe the universality of the linear phase-distance relationship, we compiled, in addition to our CFD and VS results, a set of experimental [9, 27, 47] and numerical [4852] data from the literature (Table S.1 and Suppl. Excel Table). Data including CFD simulations of deformable flapping flags (☆) [48], (□) [26] and flexible airfoil with low aspect ratio (▷) [50], physical experiments with heaving (○) [27, 47] and pitching (▽) [52] rigid hydrofoils, fish-foil interactions (∗) [11], and fish-fish interactions (△) measured in pairs of both intact and visually-and/or lateral line-impaired live fish [9] are superimposed on Fig. 3B. All data collapsed onto the linear phase-distance relationship ϕ/2πd/UT, with the largest variability exhibited by live fish with close streamwise distance, where the interaction between fish bodies may play a role. The side-by-side inphase formations trivially satisfy this linearity because d/UT ≈ ϕ/2π = 0, but the side-by-side antiphase formations don’t satisfy; in the latter, d/UT = 0 while ϕ/2π = 1.

These findings strongly indicate that flow-coupled flapping swimmers passively organize into stable traveling equilibrium formations with linear phase-distance relationship. This relationship is independent of the geometric layout (inline versus laterally-offset swimmers), flapping kinematics (heaving versus pitching), material properties (rigid versus flexible), tank geometry (rotational versus translational), fi-delity of the fluid model (CFD versus VS versus particle model), and system (biological versus robotic, 2D versus 3D). Observations that are robust across such a broad range of systems are expected to have common physical and mechanistic roots that transcend the particular set-up or system realization.

Importantly, this universal relationship indicates that flow physics passively positions a swimmer at locations d where the swimmer’s flapping phase ϕ matches the local phase of the wake ϕwake = 2πd/UT, such that the effective phase ϕeff = ϕ − ϕwake is zero. Importantly, because the quantity UT is nearly equal to the wavelength of the wake of a solitary swimmer, the phase ϕwake = 2πd/UT is practically equal to the phase of a solitary leader. These observations have two major implications. First, they are consistent with the vortex phase matching introduced in [9] as a strategy by which fish maximize hydrodynamic benefits. However, they proffer that vortex phase matching is an outcome of passive flow interactions among flapping swimmers, and not necessarily an active strategy implemented by fish via sensing and feedback mechanisms. Second, they led us to hypothesize that emergent side-by-side formations can be predicted from symmetry arguments, while emergent inline and diagonal formations can be predicted entirely from kinematic considerations of the leader’s wake without considering two-way flow coupling between the two swimmers.

Leader’s wake unveils opportunities for stable emergent formations

To challenge our hypothesis that the leader’s wake contains information about the emergent pairwise equilibria, we examined the wake of a solitary swimmer in CFD and VS simulations (Fig. 4A, B). By ana-lyzing the wake of a solitary swimmer, without consideration of two-way coupling with a trailing swimmer, we aimed to assess the opportunities available in that wake for a potential swimmer, undergoing flapping motions, to position itself passively in the oncoming wake and extract hydrodynamic benefit.

Predictions of equilibrium formations from the wake of a solitary swimmer

A, B. Snap-shots of vorticity and fluid velocity fields created by a solitary swimmer in CFD and VS simulations and corresponding flow agreement parameter 𝕍 fields for a virtual follower at ϕ = 0. Locations of maximum 𝕍-values (i.e., peaks in the flow agreement parameter field) coincide with the emergent equilibria in inphase pairwise formations (indicated by black circles). Contour lines represent flow agreement pa-rameter at ±0.25, ±0.5. Thrust parameter T is shown at = 0 and = 0.5L. A negative slope 𝕋/∂d indicates stability of the predicted equilibria. See also Figs. 1.S1 and 1.S2.

Therefore, in the following analysis, we treated the potential swimmer as a “virtual” particle located at a point (x, y) in the oncoming wake and undergoing prescribed transverse oscillations A sin(2πft− ϕ) in the y-direction, at velocity v(t; ϕ) = 2πAf cos(2πft − ϕ)ey, where ey is a unit vector in the y-direction.

The oncoming wake is blind to the existence of the virtual particle. Guided by our previous findings that stable equilibrium formations in pairwise interactions occur at zero effective phase ϕeff = ϕ − ϕwake = 0, where the net hydrodynamic force on the trailing swimmer is zero and where small perturbations lead to negative force gradients, we introduced two assessment tools: a flow agreement parameter field 𝕍(x, y; ϕ) that measures the degree of alignment, or matching, between the flapping motion of the virtual particle and the transverse flow of the oncoming wake, and a thrust parameter field 𝕋(x, y; ϕ) that estimates the potential thrust force required to undergo such flapping motions.

Specifically, inspired by [50] and following [51], we defined the flow agreement parameter 𝕍(x, y; ϕ) using , where t is chosen after the oncoming wake has reached steady state, normalized by (Sec. S.4). The normalized 𝕍(x, y; ϕ) describes how well the oscillatory motion v(t; ϕ) of the virtual particle matches the local transverse velocity u(x, y, t) of the oncoming wake [51]. Positive (negative) values of 𝕍 indicate that the flow at (x, y) is favorable (unfavorable) to the flapping motion of the virtual follower.

In Fig. 4A and B, we show 𝕍(x, y; ϕ = 0) as a field over the physical space (x, y) for ϕ = 0. Blue regions indicate where the local flow favors the follower’s flapping motion. In both CFD and VS simula-tions, the locations with the maximum flow agreement parameter closely coincide with the stable equi-libria (black circles) obtained from solving pairwise interactions. These findings imply that hydrodynamic coupling in pairs of flapping swimmers is primarily non-reciprocal – captured solely by consideration of the effects of the leader’s wake on the follower. This non-reciprocity allows one, in principle, to efficiently and quickly identify opportunities for hydrodynamic benefits in the leader’s wake, without the need to perform costly two-way coupled simulations and experiments.

Importantly, our findings suggest a simple rule for identifying the locations of stable equilibria in any oncoming wake from considerations of the flow field of the wake itself: a potential swimmer undergoing a flapping motion at phase ϕ tends to position itself at locations (x, y) of maximum flow agreement 𝕍(x, y; ϕ) between its flapping motion and the oncoming wake.

To verify this proposition, we show in Fig. 5A, as a function of phase ϕ, the streamwise locations of the local maxima of 𝕍(x, y; ϕ) computed based on the CFD and VS models, and scaled by UT, where U is the speed of the solitary swimmer. We superimpose onto these results the equilibrium configurations obtained from pairwise interactions in the context of the CFD (), VS (▪), and time-delay particle () models, where we modified the latter to account for non-zero lateral offset (Sec. S.3 and Fig. 5.S1). Predictions of the equilibrium configurations based on maximal flow agreement parameter agree re-markably well with actual equilibria based on pairwise interactions, and they all follow the universal linear phase-distance relationship shown in Fig. 2B.

Predictions of equilibrium locations, power savings, and cohesion, from the wake of a solitary leader

A. Location of maximum 𝕍 as a function of phase lag ϕ in the wake of solitary leaders in CFD and VS simulations. For comparison, equilibrium distances of pairwise simulations in CFD, VS and time-delay particle models (Fig. 5.S1) are superimposed. Agreement between 𝕍-based predictions and actual pairwise equilibria is remarkable. B. 𝕍 values also indicate the potential benefits of these equilibria, here shown as a function of lateral distance for a virtual inphase follower in the wake of a solitary leader in CFD and VS simulations. The power savings of an actual follower in pairwise formations in CFD and VS simulations are superimposed. C. A negative slope 𝕋/∂d of the thrust parameter 𝕋 indicates stability and |∂𝕋/∂d| expresses the degree of cohesion of the predicted formations, here, shown as a function of for an inphase virtual follower. |∂F/∂d| obtained from pairwise formations in VS and time-delay particle models are superimposed (Fig. 5.S1). Results in D. and E. are normalized by the corresponding maximum values to facilitate comparison.

The wake of a solitary swimmer contains additional information that allows us to evaluate the relative power savings of a potential follower and relative stability of the pairwise formation directly from the leader’s wake, without accounting for pairwise interactions. Assessment of the relative power savings follows directly from the maximal value of the flow agreement parameter: larger values imply more power savings and reduced cost of transport. To verify this, we calculated the maximal 𝕍(x, y; ϕ) in the wake of the solitary swimmer, where we expected the follower to position itself in pairwise interactions. In Fig. 5B, we plotted these 𝕍 values as a function of lateral distance for ϕ = 0. We superimposed the power savings ΔP based on pairwise interactions of inphase swimmers using the CFD and VS simulations and normalized all quantities by the maximal value of the corresponding model to highlight variations in these quantities as opposed to absolute values. Power savings are almost constant for ℓ < 0.25L, but decrease sharply as increases. This trend is consistent across all models, with the most pronounced drop in the CFD-based simulations because the corresponding velocity field u decays more sharply when moving laterally away from the swimmer.

Next, to assess the stability of the virtual particle based only on information in the oncoming wake of a solitary swimmer, we estimated the thrust force based on the fact that the thrust magnitude scales with the square of the swimmer’s lateral velocity relative to the surrounding fluid’s velocity [27, 32, 79]. We defined the thrust parameter field , normalized using . At the locations of the maxima of 𝕍(x, y; ϕ), a negative slope 𝕋/∂d of the thrust parameter is an indicator of linear stability or cohesion of the potential equilibria; that is, emergent pair-wise formations are expected to be stable if a small perturbation in distance about the locations (x, y) of maximal 𝕍 is accompanied by an opposite, restorative change in 𝕋. Indeed, in both CFD and VS wakes, 𝕋/∂d at (x, y) is negative (Fig. 4).

In Fig. 5C, we plotted |∂𝕋/∂d| as a function of lateral distance for ϕ = 0. We superimposed the magnitude of the eigenvalues |δF/δd| obtained from the linear stability analysis of pairwise interactions in inphase swimmers using the VS and time-delay particle models. As in Fig. 5B, all quantities are normalized by the maximal value of the corresponding model to highlight variations in these quantities as opposed to absolute values. Also, as in Fig. 5B, all models produce consistent results: pairwise cohesion is strongest for ℓ < 0.25L, but weakens sharply as increases, with the most pronounced drop in the CFD-based simulations.

A few comments on our virtual particle model and diagnostic tools in terms of the flow agreement and thrust parameters are in order. Our model differs from the minimal particle model used in [27, 75], which treated both swimmers as particles with minimal ‘wakes’ and considered two-way coupling between them (see Sec. S.3). In our analysis, the oncoming wake can be described to any desired degree of fidelity of the fluid model, including using experimentally constructed flows when available. Indeed, our flow agreement and thrust parameters are agnostic to how the flow field of the oncoming wake is constructed. Additionally, these diagnostic tools are equally applicable to any oncoming wake, not necessarily produced by a single swimmer, but say by multiple swimmers (as discussed later) or even non-swimming flow sources. Thus, the approach we developed here could be applied broadly to analyze, predict, and test opportunities for schooling and hydrodynamic benefits for live and robotic fish whenever measurements of an oncoming flow field are available.

Parametric analysis over the entire space of phase lags and lateral offsets

Having demonstrated consistency in the emergence of flow-mediated equilibria in both CFD and VS simulations, we next exploited the computational efficiency of the VS model to systematically investigate emergent pairwise formations over the entire space of phase lag ϕ ∈ [0, 2π) and lateral offset ℓ ∈ [−L, L], excluding side-by-side antiphase formations.

Equilibrium configurations are dense over the entire range of parameters: for any combination of phase lag ϕ and lateral offset , there exists an emergent equilibrium configuration where the pair of swimmers travel together at a separation distance d/UT (Fig. 6A). Perturbing one or both parameters, beyond the limits of linear stability, causes the swimmers to stably and smoothly transition to another equilibrium at different spacing d/UT. Importantly, increasing the phase lag ϕ shifts the equilibrium positions in the streamwise direction such that d/UT depends linearly on ϕ, but the effect of lateral distance for ℓ ≤ L is nonlinear and nearly negligible for small : increasing the lateral offset by an entire bodylength L changes the pairwise distance d/UT by about 15%. Our results explored emergent equilibria up to d/UT ≤ 2.5 and are consistent with the experimental findings in [28], which explored up to nine downstream equilibria.

Equilibria are dense over the parameter space

For any given phase lag ϕ and at any lateral offset inside the wake, the pair reach equilibrium formations that are stable and power saving relative to a solitary swimmer. A. Equilibrium separation distances, B. average power saving, and C. stability as a function of phase lag and lateral distance in a pair of swimmers. Predictions of D. equilibrium locations, E. hydrodynamic benefits, and F. cohesion based on the wake of a solitary swimmer following the approach in Figs. 4 and 5. For comparison, the contour lines from panels B and C based on pairwise interactions are superimposed onto panels E and F (white lines). Simulations in panels A-C are based pairwise interactions and Simulations in panels D-F are based on the wake of a single swimmer, all in the context of the vortex sheet model with A = 15, f = 1 and τdiss = 2.45T.

To assess the hydrodynamic advantages of these emergent formations, we calculated the average change in hydrodynamic power per swimmer. The pair saves power compared to solitary swimming (Fig. 6B). Power savings vary depending on phase lag ϕ and lateral distance : for the entire range of ϕ from 0 to 2π, the school consistently achieves over 20% power reduction, as long as the lateral offset is ℓ ≤ 0.25L. However, increasing from 0.25L to L reduces significantly the hydrodynamic benefit. That is, swimmers can take great liberty in changing their phase without compromising much the average energy savings of the school, as long as they maintain close lateral distance to their neighbor.

A calculation of the linear stability of each equilibrium in Fig. 6A shows that these emergent for-mations are linearly stable (Fig. 6C), and the degree of stability is largely insensitive to phase lag, with strongest cohesion achieved at lateral offset ℓ ≤ 0.25L. The results in Fig. 6A-C are constructed using pairwise interactions in VS simulations, but can be inferred directly from the wake of a solitary leader, as discussed in the previous section and shown in Fig. 6D-F.

Analysis of larger groups of inline and side-by-side swimmers

How do these insights scale to larger groups? To address this question, we systematically increased the number of swimmers and computed the emergent behavior in larger groups based on flow-coupled VS simulations.

In a group of six swimmers, all free to move in the streamwise x-direction, we found that the last three swimmers split and form a separate subgroup (Fig. 7A). In each subgroup, swimmer 3 experiences the largest hydrodynamic advantage (up to 120% power saving!), swimmer 2 receives benefits comparable to those it received in pairwise formation (65% power saving), and swimmer 1 no benefit at all (Fig. 7C).

We asked if loss of cohesion is dependent on the number of inline swimmers. To address this question, we gradually increased the number of swimmers from two to six (Fig. 7.S1). We found that in a school of three inline swimmers, flow interactions led to a stable emergent formation with hydrodynamic benefits similar to those experienced by the three swimmers in each subgroup of Fig. 7A and C. When computing the motion of four inline swimmers (Fig. 8A), we found that the leading three swimmers maintained cohesion, at hydrodynamic benefits similar to a formation of three, but swimmer 4 separated and lagged behind, receiving no advantage in terms of power savings because it split from the formation (Figs. 8D and 7.S1). In a group of five, the last two swimmers split and formed their own subgroup. That is, in all examples, swimmer 4 consistently lost hydrodynamic advantage and served as local leader of the trailing subgroup. These observations are consistent with [49] and demonstrate that flow interactions alone are insufficient to maintain inline formations as the group size increases.

Larger inline and side-by-side formations

A. Inline formations lose cohesion and split into two subgroups as depicted here for a group of six swimmers. B. Side-by-side formations remain cohesive. C. Power saving of each swimmer in inline and side-by-side formations. Dissipation time τdiss = 2.45T. Simulations of inline formations and side-by-side formations ranging from 2 to 6 swimmers are shown in Fig. 7.S1 and Fig. 7.S2.

Loss of cohesion in larger groups of inline swimmers

Number of swimmers that stay in cohesive formation depends on parameter values. A-C. For dissipation time τdiss = 2.45T, 3.45T and 4.45T, the 4th, 5th and 6th swimmers separate from the group, respectively. D. Power savings per swimmer in panels A-C, respectively. On average, all schools save equally in cost of transport, but the distribution of these savings vary significantly between swimmers. In all case, swimmer 3 receives the most hydrodynamic benefits.

We next explored the robustness of the side-by-side pattern to larger number of swimmers start-ing from side-by-side initial conditions (Fig. 7B). The swimmers reached stable side-by-side formations reminiscent of the configurations observed experimentally when fish were challenged to swim at higher swimming speeds [5]. The swimmers in this configuration saved power compared to solitary swimming (Fig. 7C): swimmers gained equally in terms of hydrodynamic advantage (up to 55% power saving for the middle swimmers in a school of six), except the two edge swimmers which benefited less. We tested these results by gradually increasing the number of swimmers from two to six (Fig. 7.S2). The robust-ness and overall trend of power saving among group members is robust to the total number of swimmers in these side-by-side formations.

Mechanisms leading to loss of cohesion in larger inline formations

To understand why three swimmers form a stable inline formation but four don’t, we extended the analysis in Fig. 4 to analyze the wake created behind two-swimmer (Fig. 9A) and three-swimmer (Fig. 9B) groups. Specifically, we computed pairwise interactions in a two-swimmer school and considered the combined wake of both swimmers after they had settled onto an equilibrium state. Similarly, we computed the behavior of a three-swimmer school and analyzed the combined wake at steady state. Compared to the single leader wake in Fig. 4B, in the wake of a two-swimmer school, positive flow agreement in the (blue) region is enlarged and enhanced, corresponding to swimmer 3 receiving the largest power savings. On the other hand, behind three inline swimmers, the region of positive flow agreement is weakened and shrunk, indicating weaker potential for energy saving by a fourth swimmer.

Prediction of equilibrium formations, cohesion, and power savings from the wake of upstream swimmers

A., B. Snapshots of vorticity fields created by two inline inphase swimmers, and three inline inphase swimmers. C., D. shows the corresponding flow agreement parameter 𝕍 fields. Contour lines represent flow agreement parameter at ±0.25, ±0.5. E., F. plots the corresponding period-averaged streamwise velocity. Separation distances d/UT predicted by the locations of maximal 𝕍 are marked by circles in the flow agreement field. In the left column, separation distances d/UT based on freely swimming triplets are marked by black circles and coincide with the locations of maximal 𝕍. In the right column, the orange marker shows the prediction of the location of a fourth swimmer based on the maximum flow agreement parameter. In two-way coupled simulation, swimmer 4 actually separates from the leading 3 swimmers as illustrated in Fig 8A. CFD simulation shows swimmer 4 will collide with swimmer 3 as in Fig. 9.S1. G., H. shows the transverse flow velocity in a period at the location predicted by the maximum flow agreement parameter and with a lateral offset = 0, 0.5L, L, in comparison to the follower’s tailbeat velocity.

Importantly, in the wake of the pairwise formation, the downstream jet is modest at the location of maximum 𝕍, where swimmer 3 is expected to position itself for hydrodynamic benefit, thus allowing swimmer 3 to reach this position and stay in formation (Fig. 9E). Also, at this location, the wake has a substantial transverse velocity u · ey (Fig. 9G), which aids thrust production at a diminished cost. In contrast, three inline swimmers generate a much stronger downstream jet at the location of maximum V where swimmer 4 is expected to position itself (Fig. 9F). This jet prevents swimmer 4 from stably staying in formation, and the transverse flow velocity u · ey is nearly zero for the entire flapping period (Fig. 9H) indicating little opportunity for exploiting the flow generated by the three upstream swimmers for thrust generation. This limitation is fundamental; it results from the flow physics that govern the wake generated by the upstream swimmers. There is not much that a trailing swimmer can do to extract hydrodynamic benefits from an oncoming flow field that does not offer any.

Critical size of inline formations beyond which cohesion is lost

We sought to understand what determines the critical group size, here three, beyond which inline for-mations lose cohesion and split into subgroups. Because we have established that the flow agreement parameter 𝕍 plays an important role in predicting emergent formations, we first examined 𝕍 in the wake of a pair of flapping swimmers in CFD (Fig. 1.S1) and VS (Fig. 1.S2) simulations. These results show that at lower Re and smaller dissipation time τdiss, the flow agreement parameter 𝕍 decays rapidly downstream of the flapping swimmers, thus diminishing the opportunities for downstream swimmers to passively stay in cohesive formation and achieve hydrodynamic benefits. We thus hypothesized that the number of swimmers that passively maintain a cohesive inline formation is not a universal property of the flow physics, but depends on the flow regime.

We tested this hypothesis in VS simulations with increasing number of swimmers and increasing τdiss. As we increased τdiss, the number of swimmers that stayed in cohesive inline formation increased (Fig. 8B,C). These findings confirm that this aspect of schooling – the maximal number of swimmers that passively maintain a cohesive inline formation – is indeed scale-dependent. Interestingly, an analysis of the power savings in these formations shows that, although swimmers 4 and 5 stay in formation at increased τdiss, swimmer 3 always receives the most hydrodynamic benefit (Fig. 8D).

We additionally tested the stability of inline formations in CFD simulations at Re = 1645 (Fig. 9.S1) and observed the same trend: an inline school of 3 swimmers remains cohesive, but a fourth swimmer collides with the upstream swimmer. These observations imply that the loss of cohesion does not depend on the specific fluid model. This is consistent qualitatively with existing results [49]. In [49], the authors employed flexible heaving foils at Re = 200 and observed stable inline formations with larger number of swimmers. The flexible foil model and smaller Re make the swimmer more adaptive to changes in the flow field, by passively modulating the amplitude and phase along its body, thus diverting some of the hydrodynamic energy into elastic energy and stabilizing the larger inline formation. This, again, emphasizes that the number of swimmers in a stable inline group is not a universal property of the formation, rather it is model and scale-dependent.

Mapping emergent spatial patterns to energetic benefits

We next returned to the school of four swimmers, which, when positioned inline and flapped inphase, lost cohesion as the trailing swimmer separated from the school. We aimed to investigate strategies for stabilizing the emergent school formation and mapping the location of each member in the school to the potential benefit or cost it experiences compared to solitary swimming.

Inspired by vortex phase matching as an active strategy for schooling [9, 24], we tested whether phase control is a viable approach to maintain cohesion and gain hydrodynamic benefits. We devised an active feedback control strategy, where the swimmer senses the oncoming transverse flow velocity at its location and adjusts its flapping phase to maximize the agreement V between its flapping motion and the local flow (see S.5 for more details). When applied to swimmer 4 (Fig. 10A), this phase controller led to a stable formation, albeit at no benefit to swimmer 4; in fact, swimmer 4 spent 100% more power compared to solitary swimming, whereas the power savings of swimmers 2 and 3 remained robustly at the same values as in the formation without swimmer 4. The inability of swimmer 4 to extract hydrodynamic benefits from the oncoming flow is due to a fundamental physical limitations, as explained in Fig. 9; by the non-reciprocal nature of flow interactions, changing the phase of the trailing swimmer has little effect on the oncoming flow field generated by the upstream swimmers. If the oncoming wake itself presents no opportunity for hydrodynamic benefit, phase control cannot generate such benefit.

Passive and active methods for stabilizing an emergent formation of four swimmers

A. In an inline school of four-swimmers, the leading three swimmers flap inphase, but swimmer 4 actively controls its phase in response to the flow it perceives locally to match its phase to that of the local flow as proposed in [9]. The phase controller stabilizes swimmer 4 in formation but at no hydrodynamic benefit. B. Sequentially increasing the phase lag by a fixed amount Δϕ = 30o in an inline school of four-swimmers stabilizes the trailing swimmer but at no hydrodynamic benefit. C. Gradually tuning the phase lag Δϕ in a school of four swimmers as done in panel B. At moderate phase lags, the school stays cohesive (top plot) but swimmer 4 barely gets any power savings (bottom plot). D. By laterally offsetting the swimmers, four swimmers, all flapping inphase, form cohesive schools with different patterns, e.g. with side-by-side pairing of two swimmers, staggered, and diamond patterns. The time evolution of separation distances is shown in Fig. 10.S1. Individual in each pattern receive a different amount of hydrodynamic benefit. Diamond formation provides the most power saving for the school as anticipated in [1] for a school in a regular infinite lattice. In panels A, B and D, % values indicate the additional saving or expenditure in cost of transport relative to solitary swimming.

We next investigated whether collaborative phase modulation could aid in maintaining school cohe-sion by imposing that each swimmer flaps at a phase lag Δϕ relative to the swimmer ahead (Fig. 10B,C). We found a range of values of Δϕ at which the school became passively stable, but without providing much hydrodynamic benefit to the trailing swimmer; in fact, at certain Δϕ, cohesion came at a hydrody-namic cost to swimmer 4, much like the active phase control strategy.

Lastly, we investigated whether a lateral offset of some of the swimmers could passively stabilize the emergent formation. The choice of which swimmers to displace laterally and by how much is not unique. Thus, we probed different scenarios and obtained multiple stable formations (Fig. 10D and Fig. 10.S1). For example, pairing any two of the four swimmers side-by-side, say at the leading, middle, or trailing end of the school, led to cohesive formations. The distribution of hydrodynamic cost or benefit varied depending on the spatial pattern of the school and the individual position within the school. Staggering the swimmers in a zigzag pattern also stabilized the school, but did not always allow the trailing swimmer to improve its cost of transport. Staggering the swimmers in a “Diamond” formation stabilized the school and, of all the stable formations we tested, led to the highest savings in cost of transport for the entire school (Fig. 10D). These results are consistent with existing evidence that diamond formations are both stable [64] and energetically optimal [1, 77]. But unlike individuals in an infinite diamond lattice [1], individuals in a finite diamond formation do not receive equal energetic benefits.

Our findings highlight the versatility and fluidity of the emergent spatial patterns in groups of flapping swimmers and emphasize that energetic benefits vary depending on the position of the individual within the school. Importantly, these findings imply that, although many emergent formations do not globally optimize the savings of the entire school, hydrodynamic interactions within these formations offer indi-viduals numerous opportunities to achieve varying levels of energetic savings [13], potentially creating competition among school members over advantageous positions in the school.

Discussion

We analyzed how passive flow interactions mediate self-organization in groups of flapping swimmers, all heading in the same direction. Our approach relied on a hierarchy of fluid-structure interaction mod-els and aimed to distill which aspects of self-organization are universal and those which are scale-dependent.

We found that a pair of flapping swimmers self-organize into inline, diagonal, or side-by-side forma-tions (Fig. 1). The emergent formation depends on the swimmers’ flapping phase and initial conditions. In fact, the distinction between these types of formation is somewhat arbitrary because, as phase varies, the emergent equilibria are dense over the space of lateral offset and separation distance (Fig. 6). These findings are consistent with experimental observations [9, 11, 27, 28], but go beyond these observations to quantify the hydrodynamic benefits to each member in these formations. Two side-by-side swimmers flapping inphase save energy, compared to solitary swimming, and share the hydrodynamic benefits nearly equally. When flapping antiphase, the side-by-side swimmers exert extra effort compared to solitary swimming, contrary to a common misconception that this configuration saves hydrodynamic en-ergy [12]. In leader-follower formations, whether inline or diagonal, hydrodynamic benefits are bestowed entirely on the follower (Fig. 3A).

Importantly, we showed that the wake of a solitary leader contains information that unveils opportuni-ties for the emergence of stable and energetically-favorable formations in pairs of swimmers. Equilibrium locations and trends in power savings and school cohesion can all be predicted entirely from kinematic considerations of the leader’s wake with no consideration of the two-way coupling between the two swimmers (Fig. 5). These results are important because they highlight the non-reciprocal or asymmet-ric nature of flow coupling in leader-follower configuratoins, inline or diagonal, at finite Re and open new avenues for future studies of non-reciprocal flow-coupled oscillators. These oscillators have distinct properties from classic mechanical and biological oscillators, such as Huygens pendula or viscosity-dominant oscillators, where the coupling between the oscillators is reciprocal; see, e.g., [8084].

Our analysis has practical importance in that it provides efficient diagnostics and predictive tools that are equally applicable to computational models and experimental data and could, therefore, be applied broadly to analyze, predict, and test opportunities for schooling and hydrodynamic benefits in live and robotic fish when flow measurements are available.

Case in point, we used these diagnostic tools to explain the mechanisms leading to scattering in larger groups of inline swimmers and to predict when the wake of a leading group of swimmers offers no opportunities for a follower to benefit from passive hydrodynamics (Fig. 9). At an increasing number of flow-coupled swimmers, side-by-side formations remain robust, but inline formations become unsta-ble beyond a critical number of swimmers (Figs. 7 and 8). The critical number depends on the fluid properties and can be predicted by analyzing the wake of the leading group of swimmers. Future work will focus on testing these findings experimentally and in CFD simulations with increasing number of swimmers, together with accounting for body deformations [74], lateral dynamics [52, 85], and variable flapping amplitudes and frequencies [27, 86].

Our findings could have far-reaching consequences on our understanding of biological fish schools. Field and laboratory experiments [2, 4, 5, 57] have shown that actual fish schools do not generally con-form to highly regularized patterns, and schooling fish dynamically change their position in the school. Neighboring fish vary from side-by-side to inline and diagonal configurations. Importantly, in laboratory experiments that challenged groups of fish to sustain high swimming speeds, the fish rearranged them-selves in a side-by-side pattern as the speed increased, much like the pattern in Fig. 7B, presumably to save energy [5]. These empirical observations, together with our findings that side-by-side formations provide the fairest distribution of efforts among school members (Fig. 7B and C), offer intriguing inter-pretations of the results in [5, 57]: when the fish are not challenged by a strong background current to sustain high swimming speeds, they position themselves as they please spatially, without much consid-eration to equal sharing of hydrodynamic benefits. But when challenged to swim at much higher speeds than their average swimming speed, fish are forced to cooperate.

To expand on this, our results suggest a connection between flow physics and what is traditionally thought of as social traits: greed versus cooperation. We posit that there is a connection between the resources that arise from flow physics – in the form of energetic content of the wake of other swimmers – and greedy versus cooperative group behavior. In cohesive inline formations, the leader is always disadvantaged and hydrodynamic benefits are accorded entirely to trailing swimmers (Figs. 3A and 7C). Importantly, flows generated by these inline formations present serious impediments for additional swim-mers to join the line downstream (Figs. 7 and 8). Thus, we could call these formations greedy, leaving no resources in the environment for trailing swimmers. This thought, together with our interpretation of the observations in [5] that cooperation to achieve an egalitarian distribution of hydrodynamic benefits is forced, not innate, raise an interesting hypothesis. The dynamic repositioning of members within the school (e.g., Fig. 10) could be driven by greed and competition to occupy hydrodynamically advanta-geous positions, much like in peloton of racing cyclists [87]. On a behavioral time scale, these ideas, besides their relevance to schooling fish, open up opportunities for analyzing and comparing the collec-tive flow physics in cooperative versus greedy behavior in animal groups from formations of swimming ducklings [88] and flying birds [89, 90] to peloton of racing cyclists [87]. From an evolutionary perspec-tive, it is particularly exciting to explore the prospect that flow physics could have acted as a selective pressure in the evolution of social traits such as cooperation and greed in aquatic animal groups.

Acknowledgements

Many thanks to members of the McHenry Laboratory at UC Irvine and Kanso Laboratory at USC for numerous discussions about fish schooling behaviour and for comments on the manuscript.

Funding

Funding provided by the National Science Foundation grants RAISE IOS-2034043 and CBET-210020 (EK) and the Office of Naval Research grants N00014-22-1-2655 and N00014-19-1-2035 (EK).

Author contributions

E.K. conceptualized the study. S.H. and H.H. developed the CFD and VS codes and performed the numerical simulations. S.H., H.H. and E.K. analyzed the data. E.K. wrote the manuscript. S.H. and H.H. provided manuscript edits and comments and approved the final version.

Competing interests

Authors declare that they have no competing interests.

Data and materials availability

All data generated or analysed during this study are included in this published article (and its supplementary information files).