1 Introduction and motivation

Designing advanced experiments needs substantial planning and also knowledge of what results to expect. Testing different configurations can be costly and time-consuming, and methods to help in this respect may be welcome. When simulations of two-phase flows and experiments with imaging cameras are involved, a special blend of the visualization of numerical results and the images from the experiment by taking into account the omnipresent refraction at phase boundaries may substantially improve the comparability. Then the experimental photograph can directly be compared with the simulated image. Vice versa, the experimental observations can be optimized by analyzing optical ray paths in the virtualized setup with a numerical simulation of the two-phase object inserted. The abstract concept will become more clear by an example: a bubble in water.

The bubble dynamics challenge Bubbles in liquids, a huge topic in science and engineering (Leighton 1994; Brennen 1995; Lauterborn and Kurz 2010; Kalmár et al. 2020), are experimentally demanding objects owing to their fast dynamics on small spatial scales with complicated two-phase three-dimensional topology (Lindau and Lauterborn 2003). Of special interest is the formation of fast liquid jets that appear in non-spherically symmetric environments (Supponen et al. 2016; Rosselló et al. 2018). These jets are one of the reasons for the erosion of hardest materials by bubbles. The jets are formed in either of two ways: either by involution of the bubble interface (Plesset and Chapman 1971; Lauterborn and Bolle 1975) due to restricted flow by a nearby object, or by impact of an annular inflow that then squeezes out the liquid in the respective orthogonal direction (Voinov and Voinov 1976; Lechner et al. 2019). After formation, the jet traverses the interior of the bubble and impacts onto the opposite bubble wall. To follow this phenomenon, it is necessary to have optical access to the interior of the bubble. Up to now, this is mostly done by diffuse illumination from the back (shadowgraphy) or multiple light sources to better show the topography of the deformed bubble surface (Lauterborn 1980; Reuter and Mettin 2016). In shadowgraphy, smooth bubbles then appear black on a bright background with a bright center, where the light can pass undeflected (Reuter and Mettin 2016; Rosselló et al. 2018). The dark view of the rest of the bubble interior is due to the light being deflected off the surface of the bubble and not being able to reach the photographic film or the CCD chip of an electronic camera. An iconic, historic example of a bubble jet (Lauterborn 1980) is presented in Fig. 1a. The bubble was produced by focused laser light in a process called optical breakdown (Lauterborn 1974; Lauterborn and Vogel 2013; Köhler 2010). The bubble is in its re-expansion phase (rebound) after the first collapse. The jet is due to the asymmetry introduced by a solid boundary below the bubble in the direction of the jet. Since only a part of the interior of the bubble is optically accessible, the motion of the jet through the bubble cannot be followed in its entirety. By special illumination and observation, however, the very formation of the jet by involution of the top of the bubble could be photographed (Lindau and Lauterborn 2003).

Fig. 1
figure 1

a Bubble with jet photographed in backlight (shadowgraphy). b Example of simple, 2D ray tracing by applying Snell’s law to a spherical air bubble in water for a bundle of parallel light rays. c, d Standard comparison of an experimental, photographic image of a collapsing bubble in water near a solid boundary (c). Part of the bubble is reflected at the surface of the boundary. A color-coded visualization of the pressure in Pascal and velocity in meters per second in a corresponding numerical simulation as a cut through the bubble is given in d. Ray tracing is intended to bridge the gap between experiment and theory in complex cases of unknown (to be determined) phase objects as shown in c and d

Regarding cavitation bubble dynamics, most publications focus either on numerical or on experimental results, and very few are known that compare experimental and numerical results directly (Lauterborn and Bolle 1975; Ohl and Ory 2000; Blake et al. 2015; Han et al. 2015). This might be due to historical reasons, but with nowadays technological advancement it became possible to simulate the whole experiment.

Pursuing the goal to see into the inside of a bubble, the first, preliminary approach is to study a 2D ray tracing of a small, air-filled sphere in water, based on Snell’s law (Koch 2020). This gives the graphic in Fig. 1b. Here, a case is considered, where the real experiment makes use of a long-distance microscope observing a tiny bubble. Then it can be assumed that only parallel rays will enter an objective to the left of the bubble in the graphic. It is seen that the objective is hit by rays coming from a conical region behind (to the right) of the bubble. The cone has an aperture angle of about 90\(^\circ\). Therefore, to illuminate most of the bubble interior an illumination from behind the spherical bubble with the size of the base of that cone would be necessary. Still, the interior would be mapped towards the center region in the image seen by the microscope, leaving a thick dark outline at the bubble rim. However, this dark rim of the bubble might again be lightened by oblique incidence of light rays due to total reflection, such that the real interface position may become blurred or unclear (compare top and lowermost three rays of Fig. 1b).

When the shape of the bubble under analysis becomes increasingly complex, it is almost impossible to reconstruct it by simple observation. Figure 1c and d are supposed to show the same bubble generated in direct vicinity to a solid surface, but it is evident that the background illumination is distorted strongly by refraction in the experimental image due to the interface of the bubble. How the problem of comparing Fig. 1c and d is solved by ray tracing is explained in the following sections. For short, the comparison is done by placing the numerical version of the bubble (Fig. 1d) at the location of the real bubble into the fully virtualized experimental setup and photographing it numerically via ray tracing. In this study, the feasibility of the ray-tracing method to analyse complex scenarios is explored. Specifically, the case of study will be given by a water jet produced when a bubble collapses close to a solid boundary. The scope is to deduce information from the interior of the bubble to find a more precise means for jet speed measurements.

Historically, Philipp and Lauterborn (1998) found for a spherical bubble that the liquid-jet speed observed has to be multiplied by the refractive index of the surrounding liquid of the bubble. Analytical investigations of Snell’s law have been done for a droplet (Kobel et al. 2009) and also for cylindrical or spherical glass vessels filled with sulfuric acid (Rosselló et al. 2016). In the latter, this method was combined with stereo camera recording and iterative triangulation to determine the position of a bubble inside the vessel. It is important to note that the previous analytic methods are useful only in cases with very simple geometries, and thus cannot be applied to a strongly aspherical bubble.

The combination of the ray-tracing method and computational fluid dynamics is found in other works (Semlitsch 2010; Craig et al. 2016), but in the sense of simulating heat radiation and the reaction of the fluid towards that radiation.

