## Abstract

Inducing thermal gradients in fluid systems with initial, well-defined density gradients results in the formation of distinct layered patterns, such as those observed in the ocean due to double-diffusive convection. In contrast, layered composite fluids are sometimes observed in confined systems of rather chaotic initial states, for example, lattes formed by pouring espresso into a glass of warm milk. Here, we report controlled experiments injecting a fluid into a miscible phase and show that, above a critical injection velocity, layering emerges over a time scale of minutes. We identify critical conditions to produce the layering, and relate the results quantitatively to double-diffusive convection. Based on this understanding, we show how to employ this single-step process to produce layered structures in soft materials, where the local elastic properties vary step-wise along the length of the material.

## Introduction

Pattern forming systems are some of the intriguing and spectacular phenomena throughout science and technology^{1,2,3,4}. In nature, patterns in fluid media, such as the waves on the surface of deep water^{5, 6}, oscillations in flames^{7}, large-scale von Kármán vortex streets in clouds^{8}, and the symmetric yet complex shape of snow flakes^{9}, constitute some of the earliest self-organized systems, which have attracted human curiosity and initiated scientific exploration. A considerable class of spatial patterns in fluids are structured due to thermal effects, which trigger hydrodynamic instabilities^{10,11,12}. For example, well-known instabilities triggered by thermal effects, such as Rayleigh-Bérnard convection^{13,14,15}, are often found in systems with well-defined initial conditions.

In a fluid system, when thermal gradients are introduced in the presence of an initial well-defined density gradient, distinct layered patterns are observed similar to those sometimes found in the ocean due to double-diffusive convection^{16,17,18,19,20}. Surprisingly, we observe distinct horizontal layers formed after haphazardly pouring espresso into a glass of warm milk. Pouring forces a lower-density liquid (espresso) into a higher-density ambient (milk). The downward liquid inertia caused by pouring is opposed by buoyancy. The dynamics is similar to the fountain effect^{21, 22}, which characterizes a wide range of flows driven by injecting a fluid into a second miscible phase of different density.

Here we perform controlled model experiments, injecting warm dyed water from the top into a cylindrical tank filled with warm salt solution. The mixture cools down at room temperature and multiple horizontal layers emerge over several minutes. We use light intensity in the digital images of the fluid in the tank, after the injection, to quantify the distribution of the mixture density. We show that the formation of horizontal layers is a result of double-diffusive convection, where the salinity and temperature gradients are applied vertically and horizontally, respectively. The presence of the circulating flows within the layers is confirmed via particle image velocimetry (PIV) experiments and numerical simulations. Furthermore, we report that the formation of the horizontal layers is controlled by the injection velocity, i.e. layers emerge only when the injection velocity is higher than a critical value. Finally, we propose a single-step procedure for fabricating multi-layer soft materials based on our understanding of the model system.

## Results

### Layered latte

A glass of latte is made by pouring a cup of espresso into a glass of warm milk. Since the two liquids are miscible, the result of pouring is an espresso-milk mixture at the top of the glass, while the bottom may only contain milk, if no additional stirring is applied (Fig. 1a). In fact, although the initial state of the mixture is complex and chaotic (Fig. 1b), there are conditions where the mixture cools at room temperature and exhibits an organized layered pattern (Fig. 1c, see Supplementary Movie 1). These stable layers, whose structures may be maintained for at least tens of minutes (Fig. 1d), or even several hours, contain different concentrations of espresso and hence exhibit distinct visible boundaries.

### Experimental model

In order to investigate the mechanisms leading to the layering of the mixture, we performed controlled experiments in a model system comprised of a low-density jet of dyed water (density \(\rho _{\mathrm{w}} = 0.992 \times 10^3 \, {\mathrm{kg}}\,{\mathrm{m}}^{ - {\mathrm{3}}}\) at \(T_{\mathrm{H}} = 40\,^ \circ {\mathrm{C}}\), injection volume \(V_{\mathrm{I}} = 30 \,\)ml) entering a tank filled with relatively higher-density brine (9.1 wt% sodium chloride solution, \(\rho _{\mathrm{s}} = 1.056 \times 10^3\,{\mathrm{kg}}\,{\mathrm{m}}^{ - {\mathrm{3}}}\) at \(T_{\mathrm{H}} = 40\,^ \circ {\mathrm{C}}\), 340.9 ml). The jet enters from the top (Fig. 1e) and the solution is then left to cool at room temperature \(T_{{\mathrm{atm}}} = 22\,^ \circ {\mathrm{C}}\).

