Presets
Playback
Parameters
Camera
Layers
Quality
Model check
The science
Schooling. Each baitfish follows a three-zone rule (Couzin et al. 2002): it swims away from any neighbour closer than the repulsion distance (0.15 m, one body length); otherwise it aligns with neighbours inside the orientation zone (0.75 m) and steers toward the others inside the attraction range, with a turning-rate limit and random angular noise. With low noise the school aligns into a polarised group; with high noise the same rules give a disordered swarm (the order parameter is the length of the mean heading vector, shown on the first graph).
Escape. When the predator comes closer than the flight-initiation distance, a fish reacts after a short latency (0.04 s), jumps to its escape speed in a direction away from the predator plus a random jink that is renewed every 0.12 s, and recovers after 0.45 s. A fish whose neighbour is fleeing can start fleeing too, which spreads the alarm through the school in a wave (the "flash expansion" seen in real attacks).
Predator. The barracuda patrols around the school, stalks, and tries to lock onto a fish inside a frontal cone. The confusion effect is modelled as a lock-on probability 1/(1 + (n - 1)/k), where n is the number of fish within 0.6 m of the chosen target and k is the confusion constant, so lone fish are always caught and dense groups are hard to single out. A strike is a burst with pure pursuit limited by a minimum turning radius (turn rate = speed / radius); it ends after 1.1 s, when the mouth comes within 0.13 m of a fish, or when the target gets too far, and is followed by a recovery period. Pure pursuit against a faster predator ends in capture after T = d v / (v2 - u2) when the prey crosses the line of sight and T = d/(v - u) when it flees straight away; the real defence is therefore not speed but turning, confusion and dilution.
Numbers. Reynolds number Re = U L / ν with the fresh-water viscosity fit ν = 1.78×10-6 / (1 + 0.0337 T + 0.000221 T2) m2/s. Fish tail-beat frequency follows the Strouhal rule f A / U ≈ 0.3 (cruising fish fall in the 0.2 to 0.4 range) with a peak-to-peak amplitude of 0.2 body lengths. Swimming speeds scale with temperature as Q10(T-26)/10 with Q10 = 1.8, an illustrative value.
Honest simplifications. The zones, escape timing, burst limits, the confusion constant k and the 6 m/s default burst speed are plausible values chosen for a readable simulation, not measurements of one species. Fish are point agents with a heading; there is no hydrodynamic interaction between fish, no vision model (the confusion effect is a counting rule), no energetics, no fatigue other than a fixed recovery time, and no social learning. The arena is a 13 m box with soft walls and a flat seabed; eaten fish are optionally replaced by a fish at the edge of the school so the school keeps its size. The barracuda is drawn at 1 m and the baitfish at 15 cm. Educational model of predator-prey dynamics; real attacks involve many more behaviours.
Checks. (1) The simulated pure pursuit against the two closed-form capture times; (2) the neighbour count and 6000 Monte Carlo lock-on trials per group size against the confusion rule; (3) a low-noise and a high-noise school after 60 s, ordered against disordered; (4) the viscosity fit against tabulated values, a Reynolds number, and the Strouhal tail-beat relation.