Recently, the ray-tracing method was used in the same sense as presented here, but for single-phase fluid dynamics: a Schlieren image from Large Eddy simulations was compared with experiments of a supersonic gas flow by Luthman et al. (2019). The authors implemented a ray-tracing engine themselves and found very good agreement of the resulting images between experiment and simulation for several flow features, e.g., jet–shock interaction and inferred velocity fields.

Ray tracing of the two-phase flow of a single cavitation bubble was briefly introduced 20 years ago by Ohl and Ory (2000). Applying nowadays computational tools allow for investigations in much higher detail.

Here blender is used, a free and open-source 3D animation tool with a python scripting interface, but the same technique can also be implemented by any optical ray-tracing software. Apart from the enhanced readability of scientific results, it can serve as an alternative validation method of any newly developed (two-phase) computational fluid dynamics simulation code by comparison with the experiment. Another possibility is to redesign experiments to optimize the visualization of specific expected phenomena.

This work is organized as follows The experimental setup and the ray-tracing method are described in Sect. 2. The bubble model for the simulations and the numerical implementation are introduced in Sect. 3. In the results sections, the method is demonstrated in four steps.

First, the ray-tracing method is validated via an experiment and its digitized version using a static, spherical bubble (a simple phase object that can easily be given numerically) and varying the position of the illumination (Sect. 4).

Second, with the confidence in the ray-tracing method, an expanding and collapsing bubble (a previously not known phase object) is investigated, which during collapse produces a pronounced liquid jet (Sect. 5). It is shown that the shape of the bubble can be inferred very well via ray tracing the bubble obtained by the corresponding numerical simulation of the Navier–Stokes equations. The speed of the liquid jet then can be read from the simulation and the value may differ from the one obtained by pure experimental observation. The bubble of this example will be called slow-jet bubble in the following.

Third, an example experiment is shown, where the small size of the cuvette used influences the bubble dynamics to an extent that makes numerical prediction much more complex (Sect. 6). A first guess of the bubble shape from an approximate simulation is taken and manually modified, until the ray-tracing images fit the experimental observation. This example shows how the ray-tracing method can aid in the analysis process even if no simulation code is available. This bubble will be referred to as the jet-speed-illusion bubble, because the distorted jet image leads to an illusionally high jet-velocity impression in the experimental interpretation.

In the last, fourth step, the ray-tracing method is applied to an even more difficult case (Sect. 7). This type of expanding and collapsing bubble, in the following termed the fast-jet bubble, is supposed to exhibit an extensively fast, but hardly measurable jet upon collapse (Lechner et al. 2019). Both the ray-traced numerical simulation and the experimental results match very well, suggesting that the fast jet predicted by the numerical simulation also exists in the real experiment.

2 Experimental setup and ray-tracing method

The image recording of the bubble is done by the high-speed camera Imacon 468 with a K2 Infinity long-distance microscope attached, including a 4\(\times\) magnifying objective (CF-4). This allows for a resolution of

$$\begin{aligned} 298\,\text {px} \pm 4\,\text {px}\,\, \text {per } 500\,\upmu \text {m}\quad \equiv \quad 1.678\,\upmu \text {m}\pm 0.023\,\upmu \text {m}\,\, \text {per pixel}. \end{aligned}$$
(1)

This resolution is diminished by the fact that several pixels are grouped together for the gain applied to increase sensitivity of the ICCD (intensified charge coupled device). Eight pictures can be taken at constant pixel resolution (\(575\times 385\,\text {px}\)) at very high frame rate (down to 10 ns inter-frame time). Hence, the higher the frame rate, the better the triggering circuit must be. The maximum time resolution used in the presented experiments was 150 ns for the exposure time per image and 350 ns between end and start of two successive pictures, resulting in 2 Mfps.

Very bright illumination devices are necessary for the short exposure times applied. Two xenon flashes are used in different manners depending on the experiment: A photo-flash (Mecablitz 36CT2) with a straight flash tube of 50 mm length emitting \(\approx 50\,\text {J}\) and a fresnel lens in front, and a studio flash (Mettle MT-600DR) with a ring flash tube emitting \(\approx 200\,\text {J}\) over about 8 ms. The xenon flash tubes are considered to emit a spectrum similar to daylight; however, for the numerical results presented here, wavelength-dependent refraction is omitted.

The Mecablitz flash was filmed with the high-speed camera Photron APX-RS at 15 kfps using a standard photo-objective (Fig. 2). This was done to import one frame of the record into the digitized setup, serving as illumination source there, too.

Fig. 2
figure 2

Mecablitz flash measured with the Photron camera at 15 kfps and 1 \(\upmu\)s shutter time. The frame at 0.667 ms was used as illumination texture in blender

The bubbles are located inside water-filled glass cuvettes (Hellma). The cuvette sizes differ for each experiment. Since long it is known that observable differences in the dynamics occur for distances up to 10 times the maximum radius from boundaries. Usual maximum radii are in the range of 0.4–1 mm. Thus, it can be expected that only for large enough cuvettes the dynamics of the simulated bubble in semi-unbounded liquid (only the plane solid boundary is close to it) will match the one observed in the experiment. The cuvette sizes are given in the sections of the respective experimental setup.

The cavitation bubbles are generated by optical breakdown in water, induced by a focused nanosecond pulse of a frequency-doubled Nd:YAG laser (Litron Nano PIV) at 532 nm wavelength with a pulse duration of \(\approx 10\,\text {ns}\). The distance of the laser plasma to the nearby solid boundary considerably influences the subsequent bubble dynamics. In Lauterborn et al. (2018), this distance was defined and de-dimensionalized as follows:

$$\begin{aligned} {d/R_\text {max,unbound}=D^*.} \end{aligned}$$
(2)

Here d is the distance of the laser plasma to the solid boundary, and \(R_\text {max,unbound}\) is the theoretical maximum bubble radius before collapse in an unbounded liquid. For small values of \(D^*\), the resulting nearly hemispherical bubble expansion dynamics with complicated collapse dynamics and potential development of a fast, thin jet has been described in Lechner et al. (2019). A general overview on the dependence of bubble collapse dynamics on \(D^*\) is given in Lechner et al. (2020).