### Experimental observations

When the dyed water is injected into the higher-density salt solution, a downward jet is generated. However, the penetration of this liquid jet into the salt solution is opposed by the buoyant force pushing the lower-density liquid jet back to the top of the tank (Fig. 2a, c). As a result, a mixture is formed, in which the dyed water is mixed with the salt solution and is separated from the original salt solution at the bottom of the tank. In addition to buoyancy, the mixing is mainly governed by inertia with the Reynolds number defined as \({\mathrm{Re}} = Ud/2\nu \approx O(100)\) (\(U\) is the injection velocity, \(d\) is the diameter of the needle and \(\nu\) is the kinematic viscosity of the fluid), while diffusion does not play a significant role during the injection. The Schmidt number is \({\mathrm{Sc}} = \nu / \kappa_{\mathrm{s}} \approx 300\) (\(\kappa _{\mathrm{s}}\) is the mass diffusivity of the salt), indicating that the momentum diffusion is far faster than the salt diffusion during both the injection and layering (if any) processes. The Schmidt number for the milk and espresso system is approximately \(10^4 \gg 1\), and so the system is similar to the model salt and water system, in which momentum diffusion dominates. At relatively low injection velocities (Fig. 2a, b), the mixture of dyed water and salt solution (initially at \(T_{\mathrm{H}} = 40\,^ \circ {\mathrm{C}}\)) remains unchanged as it cools down at room temperature. However, above a critical injection velocity, multiple layers similar to those observed in the glass of latte (Fig. 1a–d) are formed in the mixture several minutes after the injection (Fig. 2d). Once formed, the layers are not influenced by external mechanical disturbances, and can recover even after gentle stirring. As the cooling continues, these layers may merge and form thicker structures, which can last for days before being entirely eliminated by diffusion (Supplementary Fig. 1). The layers can be observed in the milk and espresso or in the salt and water mixture, only when the initial temperature is different from the room temperature.

We quantify the concentration of the salt in the mixture using the concentration of the blue dye as an indicator (Supplementary Fig. 2). Therefore, the local intensity of the blue dye in the digital images (Fig. 2a–d) can be correlated with the local density of the mixture. The dashed lines in Fig. 2e represent the initial density profiles for two different injection speeds, while the solid lines refer to the density profiles 30 min later. For both experiments the dashed lines exhibit continuous monotonically increasing density profiles, when moving from the top to the bottom of the mixture. While the density profiles before and after the injection at a low velocity \(U = 0.17\,{\mathrm{m}}\,{\mathrm{s}}^{ - {\mathrm{1}}}\) (black) remain almost identical, the density profile 30 min after the injection at a higher velocity \(U = 0.37\,{\mathrm{m}}\,{\mathrm{s}}^{ - {\mathrm{1}}}\) (blue) exhibits clear steps indicating the formation of horizontal layers. After the high-velocity injection, the density in a single layer is constant, implying that the liquid within a layer is uniformly mixed. Moreover, the discontinuities in the density profile are clearer near the top of the mixture, where the gradient of the density is smaller than that of the bottom layers. We postulate that this layered state is reached due to the double-diffusive convection, which is well known in layer formation in open water systems such as oceans or lakes^{18,19,20, 23, 24}. In our experiment, the double-diffusive convection results from the combination of heat transfer to the surroundings from the warm liquid, and a density gradient generated in the mixture from the initial pouring or injection.

