State variables
The first step in describing the macroscopic properties of the swarm is to define a set of state variables that fully characterizes the state of the system. The equation of state then links these state variables in a functional relation. In classical thermodynamics, a complete set of state variables is given by the conjugate pairs of pressure P and volume V, temperature T and entropy S, and, if the number of particles is not fixed, chemical potential μ and number of particles N. We use an analogous set of state variables here to characterize swarms. The most straightforward state variable to define is the number of individuals N, which is given simply by the number of midges in the swarm at a given time (note that midges that are not swarming simply sit on the walls or floor of the laboratory enclosure). The volume V of the swarm can be straightforwardly defined and computed as the volume of the convex hull enclosing all the midges. Note that while N and V are not independently controllable quantities, the ratio N/V is empirically approximately constant in large swarms24, meaning that the “thermodynamic” limit (that is, (N to infty) and (V to infty) with (frac{N}{V} to rho)) is approached in our swarms25. In typical swarming events, N changes on a time scale that is very slow compared to the swarm dynamics; thus, a chemical potential is not needed to describe the instantaneous state of the swarm. Note, though, that since the number of midges varies between measurements that may be separated by many days, N remains a relevant state variable for capturing swarm-to-swarm variability.
The remaining three state variables are somewhat more subtle, but can be defined by building on previous work. It has been explicitly shown26 that a virial relation based on the kinetic energy and an effective potential energy holds for laboratory swarms of Chironomus riparius. For particles moving in a potential, this virial relation can be used to define a pressure26. As we have shown previously, swarming midges behave as if they are trapped in a harmonic potential well that binds them to the swarm, with a spring constant k(N) that depends on the swarm size24,26 (Fig. 1b). The difference between the kinetic energy and this harmonic potential energy thus allows us to compute a pressure4,26,27, which is conceptually similar to the swim pressure defined in other active systems28. The virial theorem thus provides a link between kinetic energy, potential energy, and a field that plays the role of a pressure, when coupled with the observation that individual midges to a good approximation behave as if they are moving in a harmonic potential24,26. We can write this virial pressure P (per unit mass, assuming a constant mass per midge) as
$$P = frac{1}{3NV}mathop sum limits_{i = 1}^{N} left( {v_{i}^{2} – frac{1}{2}langle krangle r_{i}^{2} } right),$$
where N is the number of midges in the swarm, V is the swarm volume, vi is the velocity of midge i, ri is its distance from the swarm centre of mass, and (langle krangle = langle – {mathbf{a}}_{i} cdot hat{mathbf{r}}_{i} / r_{i} rangle) is the effective spring constant of the emergent potential well that binds midges to the swarm. In this expression, ai is the acceleration of midge i, (hat{mathbf{r}}_{i}) is the unit vector pointing from a midge towards the instantaneous centre of mass of the swarm (defined as (1/Nsumnolimits_{i = 1}^{N} {{mathbf{r}}_i })) and averages are taken over the individuals in the swarm. This spring constant depends on the swarm size N (Fig. 1b). We note that we have previously simply used the directly computed potential energy (- langle {mathbf{a}}_{i} cdot {mathbf{r}}_{i} rangle) to define the pressure4,27; here, we instead average the potential terms and fit them to a power law in N (Fig. 1b) to mitigate the contribution of spurious instantaneous noise in the individual positions that would be enhanced by differentiating them twice to compute accelerations. We use this power law to determine the spring constant k instantaneously at each time step.
The results from the two methods for computing the pressure are similar and consistent, but the method we use here is less prone to noise. Physically, this pressure P can be interpreted as the additional spatially variable energy density required to keep the midges bound to the swarm given that their potential energy varies in space but their mean velocity (and therefore kinetic energy) does not. Thus, compared to a simple passive particle moving in a harmonic well, midges have more kinetic energy than expected at the swarm edges; this pressure compensates for the excess kinetic energy. This pressure should be viewed as a manifestation of the active nature of the midges (similar to a swim pressure28), since the kinetic energy is an active property of each individual midge and the potential energy is an emergent property of the swarm.
We can define a Shannon-like entropy S via its definition in terms of the joint probability distributions of position and velocity. This entropy is defined as
$$S = – mathop smallint limits_{ – infty }^{infty } p(x,;v)log_{2} p(x,;v)dxdv,$$
where p(x,v) is the joint probability density function (PDF) of midge position and velocity. S here is measured in bits, as it is naturally an information entropy. Empirically, we find that the position and velocity PDFs are nearly statistically independent for all components and close to Gaussian, aside from the vertical component of the position (Fig. 1c–f). However, the deviation from Gaussianity in this component (which occurs because of the symmetry breaking due to the ground) does not significantly affect the estimate of the entropy; thus, we approximate it as Gaussian as well. Making these approximations, we can thus analytically write the (extensive) entropy as
$$S = frac{3N}{{ln 2}}ln left( {2pi esigma_{x} sigma_{v} } right),$$
where (sigma_{x}) and (sigma_{v}) are the standard deviations of the midge positions and velocities, respectively. In practice, we calculated (sigma_{v}) by averaging the instantaneous root-mean-square values of all three velocity components rather than a time-averaged value; the difference between these components was always less than 10%. This expression makes it more clear why the Gaussian approximation for the vertical component of the position is reasonable here: only the mean and variance of the PDFs are required to compute the entropy, and these low moments are very similar for the true data and the Gaussian estimate.
Although there is no obvious definition of temperature for a swarm, we can define one starting from the entropy, since temperature (when scaled by a Boltzmann constant) can be defined as the increase in the total physical energy of the system due to the addition of a single bit of entropy. Given our definitions, adding a single bit of entropy (that is, setting (S to S + 1)) for constant (sigma_{x}) and N (that is, a swarm of fixed number and spatial size) is equivalent to setting (sigma_{v} to 2^{1/(3N)} sigma_{v} .) Adding this entropy changes the total energy of the system by an amount
$$frac{3}{2}sigma_{v}^{2} Nleft( {2^{frac{2}{3N}} – 1} right) equiv k_{B}^{*} T,$$
which we thus define as the temperature (k_{B}^{*} T). Even though this temperature is nominally a function of the swarm size N, it correctly yields an intensive temperature as expected in the limit of large N, as the explicit N-dependence vanishes in that limit since (lim_{n to infty } k_{B}^{*} T = sigma_{v}^{2} ln 2). In practice, this limit is achieved very rapidly: we find that this temperature is nearly independent of N for N larger than about 20, consistent with our earlier results on the effective “thermodynamic limit” for swarms25. The effective Boltzmann constant (k_{B}^{*}) is included here to convert between temperature and energy, though we note that we cannot set its value, as there is no intrinsically preferred temperature scale.
Equipartition
With these definitions in hand, we can evaluate the suitability of these quantities for describing the macroscopic state of midge swarms. First, we note that proper state variables ought to be independent of the swarm history; that is, they ought to describe only the current state of the system rather than the protocol by which that state was prepared. Although this property is difficult to prove incontrovertibly, none of the definitions of our state variables have history dependence. We further find that when these state variables are modulated (see below), their correlation times are very short, lending support to their interpretation as true state variables. We can also compare the relationships between these state variables and the swarm behaviour to what would be expected classically. In equilibrium thermodynamics, for example, temperature is connected to the number of degrees of freedom (d.o.f.) in a system via equipartition, such that each d.o.f. contributes an energy of (frac{1}{2}k_{B}^{*} T). We can write the total energy E of a swarm as the sum of the kinetic energy (E_{k} (t) = frac{1}{2}v^{2}) and potential energy (E_{p} (t) = frac{1}{2}k(N)r(t)^{2}) for all the individuals, where r is the distance of a midge to the swarm centre of mass, v is the velocity of a midge, and k(N) is the effective spring constant. Surprisingly, even though individual midges are certainly not in equilibrium due to their active nature, we find that the total energy is linear in both T and N (Fig. 2a), and that there is no apparent anisotropy, suggesting that equipartition holds for our swarms. This result is highly nontrivial, especially given that our definition of T does not contain the spring constant k(N), which is only determined empirically from our data. Moreover, the slope of the (E/k_{B}^{*} T) curve is well approximated as (9/2)N, implying that each midge has 9 effective d.o.f. (or 6 after discounting the factor of ({text{ln}}2) in our definition of (k_{B}^{*} T)) These d.o.f. can be identified as 3 translational and 3 potential modes, given that the potential well in which the midges reside is three-dimensional. These results demonstrate the surprising applicability of equilibrium thermodynamics for describing the macroscopic state of swarms29.
Equipartition and the equation of state. (a) The total energy of the system (E) normalized by (k_{B}^{*} T) as a function of swarm size (blue) along with the kinetic energy (E_{k}) (yellow) and potential energy (E_{p}) (blue). The total normalized energy of the system is well approximated by (9/2)N (black dashed line), indicating that each individual midge contributes ((9/2)k_{B}^{*} T) to E and thus has 9 degrees of freedom (6 after discounting the factor of ({text{ln}}2) in our definition of (k_{B}^{*} T)). The deviations from that behaviour for the largest swarms can be attributed to a growing uncertainty in the energy due to the smaller number of experiments with such large swarms. (b) A portion of our ensemble of data of the measured pressure (blue). The yellow line is the reconstruction of the pressure from our equation of state. The inset shows a zoomed-in portion of the data to highlight the quality of the reconstruction. (c) PDF of the pressure for our entire data ensemble23. The statistics of the directly measured pressure (blue) and reconstructed pressure from the equation of state have nearly identical statistics for the full dynamic range of the signal.
Equation of state
The fundamental relation in any thermodynamic system is the equation of state that expresses how the state variables co-vary. Equations of state are thus the foundation for the design and control of thermodynamic systems, because they describe how the system will respond when a subset of the state variables are modulated. Any equation of state can be written in the form (P = f(V, ;T,;N)) for some function f. Although the form of f is a priori unknown, it can typically be written as a power series in V, T, and N, in the spirit of a virial expansion. We fit the equation of state to our data assuming the functional form
$$P = f(V, ;k_{B}^{*} T,;N) = c_{4} V^{{c_{1} }} (k_{B}^{*} T)^{{c_{2} }} N^{{c_{3} }},$$
and using nonlinear least-squares regression. We chose to fit to the pressure for convenient analogy with a thermodynamic framework, but any other variable would have been an equivalent possibility. We note that when fitting, we normalized all the state variables by their root-mean-square values so that they were all of the same order of magnitude. These normalization pre-factors do not change the exponents, but are instead simply absorbed into (c_{4}). Thus, to leading order, we assume (P = f(V,;k_{B}^{*} T,;N) propto V^{{c_{1} }} (k_{B}^{*} T)^{{c_{2} }} N^{{c_{3} }}) and fit this relation to the swarm pressure (Fig. 2b,c), obtaining c1 = − 1.7, c2 = 2, and c3 = 1, with uncertainties on the order of 1%. Although the expression for the pressure does depend on three parameters in a nonlinear fashion, the resulting estimates for these parameters are remarkably stable and consistent across all measurements. Hence, we arrive at the equation of state (PV^{1.7} propto N(k_{B}^{*} T)^{2} .)
This equation of state reveals aspects of the nature of swarms, particularly when compared with the linear equation of state for an ideal gas (where (PV = Nk_{B} T)). In both cases, for example, to maintain a fixed pressure and volume, smaller systems need to be hotter; but this requirement is less severe for swarms since the temperature is squared, meaning that midges have to speed up less than ideal gas molecules do. Likewise, to maintain a fixed temperature, volume expansion must be counteracted by a reduction in pressure; but midges must lower the pressure more than a corresponding ideal gas, which is reflective of the decrease of the swarm spring constant with size.
Thermodynamic cycling
Beyond such reasoning, however, the true power of an equation of state in thermodynamics lies in specifying how the state variables will change when some are varied but the system remains in the same state, such as in an engine. To demonstrate that our equation of state similarly describes swarms, it is thus necessary to drive them away from their natural state. Although it is impossible to manipulate the state variables directly in this system of living organisms as one would do with a mechanical system, we have shown previously that time-varying acoustic30 and illumination27 stimulation lead to macroscopic changes in swarm behaviour. Here we therefore build on these findings and use interlaced illumination changes and acoustic signals to drive swarms along four distinct paths in pressure–volume space, analogous to a thermodynamic engine cycle. The stimulation protocol is sketched in Fig. 3a. The “on” state of the acoustic signal is telegraph noise (see Experimental details), while the “off” state is completely quiet. The illumination signal simply switches between two different steady light levels. Switching between the four states of “light-high and sound-on,” “light-high and sound-off,” “light-low and sound-off,” and “light-low and sound-on” with a 40-s period (Fig. 3a) produces the pressure–volume cycle shown in Fig. 3b. We suspect that the loops in the cycle stem from the swarm’s typical “startle” response after abrupt changes in environmental conditions, followed by a rapid relaxation to a steady state27,30.
Thermodynamic cycling of a midge swarm with (langle Nrangle = 27). Schematic of the perturbation cycle showing the illumination (solid) and sound (dashed) signal timings. The symbols indicate the switching points identified in (b). (b,c) Phase-averaged swarm behaviour during the perturbation cycle plotted in the pressure–volume phase plane for (b) the pressure signal as measured and (c) as reconstructed using our equation of state. (leftlangle {,} rightrangle_{phi }) denotes a phase average of a quantity over a full cycle. The four different states of the perturbation signal are indicated. The data has been averaged using a moving 3.5-s window for clarity. The swarm behaviour moves in a closed loop in this phase plane during this cycling, as would be expected for an engine in equilibrium thermodynamics, and the equation of state holds throughout even though it was developed only for unperturbed swarms. (d) Phase-averaged pressure (langle Prangle_{phi }) of the swarm during a continuous cycle through the four light and sound states. The blue line shows the directly measured pressure and the yellow line shows the reconstruction using the equation of state.
In addition to the pressure and volume, we can also measure the other state variables as we perturb the swarms. Given that we do not observe any evidence of a phase transition, we would expect that our equation of state, if valid, should hold throughout this cycle. To check this hypothesis, we used the measured V, T, and N values during unperturbed experiments along with the equation of state to predict the scaling exponents, and in turn the pressure P. We then use these baseline, unperturbed exponents and V, T, and N during the interlaced perturbations to predict a pressure P. This pressure prediction matches the measured signal exceptionally well (Fig. 3c,d) even though the equation of state was formulated only using data from unperturbed swarms, highlighting the quality of this thermodynamic analogy. Although we might expect that a strong enough perturbation might lead to qualitatively different behaviour (if the swarm went through the analog of a phase transition31), our results give strong support to the hypothesis that our equation of state should hold for any perturbation that does not drive such a transition.
Source: Ecology - nature.com