The digitization of the experimental arrangement is done including the optically relevant parts, except for the camera objective lenses. The latter are approximated by a perfect camera of 2000 mm focal length and 100 mm sensor size. This skips the necessity of having access to CAD data of the lenses and the outcome is good enough for the purpose of the proposed method, as shown by the validation experiment (Sect. 4). The only disadvantage is that the ray-traced image is always sharp over the whole image, whereas the experimental one is produced with a limited depth of field. The real bubble either is photographed with a sharp center or sharp silhouette. A good compromise was taken for each of the measurements. The optical parts considered relevant to digitization are the bubble, the block of water inside the cuvette, the syringe needle for the static bubble experiment, the solid boundary inside the cuvette, as well as the focusing-lens holder in those experiments, the metal cuvette holder below the cuvette and the illumination sources. The further digitization procedure is described in Sect. 2.5.

2.1 Experimental setup for the static bubble (known phase object)

To validate the ray-tracing method with the help of the blender engine and a known phase object, an experiment was chosen, where a bubble of less than a millimeter in diameter rests attached to a micro-liter syringe needle (Fig. 3). This static bubble then has a very low contact area to the needle and is, therefore, almost perfectly spherical in shape. This scene can be modeled in the blender software as shown in Fig. 3, right.

Fig. 3
figure 3

Experimental arrangement (photograph, left) for a real spherical bubble attached to a needle. The cuvette and the holder plate, as well as the syringe needle and the Mecablitz flash are seen. The corresponding numerical configuration (right) of a static, spherical bubble to validate the ray-tracing method with blender

The complete experimental setup (Fig. 4) consists of essentially six elements: (1) a water-filled glass cuvette with inner size of \(1\,\text {cm}\times 5\,\text {cm} \times 4\,\text {cm}\) in length, width and height, and wall thickness of 2 mm; (2) the Mecablitz flash as background illumination (distance to the bubble \(3.0\,\text {cm}\pm 0.2\,\text {cm}\)); (3) a microliter syringe and needle producing (4) a bubble of about 300 µm in diameter inside the cuvette; (5) the K2 Infinity microscope objective as described above and (6) the high-speed camera (Imacon 468) as described above

Fig. 4
figure 4

Setup for the static bubble experiment. Sketch of the elements of the experimental arrangement a digitized into blender elements b from the perspective indicated by the eye in the sketch. Needle, bubble and water block are modeled as well in blender. The Mecablitz flash texture is taken from Fig. 2 and put onto a plane used as illumination source

The static bubble is photographed with the Imacon 468 camera with same shutter time (150 ns) as in the later experiments for the sake of comparability. The Mecablitz flash position is altered parallel to the cuvette for four positions as indicated in the sketch of Fig. 4a. The same procedure is applied in the digitized setup and the results are compared after contrast optimization of the experimental images. The comparison is done pixelwise and with the structural similarity index SSIM (Wang et al. 2004), as well as the complex wavelet structural similarity index CW-SSIM (Sampat et al. 2009). As stated in the introduction of this section, the major difference between the real and the digitized image is the depth of field. The depth of field in the experiment is limited to less than the bubble diameter. One reason is that the iris had to be opened completely because of the short shutter time.

2.2 Experimental setup for the slow-jet bubble (unknown phase object)

This experiment intends to produce a cavitation bubble with normalized distance \(D^*=0.62\) (see Eq. 2) in a cuvette large enough to have little influence on the bubble dynamics. In this way, the bubble can be approximated to expand and collapse close to an infinite, plane solid boundary located in an unbounded liquid. This configuration is referred to as semi unbounded liquid. This can be simulated very well in axial symmetry with the finite-volume code described in Sect. 3. Very good agreement is found between ray-traced simulation and experiment.

The bubble is generated with a nanosecond pulse of the aforementioned frequency doubled Nd:YAG laser with pulse energy of about 10–30 mJ focused into the cuvette. The focusing is done via a lens with 35 mm focal length. The bubble produces a liquid jet due to the flow restriction by the solid boundary. At \(D^*=0.62\) the jet speed is relatively slow, in the range of 50 m/s. Still, with only eight pictures available per measurement and a jet lifetime of about 5 \(\upmu\)s, the time of triggering must be precise enough. The beam of a continuum wave helium–neon laser, passing the site of the bubble and eventually hitting a photodiode, is used as an optical trigger mechanism. The bubble deflects the light of this beam and the photodiode signal can be used as a trigger measure. This trigger mechanism is not indicated in the setup in Fig. 5, because it is not relevant for the demonstration of the ray-tracing method.

In the setup Fig. 5a, the sketch is given from top and side view. The solid boundary close to the bubble is a standard microscope glass-slide of 1 mm thickness, 1.5 cm width and 5 cm length. A holder tube is glued to the slide. It can be adjusted in xyz-direction with micrometer screws. The digitized setup is given in Fig. 5b. The simulated bubble is put into the virtual setup and photographed from the perspective indicated by the objective. The approximate perspective of Fig. 5b is indicated by the eye in Fig. 5a.

Fig. 5
figure 5

Sketch (a) and digitized representation (b) of the experimental setup for the slow-jet bubble. The bubble is produced near a glass surface put horizontally into the cuvette. Illumination is done by the upright Mecablitz flash. The inner cuvette dimensions are \(5.3\,\text {cm}\times 10.9\,\text {cm} \times 6.0\,\text {cm}\)

2.3 Experimental setup for the jet-speed-illusion bubble (unknown phase object lacking matching simulations)

The setup of Fig. 6 was invented to put the light source as close as possible to the bubble using a cuvette of only \(1\,\text {cm}\times 1\,\text {cm}\times 4\,\text {cm}\) in width, depth and height for a brighter illumination of the bubble. The plasma was produced at a normalized distance \(D^*=0.31\). A bubble was filmed at a shutter time of 150 ns. The measurement serves as an example of how the shape of a phase object of interest can be inferred with the ray-tracing method, even if the numerical simulation can only give a good guess, or if no simulation data are available at all. As experimental and ray-traced jet speeds may differ substantially in this case, the experimental bubble is called jet-speed-illusion bubble.

Fig. 6
figure 6

Sketch in top view (a) and digitized representation (b) in the viewing direction of the eye in a of the experimental setup for the jet-speed-illusion bubble. The bubble is produced on a glass surface put vertically into the cuvette. Illumination is done by the Mettle flash with ring xenon tube

2.4 Experimental setup for the fast-jet bubble (unknown phase object with a hardly measurable phenomenon)