A directional heat transfer phenomenon in a mixture with an initial density gradient has been observed previously in other systems to lead to the formation of well-defined layers in fluid mixtures due to double-diffusive convection^{18,19,20, 23, 24}. In particular, when a given temperature difference is created between two vertical walls bounding a fluid with an initial vertical density gradient, the fluid near the cold wall is cooled and thus gets denser and sinks. The sinking of the liquid due to the heat transfer will however be suppressed as the cooler liquid close to the wall reaches a zone of a similar density in the mixture. Therefore, the downward-moving liquid starts flowing inwards away from the cold wall as it can no longer proceed in the vertical direction. A similar motion but in the opposite sense is created close to the warmer wall. Consequently, closed streamlines are formed in the fluid circulating between the cold and the warm sources^{23}. Within the circulation cells, the fluid mixes uniformly, and thus the density is fairly constant, while each circulation cell acquires a different density.

In order to verify the postulate of double-diffusive convection as the cause of layering in our confined injection-driven system, we performed experimental (Fig. 2f, g) and numerical analyses (Fig. 2h, i) of the time-dependent flows (see details in Methods, Supplementary Figs 3, 4 and Supplementary Discussion). Both approaches document the formation of recirculating patterns in the form of axisymmetric rings between the wall and the center of the tank. The boundaries separating these circulation cells overlap with the limits of the layers in the mixture.

### Critical injection velocity

The circulation cells are the results of the competition between the horizontal thermal gradient and the vertical density gradient generated by the fluid injection, i.e., the thermal gradient triggers the fluid to rise or sink close to the boundaries, while the vertical density gradient opposes this motion and subsequently stabilizes the flow. In our model experiments, layers are observed only above a critical injection velocity \(U_{\mathrm{c}}\) (Fig. 2a–d and Supplementary Fig. 5). At higher injection velocities, the depth of penetration of the liquid jet increases, and similarly the thickness of the mixture \(H\) increases, indicating that the dyed water mixes with a larger volume of salt solution. For a fixed volume of injected water (\(V_{\mathrm{I}} = 30\) ml), we found that the volume of the resulting mixture \(V_{\mathrm{M}}\) increases linearly with the injection velocity \(U\) for the range of parameters studied here. Consequently, the mixing level and the density gradient in the mixture of volume \(V_{\mathrm{M}}\) are controlled by the injection velocity.

We define an average density gradient \({\mathrm{\Delta }}\rho /H\) in the mixture, where \({\mathrm{\Delta }}\rho\) is the magnitude of the density difference between the bottom and top of the mixture. Also, \({\mathrm{\Delta }}\rho /H\) indicates the average resistance imposed by the salinity gradient against the formation of a convection cell due to the thermal gradient and is a function of \(U\). Our experimental measurements show that \({\mathrm{\Delta }}\rho /H\) decreases with increasing \(U\) due to enhanced mixing (Fig. 3a). We find that for \(U >U_{\mathrm{c}} \approx 0.21\,{\mathrm{m}}\,{\mathrm{s}}^ { - {\mathrm{1}}}\) the resistance from salinity can no longer compete with the thermal gradient, thus circulation cells appear and multiple layers emerge.

The competition between the thermal cooling and the salinity gradient in this double-diffusive convection, where the horizontal temperature gradient is orthogonal to the vertical salinity gradient, is characterized by the Rayleigh number, \({\mathrm{Ra}} = \frac{{g\alpha {\mathrm{\Delta }}T}}{{\nu \kappa }}\left[ {\frac{{\alpha {\mathrm{\Delta }}T}}{{( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}}}} \right]^3\), where \(g\) is the gravitational acceleration, \(\alpha\) is the coefficient of fluid volume expansion, \({\mathrm{\Delta }}T\) is the temperature difference in the fluid, \(\nu\) is the kinematic viscosity of the fluid, \(\kappa\) is the thermal diffusivity of the fluid and \(( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}\) is the normalized salinity gradient in the mixture^{18}. In a system with an initial linear salinity gradient and an imposed horizontal temperature gradient, the critical Rayleigh number \({\mathrm{Ra}}_{\mathrm{c}}\) for initiation of an instability and formation of the layers has been found to be around \({\mathrm{Ra}}_{\mathrm{c}} \approx 1.5 \times 10^4\) experimentally^{18}. Note that in a conventional double-diffusive convection problem, a linear density gradient is imposed at the initial stage and the temperature gradient is created between two vertical bounding walls by setting different constant temperatures^{18, 24}. The initial and boundary conditions leading to the layers in a glass of latte and our model experiments are, however, different from those in the traditional problem: (1) the density gradient is caused by the injection and is not constant in the mixture (Fig. 2e) and (2) the temperature gradient is not constant during the experiments as the core of the liquid cools down continuously. Therefore, to characterize our system and to calculate \({\mathrm{Ra}}\), we chose to use the minimum density gradient over the typical thickness of the layers (around 5 mm) at the corresponding injection velocity and the maximum temperature gradient. We found that the critical Rayleigh number in our experiments closely matches the value reported in the literature for an idealized configuration \({\mathrm{Ra}}_{\mathrm{c}} \approx 10^4\) (Fig. 3b). Consistent with our observations, \({\mathrm{Ra}}_{\mathrm{c}}\) indicates that the layering is obtained only when \(U\) is above \(U_{\mathrm{c}}\). Consideration of the dynamics in a proper dimensionless framework requires an analysis with at least both the Froude and Reynolds numbers, which is a topic of on-going research. In addition, when layering occurs, the expected length scale (thickness) of a layer is approximately \((\alpha {\mathrm{\Delta }}T)/[( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}]\).

