1 Introduction

The Synthetic Schlieren (Dalziel et al. 2000) or Background-Oriented Schlieren (BOS) (Meier 2002; Raffel 2015; Settles and Hargather 2017) techniques provide whole-field measurements of density gradients of perturbations that are superimposed on a stably stratified vertically dependent background stratification. When working with density-stratified fluids, the technique is usually called Synthetic Schlieren. One of the strengths of this technique is the simplicity of the experimental set-up. In a typical application, perturbations (internal gravity waves) are imaged. Two or more images are compared using Digital Image Correlation (DIC) (Sutton et al. 2009). This comparison yields the apparent displacements of stationary dots, fixed on a light-bank behind the tank. These dots appear to move due to perturbations of the fluid through which they are observed, which affect light refraction and paths between the images. These displacements are related to gradients of the index of refraction using a ray tracing model and to gradients of the density perturbations through the Gladstone–Dale relation.

There are several approaches to determine the density field from density gradients via post-processing. The density field can be obtained by solving a Poisson equation. This requires choosing a priori unknown boundary conditions. One downside is the propagation of uncertainties from Synthetic Schlieren-based perturbation density gradients to the perturbation density field calculation (Hazewinkel et al. 2011; Passaggia et al. 2020; Venkatakrishnan and GEA Meier 2004; Verso and Liberzon 2015). In compressible aerodynamics, multiple cameras and tomographic reconstructions (e.g., Grauer and Steinberg 2020; Molnar et al. 2023) are required or the use of a radon transformation plus a priori knowledge of the flow field (e.g., Braukmann et al. 2021).

In this paper, we present a novel application, in set-up similar to the Synthetic Schlieren technique, to measure the density field directly. The model in our application does not work on the density perturbations but on any density field: static and dynamic. This application provides a direct full-field measurement of a primitive variable (the density field) in fluid mechanics. We take images of stationary dots in three situations: (1) before filling a tank, through air, (2) after filling the tank with a homogeneous-density calibration fluid and (3) after filling the tank with our target (possibly stratified) fluid, whose density field is unknown and which potentially varies in space and time. DIC is performed to obtain displacements between the images. Using a ray tracing model, these displacements are related to the index of refraction. Through the Gladstone–Dale relation, a two-dimensional density field, a path integral of a three-dimensional density volume, is determined. For comparison purposes, after obtaining the density field, the vertical derivative determines the vertical density gradient of the target fluid.

In the present paper, the camera is placed under an angle \(\alpha\) with respect to the water tank, see Fig. 1. An angle \(\alpha = {0\,\mathrm{{}^{\circ }}}\) corresponds to a classical Synthetic Schlieren set-up, where the optical axis of the camera is perpendicular to the walls of the water tank such that light rays are not refracted. The refraction of light rays has a dependence on incidence angle, which makes a naive application, without knowledge of fundamentals of light refraction, sensitive to noise. In Sect. 2, we illustrate this naive application and analyze its shortcomings. We will show that the apparent pattern displacement can be magnified by placing our camera at nonzero angles \(\alpha\), which ensures light rays are refracted more.

Fig. 1
figure 1

The experimental set-up: the orientation of a camera with respect to the normal \({\varvec{e}}_\zeta\) from a water tank is given by the angle \(\alpha\). A probe is hanging inside the tank, ready to move up and down to measure a density profile of a fluid. The tank is being filled through tubes on the right hand side of the tank. The camera’s line of sight is indicated by a straight line

Section 3 discusses the experimental set-up and the DIC technique, and parameters for a typical DIC calculation in our experiments are provided. In Sect. 4, a full three-dimensional forward model is derived, allowing large viewing angles \(\alpha\): given an index of refraction field and experimental parameters, the displacement field can be computed. Because we place our camera under an angle, we do not observe the angle for which the displacements are zero. This requires a calibration procedure, which determines the angle \(\alpha\) and distance of our camera relative to the tank. Last, we discuss how to solve our inverse model: how to obtain the index of refraction from the experimentally obtained displacements and our forward model.

Section 5 presents measurements for three fluids: a two-layer system, a linear stratification and a nonlinear stratification. These are full-field measurements of the density and vertical density gradients. To validate these measurements, we horizontally average the density fields to compare the resulting density profiles with a second, independent measurement of these density profiles: a density measurement using a probe consisting of a conductivity and a temperature sensor. Section 6 discusses the novel application and offers suggestions for improvements.

2 Frontal view: simple model