The setup of Fig. 7 was invented in the quest to validate the fast jet predicted in Lechner et al. (2019) with an experiment. After the previous setup design in Sect. 2.3, the size of the cuvette is increased in the direction of the optical axis of the Nd:YAG laser beam. The size is now \(5\,\text {cm}\times 1\,\text {cm}\times 4\,\text {cm}\) in width, depth and height (seen from the objective). Illumination is done by the Mettle flash and triggering of the camera is synchronized to the moment of plasma generation plus a manually entered time delay. The plasma is generated directly at the solid boundary (glass surface in Fig. 7), because a dimensionless distance \(D^*=0\) is intended. In this region of normalized distance, the fast jet is to be expected. The solid boundary can be adjusted in xyz-direction by micrometer screws. Due to the erosive nature of the plasma, after every few laser pulses, the solid boundary had to be lifted a bit to avoid eroding holes into it. The lifetime of the fast jet is about 1 \(\upmu\)s, the window to film it even shorter. Several measurements of highly similar bubbles were stacked to a full sequence. A good agreement between experiment and ray-traced simulation could be achieved, indicating the fast-jet existence.

Fig. 7
figure 7

Sketch in top view (a) and digitized representation (b) in the viewing direction of the eye in a of the experimental setup for the fast-jet bubble. The bubble is produced on a glass surface put vertically into the cuvette. Illumination is done by the Mettle flash with ring xenon tube

2.5 Digitization of the experimental arrangements and ray-tracing method

The idea is to generate a digital image of the interface of a two- or multi-phase object that looks most alike the one obtained from the experiment to bring both to an overlay with close similarity. The shape of the bubble is either gained directly by a (two-phase) computational fluid dynamics simulation or by the manual adaptation of a good initial guess. Assuming that the geometry and dimensions of the experiment are known, the procedure for the numerical side then is the following:

The illumination pattern of the real light sources has to be known very well. Pattern here refers to the intensity profile that one receives by high-speed photography of the illumination source, as e.g. shown for the Mecablitz flash in Fig. 2. If this pattern is available, it can be used for the digitization of the source.

On the digital side, first, the closed interface iso-plane of the two fluid phases (the bubble surface) from the numerical CFD simulation has to be extracted to a standard 3D format. For example, most programs are suited with an import/export function to the stl format (stereo-lithographic). Second, the stl file obtained can be imported into a program with a realistic, light-ray-tracing engine. A variety of specialized ray-tracing programs might exist. Here, the free, open-source project blender is taken because it incorporates a very realistic and physical lighting engine, standard stl import compatibility, a python-language application programming interface (API) and a large variety of 3D editing tools. The latter become important when it comes to modelling the experimental setup, and the API is handy for batch operations on many simulation time steps and parameter scans. Note that the aim is to produce a realistic image from the CFD simulations rather than perform scientific analyses of optics. Thus interference can be neglected, but the intensity and diffusivity of the refraction and reflection at objects matter. The following steps were performed with blender to achieve a realistic image.

The cycles render engine is used (Blender Foundation 2020). This engine emits the light rays from the camera into the 3D scene and distinguishes between so called camera rays, reflected rays, transmission rays and shadow rays. After importing the stl geometry object its surface is smoothed and optionally reduced in redundant complexity by applying the limited dissolve algorithm. This algorithm accounts for reducing the amount of faces while keeping the same shape. This stl geometry is then given a material with an index of refraction (IOR). The so-called GlassBSDF material with an index of refraction of 0.75 suits best for an air bubble in water. Depending on the direction of the normal vectors of the faces of the edited stl geometry object, the IOR ratio either has to be set to 1.333 or \(1/1.333=0.75\). In blender only the IOR ratio is defined for the surface of an object, not the index of refraction for the volume of the object.

The optically relevant geometries (see the introduction of Sect. 2) of the experiment then are created around the bubble geometry along with their optical properties of, e.g., glossiness, light transmission or light emission. Simple diffusive, glossy, glass-like or emissive materials do the work in most cases to mimic optically relevant laboratory equipment. The water of the cuvette is mimicked by a block given the GlassBSDF material with an index of refraction of 1.333. Wavelength-dependent refraction can be modeled for red, green and blue if a special combination of materials is applied. This is disregarded here, because the results are sufficient without doing so. This block can be seen in Figs. 4b till 7b. The solid boundary made of glass, where the bubble expands and collapses close to in the experiment, is modelled by a simple block object of the GlassBSDF material with an index of refraction-ratio with respect to water of \(1.333/1.45=0.92\). If the illumination pattern has not been photographed, the flash tube geometries can be designed adequately and a simple emissive material can be attached to them (see Mettle flash in Figs. 6b,  7b). If the illumination pattern is known, the image can be imported as image texture that serves as input value for the light emission.

The ray-tracing camera is set to approximate the Imacon 468 camera. The view can be achieved by setting a focal length of 2 m and a sensor size of 100 mm and same pixel resolution, as stated already in Sect. 2. The ray-tracing camera is a perfect camera with infinite depth of field. In principle, it can be set up with the same properties as in the experiment concerning focal length, sensor size and pixel resolution, if these properties are known. Presumably, the real depth of field could be modeled by digitizing the lenses of the objective. This in turn increases complexity and thus computation-time. Moreover, CAD data of the lenses would be needed. Furthermore, camera noise or possible stray light as it appears in experiments are not modeled. In ray tracing, the light has no definite wavelength. Therefore, effects of interference are not included. This leads to unusually sharp images with exact boundaries between white and black. The difference in blurring of boundaries must be kept in mind when comparing the following ray-traced images and real photographs. It does not discredit the method for the intended application.

3 Bubble simulation code

The Navier–Stokes equation and continuity equation of the compressible, two-phase flow of a single, laser-generated cavitation bubble are solved with the finite volume method (FVM) together with the volume of fluid (VoF) approach (Weller 2008) within the OpenFOAM framework (Weller et al. 1998). The code has been extensively tested. A brief description will be given here. The reader is referred to Koch et al. (2016), Lechner et al. (2017, 2019) and Lauterborn et al. (2018) for a more detailed description and application.

The asymmetric dynamics of a bubble close to a solid boundary is of special interest due to the liquid-jetting phenomenon. The liquid is compressible for inclusion of pressure waves up to weak shock waves. Surface tension and gravity can be included. The equations are formulated for a single fluid satisfying the continuity, Navier–Stokes and material equations