### Application to soft materials

The double-diffusive convection and the formation of the layers are simply controlled by the thermal and salinity gradients in the fluid systems discussed above, which implies no conceptual restriction on applying this principle to more complex fluid systems, such as thermally established soft gels. There are various approaches for generating layered soft materials, but most of these approaches are currently multi-step processes, where solid layers are usually formed sequentially^{25}. Nevertheless, based on the understanding outlined above, we can make multiple layers in soft materials (UltraPure\(^{{\mathrm{TM}}}\) Agarose, Invitrogen) simply by a single step of injecting (\(U \approx 1\,{\mathrm{m}}\,{\mathrm{s}}^{ - {\mathrm{1}}} >U_{\mathrm{c}}\)) a hot gel solution into a denser solvent and cooling the mixture at room temperature (Fig. 4, see the gel recipe in Supplementary Methods). To further demonstrate the presence of the horizontal layers in the gel, we performed experiments with the same recipe but measured the light intensities in the digital images of the gel rather than the elastic properties (see Supplementary Fig. 6 and Supplementary Discussion). While cooling, horizontal layers are first formed in the agarose solution, which is subsequently solidified to a layered gel below the gelation temperature. The Young’s moduli in the final layered state formed from the same agarose solution vary systematically with the vertical position (50 kPa at the bottom compared to 230 kPa at the top), which implies that the concentration of agarose in distinct layers is different. Further, the difference of concentration in the gel layers leads to a difference of porosity in these layers, so the concentration and the diffusion rate of additives will be different. This single-step, single-chemistry method can facilitate the fabrication of multiple-layered structures in food science^{25}, tissue engineering^{26, 27}, and other applications in materials science.

## Methods

### Model experiment setup

In our model experiments with salt solutions, blue dye (methylene blue hydrate, Sigma-Aldrich, 0.01 wt%) is added to the water jet to visualize the mixing of the two liquids. Dyed water is injected downwards using a syringe pump (Harvard Apparatus PHD 2000) through nozzles of circular cross-section, with inner diameters \(d = 1.2,1.8,2.4\) mm, into a polystyrene cylindrical tank with diameter \(D = 8\) cm (Fig. 1e). Working liquids are brought to the final temperature (\(T_{\mathrm{H}} = 40 \pm 1\,^ \circ {\mathrm{C}}\)) in a water bath. We controlled the flow rate of the injected water and consequently the inlet velocity \(U\) using the syringe pump. After the injection, the tank is cooled down at room temperature. The appearance and evolution of the layers are visualized by placing the tank in between a LED panel and a camera, while the flow velocities in the mixture are obtained by following tracer particles in the PIV experiments.

### Density profile in the mixture