To measure the density of a fluid in a tank, we start by using the classical approach that employs a frontal view—with the optical axis perpendicular to the experimental set-up. In Sect. 2.1, a relation between the apparent displacements of the dots on a static pattern and index of refraction is derived. In Sect. 2.2, this relation is used on measurement data to determine the density of a fluid. Large variations appear and in Sect. 2.3 the failure of this naive approach is analyzed by deriving error estimates as a function of viewing angles.

2.1 Derivation simple model

Consider an experimental set-up where light rays travel from a light bench having a random dot pattern attached to it, through a water tank to a camera; see Fig. 2. We describe the camera as a pinhole camera. The paths of the light rays depend on the refractive index of the medium encountered inside the tank. We place a right-handed Cartesian coordinate system (xyz) on the image plane with the z-axis pointing in the direction of the optical axis of the camera. Another right-handed Cartesian coordinate system (\(\xi \eta \zeta\)) is located at the object plane. Note that \(\eta\) points in the downward (\(y<0\)) gravity direction. The \(\zeta\)-axis is perpendicular to the experimental set-up, i.e., such that a light ray traveling along the \(\zeta\)-axis will not be refracted by the set-up. In the simple model, the angle \(\alpha = 0\) and the z- and \(\zeta\)-directions are opposite and parallel to each other.

Fig. 2
figure 2

A schematic view of the path of a light ray for a frontal placement of the camera with \(\alpha = {0\,\mathrm{{}^{\circ }}}\). \(n_\mathrm{{air}}\), \(n_g\) and \(n_f\) are the indices of refraction of, respectively, air, the glass tank walls and the fluid. \(\theta _x\) is the angle of a light ray with respect to the z-axis. Subsequently using air and water as fluid, light rays (solid and dashed red lines, respectively) starting at the same location on the image plane, \(z=0\), originate from two different locations in the object plane, the light-bank. They appear to be a distance \(\Delta \xi\) apart, due to differences in refraction index of the fluid in the tank. Planes 2 - 5 are refraction planes, 0 is the image plane, 1 the position of the pinhole and 6 the object plane. The lengths \(L_{\langle \cdot \rangle }\) indicate the lengths between the planes in the \(\zeta\)-direction

For each light ray, we want to determine the \(\xi\)-position where the light ray originated from, \(\xi = x_6\). For now, consider light rays emitted at \(\eta =0\) for which \(\theta _y = 0\). The light rays pass through the pinhole at \(x_1 = 0\) having an angle \(\theta _x\). Assuming the refractive index in each section of the set-up is constant, we can write for the light path,

$$\begin{aligned} x(z) = x_{j} + (z-z_{j}) \tan \theta _x^j, \qquad j = 1, \hdots , 5, \end{aligned}$$
(1)

where (\(x_{j}\), \(z_{j}\)) are the coordinates of the light ray at the start of each section and \(\theta _x^{j}\) is the angle between the ray’s propagation direction and the z-axis. When encountering a discontinuous change in refractive index (a refraction plane), we invoke Snell’s law,

$$\begin{aligned} n_{j} \sin \theta _x^{j} = \text{ constant }, \qquad j = 1, \hdots , 5, \end{aligned}$$
(2)

where \(n_{j}\) is the refractive index for the jth section. After repeated application of (1) and (2) and dropping the superscript 1 from the angle for the first section, the position \(\xi\) is

$$\begin{aligned} \begin{aligned} \xi (\theta _x, n_f)&= (L_c+L_s) \tan \theta _x + \frac{2 L_g n_\mathrm{{air}} \sin \theta _x}{\sqrt{n_g^2 - n_\mathrm{{air}} ^2 \sin ^2 \theta _x}} \\&\quad + \frac{L_t n_\mathrm{{air}} \sin \theta _x}{\sqrt{n_f^2 - n_\mathrm{{air}} ^2 \sin ^2 \theta _x}}. \end{aligned} \end{aligned}$$
(3)

The displacement \(\Delta \xi\) is the difference in position \(\xi\) between the constant reference state in which \(n_f = n_\mathrm{{air}}\), when the tank is filled with air, and the unknown state that we aim to determine in which \(n_f=n\), when the tank is filled with water of unknown refractive index n,

$$\begin{aligned} \begin{aligned} \Delta \xi&= \xi (\theta _x, n_f = n_\mathrm{{air}} ) - \xi (\theta _x, n_f = n) \\&= L_t \Bigl (\tan \theta _x- \frac{n_\mathrm{{air}} \sin \theta _x}{\sqrt{n^2 - n_\mathrm{{air}} ^2 \sin ^2 \theta _x}}\Bigr ), \end{aligned} \end{aligned}$$
(4)