$$\begin{aligned}&\frac{\partial \rho }{\partial t} + \nabla \cdot (\rho \, \mathbf {U}) = 0 \, , \qquad \nonumber \\&\frac{\partial (\rho \, \mathbf {U})}{\partial t} + \nabla \cdot (\rho \, \mathbf {U} \otimes \mathbf {U}) = - \nabla p + \rho \, \mathbf {g} + \nabla \cdot \mathbb {T} + \mathbf {f}_{\sigma }, \end{aligned}$$
(3)
$$\begin{aligned}&\rho _\mathrm{{g}}(p) = \rho _\mathrm{{n}}{\left( \displaystyle \frac{p}{p_\mathrm{{n}}} \right) ^{1/\gamma _\mathrm{{g}}}} ,\qquad \rho _\mathrm{{l}}(p) = \rho _\infty \left( \frac{p+B}{p_\infty +B}\right) ^{1/n_\mathrm T}, \end{aligned}$$
(4)

with \(\rho , p, \mathbf {U}\) denoting the density, pressure and velocity, \(\nabla\) denotes the gradient, \(\nabla \cdot\) is the divergence and \(\otimes\) the tensorial product. \(\mathbb {T}\) is the viscous stress tensor of a Newtonian fluid, and \(\mathbf {f}_{\sigma }\) denotes the force density due to surface tension and \(\mathbf {g}\) the gravitational acceleration. The pressure and the density of the gas in the bubble at normal conditions are denoted by \(p_\mathrm{{n}}\) and \(\rho _\mathrm{{n}}\), respectively, and \(\gamma _\mathrm{{g}} = 1.4\) denotes the ratio of the specific heats of the gas (air). For the liquid, the Tait equation of state (Eq. 4, right) for water is used (see, e.g., Fujikawa and Akamatsu (1980)) with \(p_\infty\) the atmospheric pressure, \(\rho _\infty\) the equilibrium density, the Tait exponent \(n_{\mathrm T} = 7.15\) and the Tait pressure \(B = 305\,\)MPa. A volume fraction field \(\alpha _\mathrm{{l}}\) with \(\alpha _\mathrm{{l}} = 1\) in the liquid phase and \(\alpha _\mathrm{{l}}= 0\) in the gas phase is introduced to distinguish between the two phases. Density and viscosity fields then can be written as \(\rho = \alpha _\mathrm{{l}} \rho _\mathrm{{l}} + (1-\alpha _\mathrm{{l}}) \rho _\mathrm{{g}}\), \(\mu = \alpha _\mathrm{{l}} \mu _\mathrm{{l}} + (1-\alpha _\mathrm{{l}}) \mu _\mathrm{{g}}\). A transport equation for \(\alpha _\mathrm{{l}}\) is obtained from the continuity equation for the liquid phase, which reads \(\partial _t (\alpha _\mathrm{{l}} \rho _\mathrm{{l}}) + \nabla \cdot (\alpha _\mathrm{{l}} \rho _\mathrm{{l}} \mathbf {U}) = 0\) when mass transfer across the interface is neglected. A pressure-based formulation of the equations is discretized with the FVM in the foam-extend fork (Gschaider et al. 2017) of OpenFOAM.

To capture the dynamics of millimeter-sized, laser-generated bubbles in water it is sufficient to assume isentropic conditions (heat conduction and viscous dissipation can be neglected, the shock waves in the liquid are of weak strength with only a small increase in entropy across the shock). Therefore, barotropic equations of state are provided for the liquid and the gas and the energy equation is dropped. With this model, excellent agreement with experimental data is found for bubbles close to solid boundaries (Koch et al. 2016) concerning the bubble shape as a function of time, up to jet impact.

The simulations of the bubbles in Sects. 5 and 6, the slow-jet bubble and jet-speed-illusion bubble, were done in axial symmetry with about 50,000 cells, while the simulation for the fast-jet bubble, see Sect. 7, is done in full 3D with a mesh of about 6.5 million cells. In both cases, the computational mesh is composed such that it is finest in the core region of the bubble, where the cells are oriented in a Cartesian way, and radially coarsens outwards, with a polar orientation of the cells. The latter allows for an alignment of the cells with the bubble surface during a major part of the bubble evolution. The overall mesh size is chosen 80–100 times the maximum bubble radius (Koch et al. 2016). All simulations are done for the semi-unbounded liquid. The cases were set up with a spatial resolution of 1.35 \(\upmu\)m (slow-jet bubble), 1.5 \(\upmu\)m (jet-speed-illusion bubble) and 1.8 \(\upmu\)m (3D fast-jet bubble case) in the region of the bubble. The initial bubble is a sphere of 20 \(\upmu\)m radius for the slow-jet and fast-jet bubble and a cylinder of 9 \(\upmu\)m radius and 116 \(\upmu\)m height with the center at \(d = 216\,\upmu \text {m}\) above the solid boundary for the jet-illusion bubble. For the slow-jet and the fast-jet case, the initial bubble has a distance of \(d = 367 \,\upmu \text {m}\) and \(d = 21.8\,\upmu \text {m}\), respectively, to the solid boundary. In all cases, the initial internal pressure is in the range of Megapascal [energy deposit case (Lauterborn et al. 2018)], yielding a spherical equivalent maximum radius (radius of a sphere with the same volume of the deformed bubble) of approximately \(565 \,\upmu \text {m}\) for the slow-jet bubble, \(616\,\upmu \text {m}\) for the jet-illusion bubble and \(495\,\upmu \text {m}\) for the fast-jet bubble. The maximum radii \(R_\text {max,unbound}\) (Eq. 2) for the same bubbles in an unbounded liquid amount to \(589\,\upmu \text {m}\), \(688\,\upmu \text {m}\) and \(495\,\upmu \text {m}\), respectively. The initial velocity is zero in all cases.

The adaptive time step is set to not exceed 8.0 times the acoustic Courant number and 0.2 times the fluid flow Courant number during maximum expansion and is limited to 1.0 times the acoustic Courant number during initial expansion and final collapse. Zero velocity and zero pressure gradient boundary conditions are applied to the solid boundary below the bubble, while the far liquid boundaries are kept transmissive for waves at ambient pressure \(p_{\infty } = 101315\,\text {Pa}\) on average.