We performed a calibration procedure to correlate the local intensity of the blue dye in the digital images to the local concentration \(c\) (mass ratio) of injected dyed water containing 0.01 wt% methylene blue hydrate (see Supplementary Fig. 2). Therefore, we calibrated the local intensity of the blue dye to obtain the local mass ratio of injected dyed water in the mixture, and then calculated the local density in the mixture by considering \(\rho = c\rho _{\mathrm{w}} + (1 - c)\rho _{\mathrm{s}}\), where \(\rho _{\mathrm{w}}\) is the density of water and \(\rho _{\mathrm{s}}\) is the density of the salt water initially in the tank.

### Flow visualization and PIV

The water injected from the top of the tank is labelled with blue dye; therefore the concentration of the dye indicates the amount of water and consequently the salt concentration in the mixture as the blue jet mixes with the salt solution in the tank. The depth of the mixture and the layers formed at higher flow rates are determined by placing the tank in front of a large LED panel and capturing color images of the mixtures over a long period of time (up to 3 days, see Supplementary Fig. 1).

In order to quantitatively visualize the structure of the flow in the mixture, the liquid in the tank is seeded with tracer particles (PSP-20, diameter 20 μm, Dantec Dynamics). The plane of symmetry in the cylindrical tank is illuminated with a green light sheet (thickness of ≈1 mm) created by placing a laser line lens (PL0160, Thorlabs) in front of a green laser (BioRay 520, Coherent). Images are captured using a DSLR camera and a macro lens at the rate of 30 frames per second. The standard deviation of the light intensity for each pixel in the sequence of the recorded grey-scale images is calculated to determine the path lines of the particles in the mixture (Fig. 2f). Moreover, the ensemble cross-correlation scheme is applied to the sequence of grey-scale images to measure the local velocities in the PIV analyses^{28}. Square interrogation windows of \(32 \times 32\) pixels corresponding to grid cells of 1 × 1 mm^{2} with an overlap of 50\(\%\) are used to obtain the velocity vectors, such as those presented in Fig. 2g.

### Numerical simulations

We consider double-diffusive convection of an incompressible flow of a Newtonian fluid inside a cylindrical container (after the injection). The density \(\rho\) of the fluid varies with the temperature \(T\) and the salinity \(S\) following the Boussinesq approximation

where \(\rho _0\), \(S_0\) and \(T_0\) denote, respectively, the density, salinity and temperature of the reference state and \(\beta\) (respectively \(\alpha\)) indicates the solutal (respectively thermal) expansion coefficient. In the case of small-density variations as in our case, this approximation is well justified. Other parameters of the problem include the thermal diffusivity \(\kappa\), kinematic viscosity \(\nu\) of water, solutal diffusivity \(\kappa _{\mathrm{s}}\) and gravitational acceleration \(g\).

We choose the radius \(R\) of the cylinder, \(\kappa /R\) and \(\rho \kappa ^2/R^2\) to scale the length, velocity and pressure, respectively. We introduce the non-dimensional temperature \(\theta\) and salinity \(\sigma\) as

where \(T_{{\mathrm{max}}/{\mathrm{min}}}\) represents the maximum and minimum temperature and likewise for \(S_{{\mathrm{max}}/{\mathrm{min}}}\). The non-dimensional equations have the form

where \({\kern 1pt} \mathbf{U}{\kern 1pt}\), \(P\) and \(\tau\) are the non-dimensional velocity, pressure and time, respectively; \({\mathrm{Pr}} = \nu /\kappa\) is the Prandtl number, \({\mathrm{Ra}}_{\mathrm{T}} = g\alpha (T_{{\mathrm{max}}} - T_{{\mathrm{min}}})R^3/(\kappa \nu )\) the thermal Rayleigh number, \({\mathrm{Le}} = \kappa /\kappa _{\mathrm{s}}\) the Lewis number and \(N = \alpha (T_{{\mathrm{max}}} - T_{{\mathrm{min}}})/\beta (S_{{\mathrm{max}}} - S_{{\mathrm{min}}})\) indicates the buoyancy ratio.