where the distance of camera to tank, \(L_c\), the glass thickness, \(L_g\), and the light-bank distance, \(L_s\), drop out. Inverting this relation, we obtain the unknown refractive index n as a function of the displacement \(\Delta \xi\),

$$\begin{aligned} n =\frac{n_\mathrm{{air}} \sin \theta _x}{\tan \theta _x-\tfrac{\Delta \xi }{L_t}} \sqrt{1+\bigl (\tan \theta _x-\tfrac{\Delta \xi }{L_t}\bigr )^2}. \end{aligned}$$
(5)

For the displacement \(\Delta \eta\) similar relations to (4) and (5) hold. To obtain the density from the refractive index, we use the Gladstone–Dale relation with the Gladstone–Dale constant from Dalziel et al. (2000),

$$\begin{aligned} n = 1.333 + 0.245(\rho - 1.00). \end{aligned}$$
(6)
Fig. 3
figure 3

Raw images for a frontal view with \(\alpha = {0\,\mathrm{{}^{\circ }}}\). Applying DIC to the blue rectangle in (b) (filled with tap water) and the entire image in (a) (filled with air) yields the displacements in Fig. 4. The black horizontal line that appears in (b) is the water surface. The black bar at the top of the images is the probe

Fig. 4
figure 4

Frontal model results (\(\alpha = {0\,\mathrm{{}^{\circ }}}\)) for the images in Fig. 3: the displacements in the top row in (a) horizontal, \(\Delta \xi\), (b) vertical, \(\Delta \eta\) and (c) radial direction, \(\Delta\). Using (5) and (6), the densities \(\rho\) in the bottom row (d, e, f) follow. The density fields show large variations while the expected density of tap water is \({1.0}\,\hbox {g/cm}^{3}\)

2.2 Results naive application

Using this naive application, without knowledge of light refraction, we aim to measure the density of tap water optically. Figure 3 shows two frontal images of the experimental set-up: one without water in Fig. 3a and one with tap water in Fig. 3b. Applying DIC to the blue rectangle in Fig. 3b and the entire image in Fig. 3a yields the displacements in the top row of Fig. 4, in (a) horizontal, \(\Delta \xi\), (b) vertical, \(\Delta \eta\) and (c) radial direction, \(\Delta = \sqrt{\xi ^2+\eta ^2}\). Using (5) and (6) the densities in the bottom row of Fig. 4d–f, follow for each displacement figure.

The density field in Fig. 4f looks best but still has a density range of 0.77 to \({1.38}\,\hbox {g/cm}^{3}\). These density values are unphysical since the density of water without added salts is \({1.0}\,\hbox {g/cm}^{3}\), and the maximum density of salt water is \({1.2}\,\hbox {g/cm}^{3}\) (at room temperature). The water in the tank is tap water, without added salts. Computing the difference between the horizontally averaged densities in Fig. 4d–f and the expected density \({1.0}\,\hbox {g/cm}^{3}\) through

$$\begin{aligned} ||\Delta \rho ||_2 = \sqrt{\frac{1}{M} \sum _{m=1}^M \Delta \rho _m^2}, \end{aligned}$$
(7)

with M the number of (vertical) grid points, yields 35, 338 and \(15\,\hbox {mg/cm}^{3}\), respectively.

2.3 Analysis of simple model

At the point where light rays cross the water tank normal to the glass surface, there will be no refraction. Indeed, (4) shows that when the angle \(\theta _x\) goes to zero, the displacement \(\Delta \xi\) goes to zero. Then, (5) takes on an indeterminate form. In any measurement, we have noise, resulting in uncertainties in (the measured values of) \(\Delta \xi\) and \(\theta _x\). These uncertainties have a large effect on the value of n since the expected values of \(\Delta \xi\) and \(\theta _x\) are small. The Signal-to-Noise Ratio is low because our signal is small. To solve this, we want \(\theta _x\) to always be nonzero and not too small. Then, according to (4), \(\Delta \xi\) does not approach zero and (5) does not take on an indeterminate form. This can already be observed in Fig. 4d–f: the calculated values for the density are much better in the periphery, when the light rays are away from the optical axis.