4 Results for the static bubble (known object)

The ray-tracing method is tested using the setup described in Sect. 4. The result is shown in Fig. 8 for four positions of the background illumination flash (Mecablitz). The first column shows the experimental image obtained with the Imacon 468 camera at a shutter time of 150 ns. This short shutter time is not necessary for the static bubble attached to the syringe needle, but the experiment parameters are chosen similar to the ones for the dynamical bubbles in the later sections. The second column shows the ray-traced results using a sphere with the air material as described in Sect. 2.5. The distances and dimensions of the real experiment have been measured to 2 mm precision. This is also the maximum variation performed for the translation of one object in the digitized setup during adaptation. The camera view was adjusted via an overlay with the experimental image. The third column shows the clipped, inverted, pixelwise subtraction of the ray-traced image from the experimental one. The major difference between the experimental image and the ray-traced is the blurring of the first. The reasons have been described and discussed in Sects. 2 and 2.5.

The structural similarity index SSIM and complex wavelet structural similarity index are given for each flash position (Wang et al. 2004; Sampat et al. 2009). They have been calculated using the python-libraries pyssim and skimage. While SSIM is a weighted multiplication of luminance, contrast and structure, the CW–SSIM makes use of the complex wavelet transform and is more tolerant to image scaling, rotation and translation. Taking the maximum value for each flash position, the similarity ranges between 60.9 % and 72.1 %.

The fourth column shows the sketch of the features seen in the bubble. The bubble has an inner ring that is emphasized in the parts denoted by turquoise lines. The flash shape is denoted in red. The center bar alludes to the horizontal intensity difference in the illumination pattern (see Fig. 2). The thick black line indicates the refraction of the tip of the metal syringe, partly covering the flash. At the extreme positions of the flash, a pronounced region of total reflection is seen at the outline of the bubble, indicated by the thin black line in the sketch (see Fig. 1b for the explanation of the total reflection zone). The thick, grey lines in the sketch denote the reflection of the cuvette holder plate. This is the only feature not apparent in the experimental image, presumably because the metal surface was covered with tape to fix the cuvette. Between the inner ring and the outline, the bubble stays black in most cases observed so far, unless total reflection takes place.

Apart from contrast differences and blurring issues, the similarity between experimental image and ray-traced one is evident.

Fig. 8
figure 8

Comparison of a static bubble attached to a needle in experiment (left column), blender representation (second column), inverted pixelwise subtraction of the experimental bubble from the blender representation (third column) and the explanatory sketch in the fourth column. SSIM denotes the index of structural similarity. The four rows represent 4 different positions of the illuminating flash (Mecablitz flash). Color code in the sketches: flash in red thick line, refraction of syringe needle in black thick line, light grey denotes the refraction of the cuvette table (not present in experiment), turquoise denotes regions of inner-refraction-ring emphasis and the thin black line denotes areas of total reflection (see topmost rays in Fig. 1)

5 Results for the slow-jet bubble

The second example serves as an illustration how ray tracing is used to improve the comparison of experiment and numerical simulation in the context of bubble collapse. In the experiment, a bubble is generated at a dimensionless distance \(D^* \simeq 0.62\) from a solid boundary. After laser-induced breakdown the bubble expands and collapses. During collapse a liquid jet forms by involution of the bubble wall (at the distal side from the solid boundary). Figure 9, odd rows, shows photographs of the bubble during the jetting phase recorded with the Imacon 468 camera. The results are obtained with 150 ns exposure time and an inter-frame time of 500 ns. Time intervals given on top of each frame denote the time that has passed since the triggering of the camera. On the photographs, the solid boundary is oriented horizontally in the lower third of each frame. The bubble is seen on top of the solid boundary together with optical reflections at the solid boundary. The small gap between the bubble and the mirror image of the bubble indicates the location of the solid boundary. The liquid jet in the interior of the bubble is already visible on the first frame (first row) and proceeds further into the bubble on the subsequent frames.

The numerical simulation of bubble expansion and collapse is carried out in axial symmetry. Since the cuvette walls in the experiment are sufficiently far away, their presence is not expected to influence bubble dynamics. The bubble contour is imported into blender and subjected to the ray-tracing algorithm. The result is shown in Fig. 9, even rows. The first frame in the second row has been picked for the best matching sequence. The subsequent frames were selected according to the time intervals in the experiment. The numerical time that passed since the start of the simulation is annotated above each frame. Very good agreement between the photographs of the experimental bubble and the ray-traced numerical bubble contour is found.

The comparison in Fig. 9 allows to draw conclusions on the speed of the liquid jet. A simple pixel counting in the photographs of the experiment reveals that the tip of the jet moves over 36 px between frame 3 (first row) and frame five (first frame in row 3). The apparent speed, therefore, can be computed as (Eq. 1)

$$\begin{aligned} \frac{(36\pm 2)\,\text {px} \, ( 500 \,\upmu \text {m}/(298\pm 4)\,\text {px})}{2.76\,\upmu \text {s}- 1.31\,\upmu \text {s}} = (41.7 \pm 1.7 )\,\text {m/s}. \end{aligned}$$
(5)

Note, that only the first 7 of the 8 frames possibly can be used for determining the jet speed. On the last two frames, the abrupt change of curvature in the outer bubble shape close to the solid (resulting in a kind of pedestal in the bubble shape) shields the jet tip from observation.

In the numerical simulation the speed of the jet tip is not constant, see Fig. 10. The speed increases from \(\sim\) \(48\,\text {m/s}\) at \(t \simeq 114.2 \,\upmu \text {s}\) (first frame, second row) to \(\sim\) 68 m/s at \(t \simeq 118 \,\upmu \text {s}\) (last but one frame, fourth row), from where it stays approximately constant until impact at the opposite bubble wall. The average speed of the jet tip between the third and fifth frame in the numerical simulation is \(\sim\) 62 m/s, to be compared with the values extracted from the experimental photographs.

To conclude, the complex bubble shape in this example prevents an accurate determination of the jet speed from the experimental photographs alone. The experiment has to be accompanied by a theoretical investigation—a numerical solution of the Navier–Stokes equations in this case. Ray tracing is used to confirm the validity of the numerical simulation. The jet speed then can be inferred from the numerical solution.

Fig. 9
figure 9