We solve the governing equations Eqs. 4–7 in the \((r,z)\) cylindrical coordinates by employing the commercial finite element solver COMSOL. The assumption of azimuthal independence is verified a posteriori by comparing the numerical and experimental results. We use approximately \(6000\) quadrilateral elements (validated with 30,000 quadrilateral elements) to discretize the computational domain, and the near-wall mesh is carefully refined in order to resolve the thermal boundary layers. Quadratic elements are adopted for \(({\kern 1pt} \mathbf{U}{\kern 1pt} ,\theta ,\sigma )\) and linear elements for \(P\). It is worth noting that any options for numerical diffusion in the COMSOL’s CFD module have been deactivated.

We now describe the boundary conditions (BCs). They are illustrated in the sketch of the computational domain consisting of four boundaries: the axis (left), walls (right and bottom), and the free-slip surface (top) (see Supplementary Fig. 3). On the two walls we impose the no-slip BCs \(U_{\mathrm{r}} = {\it {U}}_{\mathrm{z}} = 0\), on the axis \(U_{\rm {r}} = 0\), and on the top surface we apply zero normal velocity \(U_{\rm{z}} = 0\) and zero tangential stress \(({\kern 1pt} {\mathbf{I}} - {\mathbf{n}}{\mathbf{n}}) \cdot [(\nabla \mathbf{U} + (\nabla {\kern 1pt} \mathbf{U})^{\mathrm{T}}) \cdot {\mathbf{n}}] = {\mathbf{0}}\), where \({\kern 1pt} {\mathbf{n}}{\kern 1pt}\) is the outward-pointing normal vector. Zero-flux \({\kern 1pt} {\mathbf{n}}{\kern 1pt} \cdot \nabla \sigma = 0\) is imposed for the salinity \(\sigma\) on all the boundaries. The same condition applies for the temperature \(\theta\) except for the right wall, which is modeled as a conductive BC transferring the heat inside the container towards the ambient air due to the temperature difference. The conductive BC reads \({\kern 1pt} {\mathbf{n}}{\kern 1pt} \cdot \nabla \theta = {\mathrm{Nu}}(\theta _{{\mathrm{atm}}} - \theta )\), where \(\theta _{{\mathrm{atm}}}\) is the non-dimensional air temperature; also, \({\mathrm{Nu}} = hR/k\) denotes the Nusselt number, where \(h\) and \(k\) correspond to the heat transfer coefficient and heat conductivity. Finally, as the initial condition, we choose the initial density profile measured in the experiments after mixing by the injection.

Our implementation has been validated against ref. ^{29} and our \(2\)D planar version against ref. ^{30}. The reader is also referred to ref. ^{31} for other flow cases where the results of COMSOL simulations show excellent agreement with the asymptotic analysis.

### Calculating the Rayleigh number

We calculated the Rayleigh number \({\mathrm{Ra}} = \frac{{g\alpha {\mathrm{\Delta }}T}}{{\nu \kappa }}\left[ {\frac{{\alpha {\mathrm{\Delta }}T}}{{( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}}}} \right]^3\) for the stability of thermal convection in a salinity gradient due to lateral heating^{18}. In our calculation, the gravitational acceleration is \(g = 9.8\,{\mathrm{m}}\,{\mathrm{s}}^{ - {\mathrm{2}}}\), while the kinematic viscosity and the thermal diffusivity of fluid are \(\nu = 6.6 \times 10^{ - 7}\,{\mathrm{m}}^{\mathrm{2}}\,{\mathrm{s}}^{ - {\mathrm{1}}}\) and \(\kappa = 1.5 \times 10^{ - 7}\,{\mathrm{m}}^{\mathrm{2}}\,{\mathrm{s}}^{ - {\mathrm{1}}}\), respectively at \(T_{\mathrm{H}} = 40\,^ \circ {\mathrm{C}}\). The coefficient of fluid volume expansion is \(\alpha = 3.9 \times 10^{ - 4}\)
\({\mathrm{K}}^{ - 1}\) at \(T_{\mathrm{H}} = 40\,^ \circ {\mathrm{C}}\). The temperature difference in the fluid is \({\mathrm{\Delta }}T = 2\,^ \circ {\mathrm{C}}\), which is the maximum temperature difference measured (by attaching thermocouples) between the center and the wall of the container during cooling at room temperature. Also, \(( - {\mathrm{d}}\rho /{\mathrm{d}}z)\) is the minimum of the local salinity gradient in the mixture and varies with the injection velocity \(U\). We calculated the local slopes of the density gradient curves (Fig. 2b), over a height of \(\delta z = 5\) mm, which represents the minimum thickness of layers that we observed in our experiments. We divided this local slope by the density of water to obtain the local salinity gradient in the mixture \(( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}\). The minimum value of \(( - {\mathrm{d}}\rho /{\mathrm{d}}z)/\rho _{\mathrm{w}}\) in the mixture is used to calculate the Rayleigh number (Fig. 3b).