To amplify our signal, we want \(\Delta \xi\) and \(\theta _x\) to vary with n as much as possible. So, we want n to vary with \(\Delta \xi\) and \(\theta _x\) as little as possible. Figure 5 therefore shows a plot of the derivatives of n, given by (5), with respect to \(\chi = \Delta \xi /L_t\) and \(\theta _x\) (Nemoto 1992). The accuracy of the determination of the optical axis is determined by the noise level and \(\partial n/\partial \theta _x\). The accuracy of the displacements is determined by the noise level, \(\partial n/\partial \chi\) and the accuracy with which the optical axis was determined. The worst possible angle to measure at is \(0^\circ\), when the optical axis is perpendicular to the tank. Placing the camera at a nonzero angle \(\alpha\) with respect to the water tank thus slightly increases the noise in n, while increasing the signal; it definitely ensures the signal is nonzero. The Signal-to-Noise Ratio becomes larger because our signal increases more than our noise.

The cross section of the measured tank reduces with increasing viewing angle \(\alpha\) since we use only those light rays that travel along the full length of the tank. For a tank with width \(W_t\) and length \(L_t\) (as in Fig. 2), the aspect ratio \(\text {AR} = L_t/W_t\) and the relative loss in cross section is \(W_\mathrm{{loss}} = \text {AR}\cdot \tan \alpha\). This is a lower limit on the loss of cross section since we ignored the difference in refractive index of the fluid in the tank, which can cause a large apparent background displacements for an air versus water measurement set. The width \(W_t\) can also be limited by the field of view of the camera. For large viewing angles, the effective width that can be observed becomes impractically small, see Fig. 5. We have a trade-off: for increasing viewing angles both the error and the effective width decrease.

Fig. 5
figure 5

The error in the displacements depends on the derivative of n with respect to \(\chi = \Delta \xi / L_t\) (blue) and the error in the determination of the optical axis (calibration) depends on the derivative with respect to \(\theta _x\) (red); both are a function of \(\theta _x\). The angle \(\theta _x = 0^\circ\) is the worst angle to measure at. The relative reduction in the cross section of the measured tank is given by \(W_{loss}\), for different aspect ratio’s (AR). A range in angles (in purple) is shown around a nonzero angle of \(\alpha = {30\,\mathrm{{}^{\circ }}}\!\), which roughly indicates optimal viewing angles from the camera to the experimental set-up

3 Experimental set-up and tracking displacements in images

In this section, we describe the experimental set-up and how to track displacements in images in Sect. 3.1. Backwards mapping in DIC is discussed in Sect. 3.2, and the use of a Region of Compensation is discussed in Sect. 3.3.

The novel application is in set-up similar to a Synthetic Schlieren measurement: a tank filled with water, a light-bank with uniform lightning covered by random dots and a camera. Light rays would emanate from the light-bank, be disturbed by the water in the tank and fall onto a camera. The density stratifications were constructed using the double bucket method (Oster 1965). For image acquisition, we used two different commercial monochromatic cameras (MD120MU-SY, XIMEA GmbH and AVT Pike F-505B). The main difference in set-up with Synthetic Schlieren is that the camera was placed under a horizontal angle \(\alpha\) of approximately \({30\,\mathrm{{}^{\circ }}}\!\), which can be achieved by moving and rotating the camera or rotating the tank and light-bank, see Fig. 1.

We used a tank with dimensions of \(25 \times 13 \times {50\,\mathrm{\text {c}\text {m}}}\) (width \(\times\) length \(\times\) height). The aspect ratio \(\text {AR} \approx 0.5\). We filled the tank to approximately \({30\,\mathrm{\text {c}\text {m}}}\) height. The tank was made of glass plates with a thickness \(L_g\) of \({6\,\mathrm{\text {m}\text {m}}}\). We placed the camera at a distance \(L_c\) of approximately \({1\,\mathrm{\text {m}}}\). The tank was placed against the light-bank such that \(L_s = 0\).

3.1 Digital image correlation

Digital Image Correlation (DIC) is a technique to obtain deformation maps from images. We use second-order shape functions (Lu and Cary 2000) to handle large nonlinear deformations of multi-layered fluids with large density jumps along their interfaces. To attain sub-pixel accuracy, we interpolate our images with B-splines (Unser 1999). To obtain the deformations, we optimize a correlation coefficient C, the ZNSSD (Sutton et al. 2009). We solve this nonlinear least-squares problem by (1) providing an initial guess and (2) solving an iterative scheme. As an initial guess, we perform Template Matching (Bradski 2000) on a limited set of points to obtain rigid deformations with pixel accuracy. After applying DIC to obtain sub-pixel deformations of this set of points, we use reliability-guided DIC (Pan et al. 2012). As an iterative scheme, we use the Levenberg–Marquardt (LM) algorithm. For practical considerations for DIC, we refer to Sutton et al. (2009), in particular Chapter 10.