Dynamical bubble jetting towards the solid boundary. Odd rows show the experimental recording at 1,538,462 fps and even rows show the ray-traced numerical simulation. Frame width is \(965\,\upmu \text {m}\pm 22\,\upmu \text {m}\)

Fig. 10
figure 10

Jet speed of the simulated bubble of Fig. 9 as a function of time (line) and jet-speed values (data with error bars) gained by pixel-counting of the experimental bubble for subsequent frames

6 Results for the jet-speed-illusion bubble (unknown object)

The jet-speed illusion bubble serves as an example to show that refraction can be even more deceiving than in the last section and apparently can triplicate the jet velocity. The ray-tracing method can be used to infer the shape of a strongly aspherical bubble and correct the jet velocity value, even if only a rough initial guess of the bubble shape is available.

The main differences in the setup as compared to the bubble in the previous section are a smaller initial dimensionless distance \(D^*\) of the bubble from the solid boundary as well as using a cuvette of considerable smaller dimensions than in Sect. 5. The presence of close-by cuvette walls influences the dynamics of the bubble.

As an example of the expected bubble dynamics and distortions of the illumination light, distinct time steps of a simulation performed with the code described in Sect. 3 are shown in Fig. 11. The laser-induced breakdown creates an elongated plasma which is modelled by an initial gas cylinder of high internal pressure at a distance of 216 \(\upmu\)m to the wall, resulting in a dimensionless distance of \(D^*= 0.31\) (Eq. 2). The cross section of the bubble is shown in Fig. 11, together with the refraction of a pattern of 17 straight illumination stripes of alternating color (white, yellow and pink) behind the bubble. Each stripe has dimensions of \(50.8\,\text {mm} \times 1\,\text {mm}\) in length and width. The stripe-to-stripe distance is 1.6 mm and the pattern is put in a distance of 10 mm behind the bubble, i.e. 5 mm behind the cuvette. The overall size of the pattern is \(50.8\,\text {mm} \times 26.8\,\text {mm}\). In one of the plots, the pattern is put in vertical, in the other frame in horizontal orientation. The vertical and horizontal pattern alignment is ray-traced and compared to the cross section of the bubble.

Fig. 11
figure 11

Ray tracing of a regular, symmetric illumination pattern with alternating color (pink and white–yellow next to the center) behind the small cuvette shown here with darker glass and lighter bubble for better contrast (first row). Note that the cuvette is rotated by 90\(^\circ\) to the left compared to Fig. 6. Simulated bubble with illuminating rectangle in horizontal alignment (second row) and in vertical alignment (third row). The bubble is mirrored in the glass surface. Fourth row shows the bubble cross section (not ray-traced). Frame width of the ray-traced bubbles is 1162 \(\upmu\)m, the one of the cross section is 1600 \(\upmu\)m (different for the sake of visibility of the details)

Illumination grids or patterns are used for example to correct lens aberration (Nobach 2012). The pattern deformation gives insight into the refraction distortion. In contrast to lenses, the distortion here is beyond linear approximations. It can be seen that for the time of interest, i.e., the jetting phase around 139–\(142.6\,\upmu \text {s}\), it is challenging to get an illumination configuration where the jet and bubble interior are clearly separated. That is why the illumination device has to be designed and placed accurately. The circular geometry of the flash tube in the experiment fulfills the design requirement. If the illumination enters the bubble from a too high polar angle, centered behind the bubble, the jet may become bright instead of dark. This is an issue, when the rest of the bubble interior is bright as well. Therefore, the simple assumption that the liquid jet can be approximated by a cylinder, where light from behind can pass through undeflected, rarely holds.

The results in Fig. 12 were obtained with 150 ns exposure time and an inter-frame time of 500 ns between the end of the previous frame and start of the next frame. The glass surface wall is located at the bottom of the frames, indicated by the red line in the first frame, so the image is rotated by 90\(^\circ\) compared to the setup sketch in Fig. 6b.

Fig. 12
figure 12

Liquid jet piercing the bubble, captured at 1.538 Mfps. The first frame shows the plasma of the laser-induced breakdown. The red line in the first frame indicates, where the solid boundary (glass) is located in the frames

The first frame shows the plasma formation at the beginning. The times and spatial scale are indicated within the frames. The jet formation is seen clearly by a dark shadow piercing the bubble from top to bottom and widening over time. There seem to be two windows of the outer bubble interface through which the jet can be observed: One big window in the middle and a narrower at the bottom. In the latter, the jet is only visible from frame 6 (\(t = 112.1 \,\upmu {\text{s}}\)) onward, although it has pierced the bigger window already in frame 3. To conclude, there is some nonlinear distortion of the apparent jet speed by refraction. If the experiment was evaluated only by pixel counting, the following minimum jet speed would be found, taking the time between the end of the second frame and the end of the third frame of the top row:

$$\begin{aligned} \frac{500\,\upmu \text {m}/(352\pm 4)\,\text {px}}{110.3\,\upmu \text {s}- 109.65\,\upmu \text {s}}\cdot (80\pm 2)\,\text {px} =(174.8 \pm 3.2)\,\text {m/s}. \end{aligned}$$
(6)

The amount of pixels per 500 \(\upmu\)m here is slightly higher than the one in the last section because the zoom of the K2 Infinity microscope was adjusted.

The appearance of light and shadow features highly depends on slightest changes of the interface curvature due to the nonlinearity in Snell’s law. For determining the correct bubble shape from the photographs in Fig. 12, the bubble contour from the numerical simulation in Fig. 11 is taken as a basis. The simulation gives a bubble involution dynamics as shown in Fig. 13.

Fig. 13
figure 13

The contour lines of half of the cross section of the numerical bubble in Fig. 11 for several instants of time during jetting, taken as a good initial guess. Distance from the solid boundary on the y-axis and distance from the axis of symmetry on the x-axis

The contour now is imported into blender and reduced in grid complexity while keeping the shape. It is then rotated and extruded around the axis of symmetry. The curvature of the contour profile curve determines the curvature of the resulting object, the bubble probe. The shape of the bubble probe can be adopted such that it resembles the experimental one by manually altering parts of the profile curve while watching the ray-tracing image outcome. This process has been applied to the bubble contours in Fig. 13 and is shown in Fig. 14. The contour adaptation was done manually and bare eye criterion for matching was used. The resolution was limited to an amount of about 30 segments to make it manually manageable. One could think of an automation process by, e.g. SSIM maximisation for future projects. Here, the manual way for the sake of presenting the concept of the method is chosen.