### Data availability

The datasets generated during and analyzed during the current study are available at http://github.com/xuenan1203/Laboratory-Layered-Latte.

## Additional information

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

## References

- 1.
Whitesides, G. M. & Grzybowski, B. Self-assembly at all scales.

*Science***295**, 2418–2421 (2002). - 2.
Hansen, J. L. et al. Pattern formation: instabilities in sand ripples.

*Nature***410**, 324–325 (2001). - 3.
Schäffer, E., Thurn-Albrecht, T., Russell, T. P. & Steiner, U. Electrically induced structure formation and pattern transfer.

*Nature***403**, 874–877 (2000). - 4.
Basu, S., Gerchman, Y., Collins, C. H., Arnold, F. H. & Weiss, R. A synthetic multicellular system for programmed pattern formation.

*Nature***434**, 1130–1134 (2005). - 5.
Stokes, G. G. On the theory of oscillatory waves.

*Trans. Camb. Philos. Soc.***8**, 441–455 (1847). - 6.
Yuen, H. C. & Lake, B. M. Instabilities of waves on deep water.

*Annu. Rev. Fluid Mech.***12**, 303–334 (1980). - 7.
Cetegen, B. M. & Kasper, K. D. Experiments on the oscillatory behavior of buoyant plumes of helium and helium-air mixtures.

*Phys. Fluids***8**, 2974–2984 (1996). - 8.
Tsuchiya, K. The clouds with the shape of Kármán Vortex Street in the wake of Cheju Island, Korea.

*J. Meteor. Soc.***47**, 457–465 (1969). - 9.
Ukitiro, N., Isonosuke, S. & Yataro, S. Preliminary experiment on the artificial production of snow crystals.

*J. Fac. Sci.***2**, 1–11 (1938). - 10.
Cross, M. C. & Hohenberg, P. C. Pattern formation outside of equilibrium.

*Rev. Mod. Phys.***65**, 851–1112 (1993). - 11.
Mueth, D. M., Crocker, J. C., Esipov, S. E. & Grier, D. G. Origin of stratification in creaming emulsions.

*Phys. Rev. Lett.***77**, 578–581 (1996). - 12.
Feingold, G., Koren, I., Wang, H., Xue, H. & Brewer, W. A. Precipitation-generated oscillations in open cellular cloud fields.

*Nature***466**, 849–852 (2010). - 13.
Bergé, P. & Dubois, M. Rayleigh-Bénard convection.

*Cont. Phys.***25**, 535–582 (1984). - 14.
Bodenschatz, E., Pesch, W. & Ahlers, G. Recent developments in Rayleigh-Bénard convection.

*Annu. Rev. Fluid Mech.***32**, 709–778 (2000). - 15.
Yang, Y., Verzicco, R. & Lohse, D. From convection rolls to finger convection in double-diffusive turbulence.

*Proc. Natl Acad. Sci. USA***113**, 69–73 (2016). - 16.
Stern, M. E. The salt-fountain and thermohaline convection.

*Tellus***12**, 172–175 (1960). - 17.
Turner, J. Double-diffusive phenomena.

*Annu. Rev. Fluid Mech.***6**, 37–54 (1974). - 18.
Chen, C. F., Briggs, D. G. & Wirtz, R. A. Stability of thermal convection in a salinity gradient due to lateral heating.

*Int. J. Heat Mass Transf.***14**, 57–65 (1971). - 19.
Huppert, H. E. & Turner, J. S. Double-diffusive convection.

*J. Fluid Mech.***106**, 299–329 (1981). - 20.
Radko, T.