After obtaining the raw images, we average them (in case of static measurements) and prefilter them with a Gaussian blur with kernel size five. Then, the DIC technique is applied to the processed images to obtain the displacement fields. The displacement fields were confirmed with the software package DaVis 10.2.

Table 1 Digital Image Correlation parameters for a measurement at an angle \(\alpha = {30\,\mathrm{{}^{\circ}}}\)

Table 1 shows typical DIC parameters for our experiments. Additionally, the accuracy of the obtained displacements and densities is given. The determination of the vertical density gradient involves taking derivatives of the density field. This resembles a common application of DIC: the determination of strains from displacement data. We use central differences to obtain the derivatives. Information is low-pass filtered by a DIC subset. The step size oversamples and would unnecessarily amplify noise. We chose to use a hamming window to filter the density field at the subset size scale.

3.2 Backwards mapping

In the measurements with stratified fluids with large density jumps, such as multi-layer fluids, we observed that the same dot pattern (subset) from the tap water fluid appeared on multiple locations in the stratified fluid. This was a problem for the DIC procedure: there was no bijection, no one-to-one correspondence, between the two images. When mapping backwards, performing DIC from the stratified fluid to the tap water fluid, the mapping is a surjection. This made the mapping solvable for the DIC procedure: every subset in the stratified fluid image had a single corresponding subset in the tap water fluid. Mapping backwards slightly improved the results for all measurements, even for stratified fluids without large density jumps.

3.3 Region of compensation

The experimental procedure takes time: recording images of the tank filled with air, filling the tank with water with a known index of refraction, recording for the calibration, emptying the tank, filling the tank with a stratified fluid and recording its density field. Sometimes in the experiments, small movements occurred: e.g., filling the tank with water moved the tank downward by about 0.2 pixel \(\approx\) \({0.03\,\mathrm{\text {m}\text {m}}}\). When the background dot pattern was attached to the tank, our model would erroneously attribute this displacement to the index of refraction. To determine whether there was movement, we employed a Region of Compensation (Pan et al. 2014): we observed regions outside the tank (and through the tank without fluid), where there should be no movement. If a uniform displacement was observed, this was subtracted from the displacement fields inside the tank. In Fig. 3b, we used the region above the water surface as Region of Compensation.

4 Viewing angle: full oblique model

We derive a full three-dimensional forward model in Sect. 4.1, allowing large viewing angles \(\alpha\). This is an extension of Eqs. (3) and (4). Because we place our camera under an oblique angle, we do not observe the angle for which the displacements are zero. In Sect. 4.2, we describe a calibration procedure to determine the orientation of the camera with respect to the experimental set-up. Unlike the simple frontal model (5), we cannot invert the forward model to determine n. Therefore, we use an inverse model, which we solve in Sect. 4.3.

4.1 Forward model

We construct a forward model, relating for each light ray i an index of refraction \(n_i\), position on the image plane \({\varvec{x}}_i = (x_i,y_i)\) and parameters \({\varvec{q}}\) to coordinates \({\varvec{\xi }}_i = (\xi _i, \eta _i, \zeta _i = 0)\) where the light ray hits the light-bank (plane 6) for nonzero angles \(\alpha\). Physically light rays emanate from the light-bank and fall onto the camera; mathematically, we reverse the direction of the light rays. The model \({\varvec{\xi }}(n_i, {\varvec{q}}, {\varvec{x}}_i)\) uses ray tracing and Snell’s law in three dimensions. We assume the light rays travel in straight lines. For details, we refer to Appendix 1. Since the image and object planes are not parallel, the magnification is a function of \({\varvec{x}}_i\), even with a pinhole approximation. The forward model depends nonlinearly on the parameters \({\varvec{q}}\) and the measurements \({\varvec{\Delta x}}_i\) (obtained from the DIC procedure).

We take our forward model twice, once for a deformed image with index of refraction field n(xy) and once for a reference image with (typically constant) index of refraction \(n_\mathrm{{ref}}\). The light rays originating from the same location on the light-bank end up on different locations on the image plane due to the different indices of refraction:

$$\begin{aligned} {\varvec{\xi }}(n_i, {\varvec{q}}, {\varvec{x}}_i+{\varvec{\Delta x}}_i) - {\varvec{\xi }}(n_\mathrm{{ref}}, {\varvec{q}}, {\varvec{x}}_i) = 0, \end{aligned}$$
(8)

For each light ray i, (8) holds and is decoupled from the other light rays. This description is the reverse of the situation depicted in Fig. 4, where light rays from two different locations on the object plane end up in the same location on the image plane.

4.2 Calibration

In our forward model in (8), we have used the parameters \({\varvec{q}}\) \(= [a, b, c, L_m]^{\rm T}\), defined in Fig. 6 and Appendix 1. Coefficients a, b, c define the orientation of the light-bank object plane, and \(L_m\), the distance to the light-bank, measured along the line perpendicular to the camera from the pinhole.

Fig. 6
figure 6

A schematic view (greatly exaggerated) of the parameters \({\varvec{q}} = [a, b, c, L_m]^{\rm T}\). The orientation of plane 6 (the light-bank) changes with the normal vector \(\varvec{e}_\zeta = (a, b, c)\). The distance from the pinhole P to the plane changes with \(L_m\). The angle \(\alpha\) is the same as in Fig. 1. The numbers 0 and 6 correspond to the image and object planes in Fig. 2, respectively. The distance from the image plane to the pinhole to the object plane is different for each light ray (in red)

To obtain parameters \({\varvec{q}}\), we perform a calibration measurement. We do not need to measure the position of the camera manually. The calibration consists of performing one extra measurement (two in total): we take a reference image, the tank filled with water with a known index of refraction \(n_\mathrm{{ref}}\), and a calibration image, the tank without water (filled with air).

Since we have only four parameters to estimate (abc and \(L_m\)) and many measurements (each grid point in the DIC procedure yields a separate equation (8)), we have an over-determined system. The method of least-squares yields the \({\varvec{q}}\) that minimizes the sum of squares of the residuals. For each measurement \({\varvec{\Delta x}}_i\), we have a measure of reliability, the correlation coefficient C, which is used as a weight \(w_i\) in the least squares procedure

$$\begin{aligned} \min _{{\varvec{q}}} \sum _i w_i \left( \xi (n_\mathrm{{ref}}, {\varvec{q}}, {\varvec{x}}_i+{\varvec{\Delta x}}_i) - \xi (n_\mathrm{{air}}, {\varvec{q}}, {\varvec{x}}_i)\right) ^2, \end{aligned}$$
(9)

with a lower limit \(L_c > 0\). The sum is over all measured displacements. We use the LM algorithm to solve (9). In our experiments, (9) has one minimum that satisfies \(L_c > 0\).

One practical limit for the calibration is that the apparent background shift between air versus calibration fluid can become large. In Table 1, this shift is reported as 150 pixels \(\approx {2.2\,\mathrm{\text {c}\text {m}}}\). If the tank becomes longer (\(L_t\) increases) or the width decreases, the aspect ratio (AR) becomes larger, see Fig. 5. If the aspect ratio is too large, there are no light rays that pass through the entire length of the fluid and our calibration fails.

4.3 Inverse model

Unlike the simple model, we cannot invert the forward model to obtain an expression for the index of refraction: we have an inverse model. We consider the unknown index of refraction as a perturbation on the reference state, \(n_i = n_\mathrm{{ref}}+\delta n_i\), i labeling the rays (pixels), and treat the problem of finding \(\delta n_i\) as an optimization problem:

$$\begin{aligned} \min _{\delta n_i} (\xi (n_\mathrm{{ref}}+\delta n_i, {{\varvec{q}}}, {{\varvec{x}}}_i+{{\varvec{\Delta x}}}_i) - \xi (n_\mathrm{{ref}}, {{\varvec{q}}}, {{\varvec{x}}}_i))^2, \end{aligned}$$
(10)

with lower and upper bounds \(1.3 \le n_\mathrm{{ref}}+\delta n_i \le 1.4\). For each measurement \({\varvec{\Delta x}}_i\), we solve (10) with the LM algorithm to find \(\delta n_i\). In our experiments, (10) has one minimum within the given bounds. We use (6) to relate the indices of refraction we obtain from (10) to density values. By placing our camera under a horizontal angle \(\alpha\), we amplified the signal in the horizontal direction. In (9) and (10), we used only the horizontal displacements \(\xi\) and not some combination of the displacements \({\varvec{\xi }}\) to determine the parameters \({\varvec{q}}\) and the perturbations \(\delta n_i\).