Fig. 14
figure 14

The jet-speed illusion. Top row: experimental photographs. Second row: ray tracing of the manually adjusted profile that is defined by the colored curve shown in the third row

Fig. 15
figure 15

Example of the effect of a slight change of the bubble interface shape. The black contour line produces the second ray-tracing frame, whereas the original orange line produces the first frame

In some parts of the profile curve even a change in inclination by only a fraction of a degree results, e.g., into a fully light or half dark bubble interior. An example of the sensitivity of the shape is given in Fig. 15, where the effect of a slight change in the interface curvature changes the image.

Now the jet velocity can be recalculated using the bubble contours in the bottom row of Fig. 14:

$$\begin{aligned} \frac{250\,\upmu \text {m}/246\,\text {px}}{110.3\,\upmu \text {s}- 109.65\,\upmu \text {s}}\cdot 87\,\text {px} \approx 57\,\text {m/s}, \end{aligned}$$
(7)

giving approximately one third of the value that was derived from the photographs. The amount of pixels per 250 \(\upmu\)m are taken from the bubble contours in the bottom row of Fig. 14, as well.

7 Results for the fast-jet bubble

The confidence in the ray-tracing method gained by the previous experiments led to the application for a bubble with the hardly measurable phenomenon of the fast jet. Actually, it were the difficulties with the experimental fast jet that started the ray-tracing method for better extraction of results from experiments. The fast-jet bubble was recorded with high temporal precision and generated at a dimensionless distance of \(D^*= 0.04\). It is taken as an example, where the ray-tracing method may give a hint for the existence of hardly measurable phenomena. The result is shown in Fig. 16. The odd rows show the photographs of the experiment and the even rows show the ray tracing of the 3D CFD simulation of the bubble (depicted representatively in Fig. 17). The frames again are rotated such that the glass surface boundary is located in the lower part. The first frame shows the plasma of the laser-induced breakdown, and from the second frame onward the collapse phase of the bubble is shown. The sequence is a collection from seven measurements in total. The exposure time was the same for all measurements (150 ns) while the inter-frame time varied from 1 \(\upmu\)s to 350 ns. By stacking the single frames of the reproducible measurements together, a time resolution down to \(40\,\text {ns}\) corresponding to a frame rate of \(25\,\text {Mfps}\) could be achieved. Here, the times of the simulation are taken to indicate the time progression.

Fig. 16
figure 16

Bubble generated directly at the solid boundary. Odd rows are experimental recordings, even rows are ray-tracing images of the numerical simulation. Exposure time of the experimental frames is 150 ns, except for the first frame with the plasma, which has an exposure time of 500 ns and is enhanced in contrast. The blender-ray-tracing of the full 3D simulation of Fig. 17 at instants of time resembling the ones in the experiment is shown in the even rows. The width of the frames is 664.5 \(\upmu\)m. For the three important frames for the jet, the bubble is also magnified and enhanced in contrast. At 113.553  \(\upmu\)s the fast, needle-like jet can best be detected

The typical bell shape is seen, which was already reported in Benjamin and Ellis (1966) and predicted in Lechner et al. (2019) by means of numerical simulations in axial symmetry. The ray tracing shows most light and shadow features of the experiment. The bubble is magnified in inlet frames in the last time steps in Fig. 16, so that it can be seen that the bubble was indeed pierced. A visualization of the numerical simulation at time \(t= 113.52 \,\upmu \text {s}\) is given in Fig. 17. The left frame shows the 3D bubble contour together with the pressure field at the solid surface. The right frame shows the velocity field in the liquid at a cross sectional plane through the bubble. With a spatial resolution of 1.8  \(\upmu\)m  the numerical simulation predicts the formation of a fast jet with a maximum speed of at least 732.2 m/s.

Fig. 17
figure 17

Underlying full 3D simulation of the fast-jet bubble. a Contour plot of the bubble interface with the pressure in Pascal plotted in the plane of the solid boundary. b Cross section through the same bubble, plotted with the liquid velocity in m/s

Figures 16 and 17 together prove that a) the bubble shape including the fast jet is not an artefact of axial symmetry, but a full 3D feature and b) the bubble shape is well captured by the CFD simulations. Taking these arguments together, it is most likely that there was a fast jet occurring also in the real experiment.

This shows that the ray-tracing method multiplies scientific interpretation possibilities for (two-phase) fluid flows, even reaching out to hardly measurable phenomena.

8 Conclusion

By illuminating the numerical bubbles of the finite-volume simulations in a digitized version of the experimental setup via ray tracing, it was made possible to directly compare them to experiments with excellent agreement. Thus, it has been shown that the 3D editing and ray-tracing software blender can be used as a scientific post- and pre-processing method. After validating the ray-tracing method with a static, spherical bubble attached to a needle, the method was applied to scientifically crucial experiments: jetting bubbles in close vicinity of a solid boundary. The ray-traced images of the simulations were compared to experiments, where bubble jets were recorded with ultra-high-speed imaging. Because of the congruence achieved, it can first of all be deduced that the ray-tracing method works well and the CFD simulation code produces valid results for the tested scenarios. Assuming that the congruence allows for generalization, the following criteria relevant for the physics of single cavitation bubbles could be deduced:

  • A new method for jet-speed determination is proposed.

  • For small initial distances of bubble generation to the solid boundary in small cuvettes/confinements there might be jets seen in the experiments that optically appear much faster than they actually are. This fact arises from the interface shape alienation from a simple sphere and thus complications in refraction patterns. This holds for the specific combination of cuvette and illumination installed. Previous measurements must be revisited.

  • For an initial bubble distance tending to zero (\(D^*=0\)), probably there exists a fast jet with a velocity exceeding 700 m/s. An exact number cannot be given here, since the time consuming 3D simulation was only performed for one resolution, lacking a convergence study. The fast jet was predicted in Lechner et al. (2019) via calculations in axial symmetry. Here it is shown that this jet also is formed in a full 3D simulation and that the results of the ray-traced bubble shape compare well to the ones obtained in the experiment.

In general, it was shown that the ray-tracing method improves interpretation possibilities of experimental results. The method indirectly confirmed the validity of the code used to simulate the cavitation bubbles.