*Double-Diffusive Convection*(Cambridge Univer. Press: Cambridge, 2013). - 21.
Turner, J. Jets and plumes with negative or reversing buoyancy.

*J. Fluid Mech.***26**, 779–792 (1966). - 22.
Hunt, G. R. & Burridge, H. C. Fountains in industry and nature.

*Annu. Rev. Fluid Mech.***47**, 195–220 (2015). - 23.
Mendenhall, C. E. & Mason, M. The stratified subsidence of fine particles.

*Proc. Natl Acad. Sci. USA***9**, 199–202 (1923). - 24.
Thorpe, S. A., Hutt, P. K. & Soulsby, R. The effect of horizontal gradients on thermohaline convection.

*J. Fluid Mech.***38**, 375–400 (1969). - 25.
Nussinovitch, A.

*Adhesion in Foods: Fundamental Principles and Applications*(Wiley: New York, 2016). - 26.
Griebel, A., Khoshgoftar, M., Novak, T., van Donkelaar, C. & Neu, C. P. Direct noninvasive measurement and numerical modeling of depth-dependent strains in layered agarose constructs.

*J. Biomech.***47**, 2149–2156 (2014). - 27.
Tseng, H. et al. Fabrication and mechanical evaluation of anatomically-inspired quasilaminate hydrogel structures with layer-specific formulations.

*Ann. Biomed. Eng.***41**, 398–407 (2013). - 28.
Meinhart, C. D., Wereley, S. T. & Santiago, J. G. A PIV algorithm for estimating time-averaged velocity fields.

*Fluids Eng.***122**, 285–289 (2000). - 29.
Shipp, P., Shoukri, M. & Carver, M. Double-diffusive natural convection in a closed annulus.

*Numer. Heat Transf. A***24**, 339–356 (1993). - 30.
Nishimura, T., Wakamatsu, M. & Morega, A. M. Oscillatory double-diffusive convection in a rectangular enclosure with combined horizontal temperature and concentration gradients.

*Int. J. Heat Mass Transf.***41**, 1601–1611 (1998). - 31.
Pak, O. S., Zhu, L., Brandt, L. & Lauga, E. Micropropulsion and microrheology in complex uids via symmetry breaking.

*Phys. Fluids***24**, 103102 (2012).

## Acknowledgements

S.K. thanks the Swiss National Science Foundation (P2ELP2-158896) for funding. L.Z. thanks the Swedish Research Council (2015-06334) for a VR International Postdoc Grant. J.K.N. and H.A.S. thank the National Science Foundation (CMMI-1661672) for partial support. We thank Jie Feng, Y. Estella Yu, Suin Shim and Antonio Perazzo for valuable discussions, Ching-Yao Lai for suggestions on gel preparation and Bob Fankhauser for providing an interesting picture of layered patterns formed in coffee that inspired this work.

## Author information

### Affiliations

#### Department of Mechanical and Aerospace Engineering, Princeton University, Princeton, NJ, 08544, USA

- Nan Xue
- , Sepideh Khodaparast
- , Lailai Zhu
- , Janine K. Nunes
- , Hyoungsoo Kim
- & Howard A. Stone

#### Linné Flow Centre and Swedish e-Science Research Centre (SeRC), KTH Mechanics, Stockholm, SE, 10044, Sweden

- Lailai Zhu

#### Department of Mechanical Engineering, Korea Advanced Institute of Science and Technology, Deajeon, 34141, South Korea

- Hyoungsoo Kim

### Authors

### Search for Nan Xue in:

### Search for Sepideh Khodaparast in:

### Search for Lailai Zhu in:

### Search for Janine K. Nunes in:

### Search for Hyoungsoo Kim in:

### Search for Howard A. Stone in:

### Contributions

N.X. and H.A.S. initiated this work. N.X., S.K. and J.K.N. performed the experiments. L.Z. performed the numerical simulations. N.X., S.K., L.Z., J.K.N., H.K. and H.A.S. contributed to analyzing the data, discussing the results and writing and revising the paper.

### Competing interests

The authors declare no competing financial interests.

### Corresponding author

Correspondence to Howard A. Stone.

## Electronic supplementary material

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

## Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.