5 Density field measurements

We present whole-field density measurements for three fluids: a two-layer system in Figs. 7 and 8 in Sect. 5.1, a linear stratification with a density jump near the bottom in Figs. 9 and 10, and a nonlinear stratification in Figs. 11 and 12 in Sect. 5.2.

5.1 Two-layer system

Figure 7 displays a measurement on a two-layer system: Fig. 7a shows the optically determined density field; Fig. 7b shows vertical density profiles from Fig. 7a in grey (after interpolation on a uniform grid) with the horizontally averaged profile shown in blue; and Fig. 7c shows the correlation coefficient C for each grid point as a function of depth. The densities in the upper layer and in the lower layer are constant; an improvement with respect to the frontal view from Fig. 4.

Fig. 7
figure 7

Measurement on a two-layer system: (a) the optically measured density field; (b) the vertical density profiles from (a) in grey with the horizontally averaged density profile in blue; and (c) the correlation coefficient C for each grid point as a function of depth

Fig. 8
figure 8

Zooming in on the interface of Fig. 7. The DIC procedure had difficulties mapping the displacements of the interface

The interface between the two layers was a large density jump with a height of \({8\,\mathrm{\text {m}\text {m}}}\), which smeared out and compressed the dots in the vertical direction. The displacement field \(\Delta x\) in Fig. 8 shows that the DIC procedure had difficulties mapping the interface. The variations in the displacement fields resulted in the density field around the interface not being horizontally constant. The correlation coefficient for almost all grid points in Figs. 7, 9 and 11 was higher than 0.99, indicating that the transformation (consisting of displacements, first-order and second-order shape functions) found by DIC for these grid points was an excellent match. When the correlation coefficient was less than 0.99, as in Fig. 7c, the DIC procedure indicated it had trouble explaining the variations found in the images. Thus, the correlation coefficient of the DIC procedure can be used as a diagnostic tool to detect such variations.

5.2 Stratified fluids

Figure 9 displays a measurement on a linearly stratified fluid with a layer of linearly increasing density with depth and a density jump to a layer with a higher density: Fig. 9a shows the optically measured density field; Fig. 9b shows vertical density profiles from Fig. 9a in grey (after interpolation on a uniform grid) with the horizontally averaged density profile in blue and the probe profile in red; and Fig. 9c shows the difference \(\Delta \rho\) between horizontally averaged and probe profiles (after interpolation). Near the bottom of the figures, a layer of high density fluid is visible. The red profile was obtained from a second independent measurement: a probe consisting of a conductivity and a temperature sensor, which was moved down and up through the water using a step motor. We used the measurement obtained during the undisturbed downward movement. The conductivity and temperature sensors were calibrated using an Anton Paar Handheld Density Meter DMA 35.

Figure 11 displays a measurement on a nonlinearly stratified fluid consisting of a layer (\({0-6,\,{\text {c}\text {m}}}\) depth) of linearly (relatively slowly) increasing density, a layer of rapidly and nonlinearly increasing density (\({6-12,\,{\text {c}\text {m}}}\) depth), and a layer of linearly increasing density (\(>{12\,\mathrm{\text {c}\text {m}}}\) depth).

The newly proposed optical determination of the density reproduces the density profiles obtained from the probe, see Figs. 9, 1011 and 12. To quantify the difference between the two methods, Figs. 9 and 11 report the difference \(||\Delta \rho ||_2\), calculated using (7). This difference is less than \(2.9\,\hbox {mg/cm}^{3}\), the resolution reported in Table 1, and much less than the errors found with a frontal view and discussed in Sect. 2.2, where the smallest error was \(15\,\hbox {mg/cm}^{3}\). Also, the variation in the density is much smaller than in Fig. 4d–f and no unphysical density values are found.

The strength of static density fields of continuously density-stratified fluids is characterized by the buoyancy (or Brunt–Väisälä) frequency \(N^2\!(\eta ) = (g/\rho _0) \, \text {d} \rho /\text {d}\eta\) and depends on the vertical gradient of the density, with g the gravitational acceleration and \(\rho _0\) the constant part of the background density. The vertical gradient of the density was obtained by applying a central difference scheme on both the optically determined density field and the probe profile, see Figs. 10 and 12. Various features are reproduced by the optically determined density gradients; (1) the vertical density gradient is constant for the linear stratification in Fig. 10; and (2) the appearance of the double peaks at \({8\,\mathrm{\text {c}\text {m}}}\) and \({10.5\,\mathrm{\text {c}\text {m}}}\) depth for the nonlinear stratification in Fig. 12.

The density fields are approximately horizontally constant, as expected for stably stratified fluids at rest. However, patterns in the density field indicate that camera calibration can further improve the results, see for example Fig. 9a.

Fig. 9
figure 9

Measurement on a linearly stratified fluid with a layer of linearly increasing density with depth and a density jump to a layer with a higher density: (a) the optically measured density field; (b) the vertical density profiles from (a) in grey with the horizontally averaged density profile in blue and the probe profile in red; and (c) the difference \(\Delta \rho\) between horizontally averaged and probe profiles. The difference was \(||\Delta \rho ||_{2} = 0.98\,\hbox {mg/cm}^{3}\)

Fig. 10
figure 10

(a) The optically measured vertical density gradient field for the linearly stratified fluid shown in Fig. 9; and (b) the vertical density gradient profiles from (a) in grey with the horizontally averaged density gradient profile in blue and the probe density gradient profile in red

Fig. 11
figure 11

Measurement on a nonlinearly stratified fluid consisting of a layer of linearly increasing density, a layer with rapidly changing vertical density gradient (from \({6\,\mathrm{\text {c}\text {m}}}\) to \({12\,\mathrm{\text {c}\text {m}}}\)), and a layer of again linearly increasing density (but at a different rate): (a) the optically measured density field; (b) the vertical density profiles from (a) in grey with the horizontally averaged density profile in blue and the probe profile in red; and (c) the difference \(\Delta \rho\) between horizontally averaged and probe profiles. The difference was \(||\Delta \rho ||_{2} = 0.78\,\hbox {mg/cm}^{3}\)

Fig. 12
figure 12

(a) The optically measured vertical density gradient field for the nonlinearly stratified fluid shown in Fig. 11; and (b) the vertical density gradient profiles from (a) in grey with the horizontally averaged density gradient profile in blue and the probe density gradient profile in red

6 Discussion

We have introduced an optical, non-intrusive application of Synthetic Schlieren, to measure the background density field of a two-dimensional fluid using a single camera. By looking under a horizontal angle (\(\alpha\) in Fig. 1), the signal was amplified: the light rays falling on the camera refract more under larger angles. Full-field densities for multi-layered fluids, linearly stratified fluids and nonlinearly stratified fluids were obtained. These were validated by comparing the horizontally averaged density fields with density profiles obtained by a probe consisting of a conductivity and a temperature sensor. The newly proposed experimental application reproduces the density and density gradient profiles obtained from the probe. This provides a non-intrusive full-field measurement. It is thus possible to measure dynamically changing density fields.

The new application yields the density field without the need for tomographic reconstruction algorithms that require images taken from different directions through the fluid nor does the analysis require regularization. In set-up, our experiment is similar to Synthetic Schlieren, with the main differences being that we place our camera at an angle to view the experimental set-up and that we do not make use of the presence of a pre-existing, strong background vertical density gradient. Our model, relating displacements to densities, is fundamentally different from the model in Synthetic Schlieren, relating displacements to density gradients. We rely on differences in the viewing angle to refract the light rays differently, while in Synthetic Schlieren all light rays are assumed parallel. In Dalziel et al. (2007), simultaneous Synthetic Schlieren and Particle Image Velocimetry (PIV) measurements were performed. Simultaneous measurements with our new application and PIV to determine the density and velocity fields directly would allow greater insight into the dynamics of density-stratified flows.

In our model, we assume the glass plate (and the light-bank) to be planar. This assumption is under pressure during the experiments. It is important to fill the water tank to the same height during the experiments. Any difference in the water height will lead to a different pressure acting on the glass and could lead to a different curvature of the glass plane. In some of our experiments, we used a \({2\,\mathrm{\text {m}}}\) wide tank, filled with \({75\,\mathrm{\text {l}}}\) of salt water. This amount of water curved the glass plates outwards. We recommend an extra calibration step: image the random dots on the light-bank without the tank, then with an empty or filled tank. Any deviation, above the noise level of the camera, from a planar tank will be measurable.

Despite careful alignment of the set-up, residual misalignments were present. These can be further reduced by a general camera calibration. This ensures that straight lines in the experimental set-up (like the water surface and the boundaries of the tank) appear as straight lines in the acquired images. This yields a transformation of the images. With the DIC parameters from Table 1, this was likely the largest source of error.