1 Introduction

Solidification processes in compound liquids are often associated with segregation phenomena. The accompanying thermal and solutal density gradients can drive strong convective flows—the so-called double-diffusive convection (Turner 1974; Huppert and Turner 1981). In addition to industry-related solidification processes, double-diffusive convection with simultaneous phase transitions is ubiquitous in many large-scale geo- and astrophysical phenomena (e.g., Chen and Johnson 1984; Huppert and Sparks 1984; Honda et al. 1993; Rückriemen et al. 2018). The relationship between solidification and convection is therefore an interesting and rewarding topic for scientific research.

The particular complexity of this problem results from the fact that many fundamental aspects of fluid dynamics, such as turbulence, multiphase flows, phase transition and heat/concentration transport, are involved here. A comprehensive understanding of their interplay requires simultaneous knowledge about various physical quantities (e.g., fluid velocity, temperature or solute concentration) not only for selected points but preferably over the entire volume participating in the process.

For respective experimental investigations, aqueous ammonium chloride (NH4Cl(aq)) has been employed as an analog of opaque fluids over the last decades (e.g., Jackson et al. 1966; Copley et al. 1970; Chen and Chen 1991; Magirl and Incropera 1993; Peppin et al. 2008). This transparent model system allows for a rather easy implementation of optical measurement techniques such as schlieren imaging (Szekely and Jassal 1978), shadowgraphy (Beckermann and Viskanta 1988) and interferometry (Beckermann et al. 1988). More recently, these studies have been extended to measure the velocity field of the melt via particle image velocimetry (PIV) (Wang et al. 1999; Skudarnov et al. 2002; Ghenai et al. 2003). Moreover, PIV has been employed for the simultaneous analysis of clusters of equiaxed crystals by Kharicha et al. (2013). Although these works have achieved a partial understanding with regard to velocity fields and solid fraction, they are still far from a comprehensive understanding of this complicated phenomenon. In detail, the formerly applied measurement techniques do not allow to simultaneously quantify the global temperature field nor the concentration distribution.

The measurement scheme introduced in this paper aims at resolving these issues by combining different state-of-the-art techniques of quantitative optical measurements into one unified approach. So far, we developed an image preprocessing scheme named spectral random masking (Anders et al. 2019). This enables to measure the velocity field of the liquid phase via PIV and to simultaneously determine the trajectories and growth statistics of dispersed salt crystals via particle tracking velocimetry (PTV). In this paper, we augment this method with a novel implementation of liquid crystal thermometry (LCT) for global temperature field measurements. LCT is an optical temperature measurement technique using encapsulated thermochromic liquid crystals (TLC) whose principal applicability to double-diffusive convection was demonstrated by Nishimura et al. (1992, 1994, 1998). In contrast to common point measurements by temperature sensors, i.e., thermistors or thermocouples, LCT is a noninvasive method that can measure whole cross sections of a respective fluid volume.

To enable an accurate quantitative application of LCT to multiphase flows, we implemented a novel color interpolation scheme able to regard single masked pixels which will be discussed in detail. Subsequently, the use of an artificial neural network (ANN) converting spatial coordinates and RGB color values into an exact temperature distribution is presented and validated. In comparison with common hue-based calibration methods, the use of an ANN with multiple input variables allowed us to increase the measurable temperature range and accuracy significantly. We then apply the combination of all these techniques to an experiment with simultaneous crystallization and double-diffusive convection of NH4Cl(aq) filled in a Hele–Shaw fluid cell. Here, our specific measurement scheme allows for the quantitative and synchronous measurement of velocity and temperature fields even in the presence of crystallization. Since these quantities can be acquired over the whole cross section of the fluid cell and for experimental runs longer than one hour, our specific measurement scheme finally enables a detailed quantitative study of the interaction between crystallization and double-diffusive convection. In this paper, this will be demonstrated on the basis of some prominent features of the experiment.

Fig. 1
figure 1

Schematic illustration of the experimental setup: (A) measurement cell (see detail view in Fig. 2, (B) lightsheet optics, (C) LED light source, (D) reservoir with working fluid on a magnetic stirrer, (E) flexible tube pump, (F) seismic isolation table, (G) water bath thermostats, (H) digital multimeter connected to temperature sensors and (I) PC for temperature recording

2 Experimental setup and procedure

2.1 Experimental setup and instrumentation

The experimental facility used in the present study was already briefly described in Anders et al. (2019). Figure 1 shows a sketch of the setup which is composed of a measurement cell containing the working fluid, optical instrumentation, a temperature measurement system and additional laboratory equipment.

To limit the complexity of all physical phenomena encountered during the experiments, the measurement cell (see Fig. 2) was designed as a Hele–Shaw cell focusing on the visualization of the two-dimensional flow field in the vertical mid-plane of the cell. To enable optical imaging, the box-shaped central fluid container was composed of transparent acrylic glass plates of \(5\,{\text{mm}}\) thickness and has inner dimensions of \(200\,{\text{mm}}\) width (W), \(100\,{\text{mm}}\) height (L) and \(10\,{\text{mm}}\) depth (D). To monitor the temperature inside the fluid, six miniature thermistors (TH\(_{1-6}\)) were placed in the back wall of the fluid container so that their measuring tips protruded \(\sim {1}\,{\text{mm}}\) into the fluid (see Fig. 2 for details on the thermistor’s placement). The thermistors were calibrated to an absolute accuracy better than \( 0.01\,{\text{K}}\). The top and bottom rigid boundaries were composed of copper blocks possessing internal water baths each connected to a thermostat via thermally insulated tubes. Thanks to this configuration, the top and bottom thermal boundary condition and therefore the vertical temperature difference over the fluid layer could be controlled precisely. The respective temperatures of the boundaries were measured by three thermocouples per side (TC\(_{1-3}\) at the top and TC\(_{4-6}\) at the bottom) located in the copper blocks \(0.5\,{\text{mm}}\) beneath the fluid boundaries. All thermocouples were calibrated to an absolute accuracy better than \(0.08\,{\text{K}}\).

Fig. 2
figure 2

Schematic illustration of the measurement cell in Hele–Shaw configuration: a front view from the camera’s perspective. b Side view from the lightsource’s perspective. TC\(_{1-6}\) represent the thermocouples measuring the temperature at \(0.5\,{\text{mm}}\) beneath the fluid boundaries. TH\(_{1-6}\) represent the immersed thermistors directly measuring the fluid temperature. All measures are given in mm

For illumination, a white lightsheet with a color temperature of 6000 K generated by a LED light source (intraLED5, Volpi) in combination with a lightguide and cylindrical lens system was used. The lightsheet was adjusted to a thickness of about 4–5 mm and enters the fluid container in camera perspective from the right side (compare Fig. 1). Color images of \(2000\times 1000 \,\hbox {px}\) were acquired by a CMOS color camera (ProSilica GT2000C, AVT) equipped with a lens system (Macro Planar 2/50, Zeiss) set in front of the fluid cell which yielded a nominal spatial resolution of \({0.1}\,{\hbox {mm/px}}\). The heat transfer into the fluid caused by the lighting was minimized by a common triggering of the camera and the lightsource via a function generator. To enable the highest spatial accuracy and to provide unbiased color values for the subsequent image processing, all images were recorded in Bayer-GB8 format as originally detected by the camera’s chip (corresponding details will be given in Sect. 3.2).

Fig. 3
figure 3

Scheme of the temperature profiles during the solidification experiments shown for a thermally unstable regime. The temperatures of the top and bottom fluid boundary (\(T_{{\rm top}}\) and \(T_{{\rm bot}}\)) were measured by the thermocouples \(\hbox {TC}_{1-3}\) and \(\hbox {TC}_{4-6}\) , respectively. The fluid temperature \(T_{{\rm fluid}}\) was directly measured by the immersed thermistors \(\hbox {TH}_{1-6}\). During the temperature ramp with a gradient of \({\dot{T}}\) the fluid temperature fell below the saturation temperature \(T_{{\rm sat}}\). The temperature difference between top and bottom fluid boundary \(\varDelta T\) was kept constant throughout the experiment

2.2 Experimental procedure

As the working fluid, we employed an aqueous ammonium chloride solution (\(\hbox {NH}_{4}\hbox {Cl(aq)}\)) with a mass ratio of \(\hbox {NH}_{4}\hbox {Cl}\) to deionized water of \({40.5}\,{\hbox {g}} / {100}\,{\hbox {g}}\, {\hbox {H}_{2}\hbox{O.}}\) This yielded a saturation temperature of \(T_{{\rm sat}}=28\,^{\circ }{\hbox{C}}\). Stefan-Kharicha et al. (2018a) recently gave a review of the material properties of the \(\hbox {NH}_{4}\hbox {Cl}\)\(\hbox {H}_{2}\hbox {O}\) system. To visualize fluid velocity and temperature simultaneously, two to three drops of TLC slurry (SLN40/R21C5W, LCR-Hallcrest) per \({400}\,\hbox {mL}\) were added to the solution. This slurry contained particles of encapsulated thermochromic liquid crystals (TLC) (\(\rho _{{\rm p}} \approx {1.01\times 10^3}\,{\hbox {kg/m}^{3}}\), \(d_{{\rm p}} \approx 10\)\(15\,\upmu \hbox {m}\)) which exhibit an observable color transition in the temperature range of 19–24 ºC. The suitability of the TLC particles to act as tracers for the solutions velocity field is ensured by their small size and matching density leading to a corresponding Stokes number in the order of \(O(10^{-6}) \ll 1\).

Fig. 4
figure 4

Image processing procedure illustrated on a detail view from the experiment: a standard bilinear color interpolation. b Color-coded segmented image showing columnar crystals (red), equiaxed crystals (blue), agglomerated TLC particles (green) and the static mask (yellow). For visibility, all other image regions are shown in uniform gray color. c Masked bilinear color interpolation. The red rectangle in a indicates the position of the detail view given in Fig. 5

A typical temperature profile during the solidification experiment is shown in Fig. 3. Before filling the fluid container via a flexible tube pump, the working fluid was heated to \(\sim 40\,^{\circ }{\hbox{C}}\) and stirred with a magnetic stirrer to ensure a complete dissolution and homogeneous concentration of \(\hbox {NH}_{4}\hbox {Cl}\).

After filling the container, a temperature regime was established according to the following scheme: Throughout each experiment, a temperature difference between top and bottom fluid boundaries of \(\varDelta T = T_{{\rm top}}-T_{{\rm bot}}\) was constantly maintained. At the beginning of each experiment, the temperatures of both boundaries were held constantly well above the saturation temperature until the fluid temperature measured by \(\hbox {TH}_{1-6}\) was constant and homogeneous. Thus, before the start of the cooling process, all \(\hbox {NH}_{4}\hbox {Cl}\) can be regarded as homogeneously dissolved throughout the volume. At \(t={0}\,{\hbox {min}}\) , a cooling of the upper and lower fluid boundary with a constant cooling rate \({\dot{T}}={-1}\,{\hbox {K/min}}\) was initiated and sustained until \(t={20}\,{\hbox {min}}\). The resulting boundary temperatures were then held constant until the end of the experiment. Like this, the working fluid was supercooled on average by \(T_{{\rm sup}}\). Depending on the specific regime, the local supercooling differed considerably from this mean value. Continuous image acquisition was initiated at \(t={0}\,{\hbox {min}}\) with \({3}\,{\hbox {frames/s}}\) for \({120}\,{\hbox {min}}\).

In addition to the solidification experiments described above, we carried out a calibration experiment in order to establish a quantitative relation between fluid temperature and the TLC’s coloration. This was conducted in the same measurement cell and with identical lighting and imaging conditions as the solidification experiment. For this calibration experiment, no \(\hbox {NH}_{4}\hbox {Cl}\) was added to the working fluid, so as not to produce any crystals inside the fluid. In order to minimize spatial temperature deviations throughout the fluid, we surrounded the fluid container by an additional transparent enclosure. This created a double-wall construction and, the enclosed air was climatized by a Peltier thermostat. The calibration experiment then consisted of applying a series of constant and uniform thermal boundary conditions, which is to say, that the temperature for the upper and lower water bath as well as for the air within the double wall was set to identical values. All together, we applied 22 different temperatures ranging from 18.83 to \(24.69\,{^{\circ }{\hbox{C}}}\) that were held constant for \({20}\,{\hbox {min}}\) each and continuously recorded corresponding images.

3 Image preprocessing

The aim of our image preprocessing scheme is to convert the originally recorded Bayer-GB8 images—also denoted as raw images in the following—into a set of different images each optimized for the application of subsequent measurement techniques, i.e., LCT, PIV and PTV. To determine temperature fields via LCT, RGB images with an accurate representation of only the TLC’s coloration are required. To measure the fluid velocity via PIV, grayscale images with an effective masking of the dispersed phase are needed. To quantify the crystals statistics via PTV, a reliable segmentation of \(\hbox {NH}_{4}\hbox {Cl}\) crystals is necessary.

The details of our image preprocessing will be illustrated on a detail view from the solidification experiments shown in Fig. 4a. Here, typical features of the top-down solidification can be seen: A large region of white columnar crystals is situated at the top boundary. Below, small free-floating equiaxed crystals together with agglomerated TLC particles are visible as bright dots throughout the bulk liquid. The color transition visible in the bulk liquid (blue–green–red–black from bottom to top) stems from the TLC particles and indicates the local fluid temperature.

3.1 Image segmentation

The basis for all subsequent image processing is the segmentation of the raw images into different classes with corresponding binary masks. Each class represents either a different type of particles (i.e., columnar crystals, equiaxed crystals and agglomerated TLC particles) or optical artifacts (e.g., reflections, dirt or scratches on the fluid containers side walls). All of these classes are stored in individual binary masks to enable their use in subsequent processing steps. The results of the segmentation procedure described in the following are exemplified along Fig. 4b where the different masks are indicated as color-coded pixel regions.

Although the main segmentation procedure was already described in detail by Anders et al. (2019), some modifications resulting from the recording of Bayer-GB8 instead of grayscale images were necessary. These will be explained in the following. To filter optical artifacts caused by reflections, scratches and dirt on the fluid container walls, a static mask \({\mathbf{M}}_{{\rm stat}}\) was generated. For this, we computed a minimum Bayer image from the first minutes of the corresponding experimental run where no solid crystals were present. This minimum image was then decomposed into the three color channels, and each was thresholded individually. The resulting masks were then reassembled into the mask \({\mathbf{M}}_{{\rm stat}}\) (indicated as yellow regions in Fig. 4b). This procedure reflects the different sensitivity of each color channel and enabled a thresholding down to pixel accuracy without obliterating sharp edges (compare the blurring caused by gray value interpolation shown in the second column of Fig. 6a). Next, in each individual frame, large regions of columnar and sedimented crystals were segmented into \({\mathbf{M}}_{{\rm col}}\) by global thresholding the corresponding saturation values. In contrast to thresholding the intensity values as in Anders et al. (2019), this provided a higher robustness against spatially inhomogeneous lighting conditions. The pixel regions resulting from this thresholding were divided into two separate fractions: regions situated above the fluid container’s center (\(y>{50}\,\hbox {mm}\)) were classified as columnar crystals (indicated as red regions in Fig. 4b), regions below the center (\(y<{50}\,\hbox {mm}\)) as sedimented crystals or the mushy zone, respectively. Equiaxed crystals and agglomerated TLC particles were segmented into \({\mathbf{M}}_{{\rm equ}}\) (indicated as blue regions in Fig. 4b) and \({\mathbf{M}}_{{\rm trc}}\) (indicated as green regions in Fig. 4b), respectively, through locally adaptive thresholding of a bilaterally blurred intensity image in the same way as described by Anders et al. (2019).

Fig. 5
figure 5

Detail view of a raw Bayer-GB8 image. Regions of different dominant color channels are indicated by dashed lines. Red circles exemplarily indicate pixel regions belonging to particles. The position of this detail view (\(80\times {40}\,{\hbox {px}}\)) is shown in Fig. 4a by a red rectangle

3.2 Masked color interpolation

As will be discussed in detail later (see Sect. 4), the calibration from color-to-temperature strongly depends on a reliable determination of RGB intensities representing the coloration of the TLC particles without the influence of the light scattered by \(\hbox {NH}_{4}\hbox {Cl}\) crystals. To yield the highest accuracy together with the best spatial resolution, care has to be taken, how the raw images are converted into RGB images. The color image shown in Fig. 4a was rendered from the raw image via the widely used bilinear color interpolation. Figure 5 shows a corresponding detail view recorded in Bayer-GB8 format during the solidification experiments. Here, the TLC’s color/temperature information that is to be retrieved is visible as the color channel of highest intensity varying from red in the upper left corner through green in the center and to blue in the lower right corner. The specific difficulty in the present case is the correct consideration, i.e., masking of the finely dispersed solid phases which are visible as small regions of higher intensity in Fig. 5. During the color interpolation, the corresponding mask \({\mathbf{M}}\) denotes the disjunction of \({\mathbf{M}}_{{\rm stat}}\), \({\mathbf{M}}_{{\rm col}}\), \({\mathbf{M}}_{{\rm equ}}\) and \({\mathbf{M}}_{{\rm trc}}\) (compare Sect. 3.1).

Fig. 6
figure 6

Color interpolation schemes: a gray value demosaicing and subsequent thresholding, b bilinear demosaicing, c masked bilinear demosaicing taking predetermined masks into account. These masks could be computed according to a

As an example, consider the Bayer intensity distribution shown in the first column of Fig. 6 which displays a \(2\times 2\) pixel region of high intensity (representing a salt crystal) embedded in a background of darker (uniform) intensity. Similar to the scheme introduced in Sect. 3.1, through gray value interpolation and thresholding, a binary mask, \({\mathbf{M}}\) can be computed (compare Fig. 6a). In standard bilinear color interpolation, the RGB intensities of each pixel are interpolated from the raw image’s neighboring RGB intensities by convolving each color channel \({X} = {R}, {G}, {B}\) of the original Bayer image with the corresponding kernel \({\mathbf {K}}_{{X}}\) (see Longere et al. 2002):

$$\begin{aligned} {\mathbf {K}}_{G} = \frac{1}{4} \left[ \begin{array}{lll} 0 &\quad 1 &\quad 0 \\ 1 &\quad 4 &\quad 1 \\ 0 &\quad 1 &\quad 0 \\ \end{array}\right] ,\quad {\mathbf {K}}_{R} = {\mathbf {K}}_{B} = \frac{1}{4} \left[ \begin{array}{lll} 1 &\quad 2 &\quad 1 \\ 2 &\quad 4 &\quad 2 \\ 1 &\quad 2 &\quad 1 \\ \end{array}\right] \end{aligned}$$
(1)

The result of this interpolation scheme is shown in the second column of Fig. 6b. After the corresponding binary mask is applied, color artifacts caused by the high intensities within the masked region can be seen in the neighboring pixels (compare third column of Fig. 6b). Since these artifacts would introduce false values into the RGB-to-temperature conversion, they already have to be avoided during the color interpolation itself. For this, we implemented the so-called masked bilinear color interpolation: In addition to the kernels given by Eq. 1, it employs a masked convolution (Price-Whelan et al. 2018) which is capable of taking a corresponding binary mask \({\mathbf{M}}\) into account: For each convolution operation, all coefficients of the corresponding kernels are set to zero if the corresponding pixels are masked by \({\mathbf{M}}\). In the present case, \({\mathbf{M}}\) was constituted by the superposition of the masks previously determined during the segmentation of the original images as described in Sect. 3.1. To prevent color distortions, the resulting kernels have to be renormalized. These operations can be formalized with the convolution \(*\) and the element-wise Hadamard product \(\odot\) as follows:

$$\begin{aligned} {\mathbf {I}}_{{{\rm {int}},X}_{i,j}} = {{\mathbf {I}}}_{{{\rm{org}},X}_{i,j}} *\frac{\widetilde{{{\mathbf {K}}}}_{{X}_{i,j}}}{\sum _{k,l} {{\widetilde{k}}}_{{X}_{{i,j}_{k,l}}}} \end{aligned}$$
(2)

where

$$\begin{aligned} {\mathbf {I}}_{{{\rm{ org}},X}_{i,j}} = \left[ \begin{array}{ccc} {\mathbf {I}}_{{{\rm{ org}},X}_{i-1,j-1}} &\quad \cdots &\quad {\mathbf {I}}_{{{\rm{ org}},X}_{i-1,j+1}} \\ \vdots &\quad \ddots & \quad \vdots \\ {\mathbf {I}}_{{{\rm {org}},X}_{i+1,j-1}} & \quad \cdots &\quad {\mathbf {I}}_{{{\rm {org}},X}_{i+1,j+1}} \\ \end{array} \right] \end{aligned}$$
(3)

and

$$\begin{aligned} \widetilde{{\mathbf {K}}}_{{X}_{i,j}} = {\mathbf {K}}_{X} \odot \left[ \begin{array}{ccc} {{\mathbf{M}}}_{i-1,j-1} &\quad \cdots & \quad {{\mathbf{M}}}_{i-1,j+1} \\ \vdots &\quad \ddots &\quad \vdots \\ {{\mathbf{M}}}_{i+1,j-1} & \quad \cdots &\quad {{\mathbf{M}}}_{i+1,j+1} \\ \end{array} \right] \end{aligned}$$
(4)

This procedure finally yields the desired Bayer-to-RGB color interpolation as shown in Fig. 6c. The masked regions are disregarded during the convolution and have no influence on the RGB values of neighboring pixels. A correspondingly processed detail view of the solidification experiment is shown in Fig. 4c. In addition, Online Resource 2 illustrates the masked bilinear color interpolation for a corresponding image sequence. The succession of image segmentation and color interpolation is additionally illustrated in form of a flowchart in Online Resource 1.

Fig. 7
figure 7

Relation between temperature and the TLC’s coloration (in terms of RGB intensities, hue (H) and saturation (S))

Depending on the imaging setup, a typical feature of TLC measurements which can be observed in many publications, e.g., Ozawa et al. (1992), Ciofalo et al. (2003), König et al. (2019), is the granular structure of the color appearance. This is caused by small local differences in the seeding density and single bright tracers and was also present in our measurements (see Fig. 4c). During the RGB-to-temperature conversion this granular structure could lead to temperature fluctuations of high spatial frequency caused by unstable results of the neural network calibration, i.e., overtraining. During the training of the neural network, we countered this problem by smoothing the results of masked bilinear color interpolation through the convolution with a \(11\times 11\) Gaussian kernel. During the solidification experiments, however, we applied a more complex and variable postprocessing routine that is explained in Sect. 4.4.

4 Liquid crystal thermometry based on artificial neural networks

4.1 Basic principles of liquid crystal thermometry

The basic idea of the liquid crystal thermometry (LCT) is that the spectrum (or the dominant frequency respectively) of light reflected by TLCs is dependent on their local temperature (see Abdullah et al. 2010) for the details of the underlying physical phenomena). In detail, under a fixed observation angle, incident white light appears as red, green and blue in the order from lower to higher temperature. The exact temperatures at which certain colors are visible depend strongly on the observation angle and the spectrum of the incident light (see Moller et al. 2019a; Abdullah et al. 2010; König et al. 2019). In our case, we fixed the camera’s optical axis perpendicular to the center of the fluid container and the illumination plane. The corresponding RGB intensities recorded during the calibration experiment (see Sect. 2.2) are shown in Figs. 7 and 9a. The coloration changed from orange at \(\sim 19.5\,^{\circ }{\hbox{C}}\) to blue below \(23\,^{\circ }{\hbox{C}}\). As will be shown later (see Sect. 4.4), this enables an accurate calibration between color and temperature with high spatial resolution for the complete measurement cell.

Fig. 8
figure 8

Three-dimensional relation between RGB Cartesian coordinates and temperature

The images resulting from the color interpolation method described in Sect. 3.2 were stored in a 24-bit RGB format (8-bit for each color). For a more intuitive representation, these RGB intensities are often converted to the HSV format, where the hue value \(H\,\left[ 0\dots 2\pi \right]\) is defined as

$$\begin{aligned} H = {{\,{\mathrm{arctan2}}\,}}\left( \frac{\sqrt{3}}{2}\left( G - B \right) ,\frac{1}{2}(2R - G - B)\right) \end{aligned}$$
(5)

and the saturation \(S\,\left[ 0, 1\right]\) as

$$\begin{aligned} S = \left\{ \begin{array}{ll} \frac{\max -\min }{\max } &\quad \max \ne 0,\\ 0 &\quad {\mathrm {otherwise}}. \end{array}\right. \end{aligned}$$
(6)

Here, \(\max\) and \(\min\) are the maximum and minimum value of RGB at each pixel, respectively. Because H represents the temperature dependency of the color on a continuous scale, it is frequently used for a corresponding calibration (Wiberg and Lior 2004; Dabiri and Gharib 1991; Abdullah et al. 2010; Noto et al. 2018). However, as former workers already stated, H cannot express the full color range of TLCs by a simple one-to-one relationship: As shown in Fig. 7, multiple values of T correspond to identical values of H in a nonlinear manner which makes it impossible to obtain a single continuous calibration curve. Thus, a calibration based solely on H would restrict the applicable temperatures only to \(19.8\,^{\circ }{\hbox{C}} \le T \le 21.5\,^{\circ }{\hbox{C}}\) for the present case, even though recognizable color changes appear beyond this range.

By plotting the temperature T in RGB Cartesian coordinates as shown in Fig. 8, however, a clear one-to-one relation between color and temperature appears which can be used for a calibration over the full color range. To employ multiple color values for the temperature calibration, the use of artificial neural networks (ANN) was proposed (e.g., Kimura et al. 1998; Lee et al. 2000; Park et al. 2001; Grewal et al. 2006). As was demonstrated for a multitude of different applications, ANN can effectively associate a set of multiple input values (the input vector) with a set of output values even if they are linked by a nonlinear relationship, i.e., the temperature can be obtained by solving a regression problem for the coloration-to-temperature relation. Because of this, ANN appear to be highly suitable to utilize the full color range offered by the TLCs while reducing calibration uncertainties.

4.2 Construction of the artificial neural network

The intensity of the light scattered by the TLC particles is directly related to their local number density within the salt solution. Since often a sufficient coloration is already reached by adding only two to three drops of the TLC slurry to the working fluid, it is quite difficult to maintain an equal concentration of TLC particles for multiple experimental runs. In our case, the long duration of each run in combination with the occurrence of stratified velocity fields could additionally amplify inhomogeneous particle distributions within the measurement cell. Thus, absolute RGB intensities are unsuitable in order to achieve a robust color-to-temperature calibration. Instead, we employed normalized color components (\(R^*\), \(G^*\), \(B^*\)) according to

$$\begin{aligned} (R^*, G^*, B^*)_{i,j} = \frac{1}{R_{i,j} + G_{i,j} + B_{i,j}}\left( R_{i,j}, G_{i,j},B_{i,j}\right) \end{aligned}$$
(7)

as input variables to the ANN (compare Kimura et al. 1998).

Fig. 9
figure 9

Spatial trend of TLC coloration: a rendered contour plot. The RGB intensities of corresponding calibration images with uniform fluid temperatures were averaged along the y-direction and aligned along the T-axis. The lightsheet illuminates in negative x-direction. b Corresponding trend of the hue value for selected calibration temperatures

Fig. 10
figure 10

Configuration of constructed 4 layer neural network for the color-to-temperature conversion. The input vector of each pixel \({\mathbf{x}}(i,j)\) is converted by the ANN into the corresponding output value y(ij). Gray dots enclosed with blue solid rectangles express the linear combination of weights and corresponding inputs, and gray dots enclosed with red dashed rectangles denote the application of the activation function according to Eq. 12

As stated in Sect. 4.1, the dominant frequency and the absolute RGB intensities of light scattered by the TLCs strongly depend on the observation angle together with the intensity and color of the incident light. Because all of these quantities might gradually vary within the recorded images, spatial coloration trends cannot be disregarded without compromising the calibration accuracy. We examined the spatial trend of TLC coloration under the isothermal conditions of our calibration experiment (see Sect. 2.2). Figure 9a shows a contour plot rendered from the resulting images. By averaging the RGB intensities in y-direction for each individual calibration image, i.e., temperature, distinct trends in x-direction can be observed. In Fig. 9b, the corresponding averaged hue value is plotted and generally a decline in negative x-direction, i.e., the direction of the illumination can be seen. Additionally, the effect of light scattered from the immersed thermistors locally reduces the H-value around \(x\sim 100\,\hbox {mm}\). One efficient way to regard these dependencies is to include the spatial coordinates as additional components of the input vector \({\mathbf{x}}\) for the ANN. A similar approach was presented by Moller et al. (2019b), where spatial coordinates together with the hue value were used as the input parameters for an ANN. Considering this, \({\mathbf{x}}\) is defined as

$$\begin{aligned} {\mathbf{x}}_{i,j} = \left( x^*, y^*, R^*, G^*, B^* \right) _{i,j}^{T}, \end{aligned}$$
(8)

where \(x^*\) and \(y^*\) are the normalized coordinates at each pixel position (ij) according to

$$\begin{aligned} (x^*, y^*)_{i,j} = \left( \frac{x}{W}, \frac{y}{L}\right) _{i,j}, \end{aligned}$$
(9)

and \(R^*\), \(G^*\) and \(B^*\) are the normalized color components as defined in Eq. 7. The output vector \({\mathbf{y}}\) of the ANN in our case reduces to a scalar which is identical to the local temperature at the corresponding pixel:

$$\begin{aligned} y_{i,j} = T_{i,j}. \end{aligned}$$
(10)

The relation between \({\mathbf{x}}\) and y is given by an arbitrary function according to \(y = f\left( {\mathbf{x}}\right)\), where f usually consists of consecutive linear combinations of the input vector’s components with a set of weight matrices \({\mathbf {W}}^{(n)}\). In the present study, we constructed an ANN with two hidden layers and bias values in the input layer and in the hidden layers as illustrated in Fig. 10. Written in vector notation, the corresponding relation between input vector and output is given as

$$\begin{aligned} y_{i,j} = {\mathbf {W}}^{(3)} \left[ \begin{array}{c} 1 \\ {{\,{\varphi }\,}}\left( {\mathbf {W}}^{(2)} \left[ \begin{array}{c} 1 \\ {{\,\varphi\,}}\left( {\mathbf {W}}^{(1)} \left[ \begin{array}{c} 1 \\ {\mathbf{x}}_{{i,j}} \end{array}\right] \right) \end{array}\right] \right) \end{array}\right] , \end{aligned}$$
(11)

where \({\mathbf {W}}^{(1)}\), \({\mathbf {W}}^{(2)}\) and \({\mathbf {W}}^{(3)}\) are the weight matrices of the two hidden layers and the output layer, respectively. In this notation, through the concatenation of each layer’s output with an additional coefficient “1,” the bias values correspond to the first column of each weight matrix. We defined the activation function as a ramp function (the so-called rectified linear unit (\({{\,\varphi\,}}\))) which is applied component-wise to a vector:

$$\begin{aligned} {{\,\varphi\,}}\left( {\mathbf{x}}\right) := \left\{ \begin{array}{ll} x_i &\quad x_i>0,\\ 0 &\quad {\hbox{otherwise}}\end{array}\right. \end{aligned}$$
(12)

We tested different ANN structures (e.g., numbers of nodes, number of hidden layers, etc.) during preliminary trials. To enable the ANN to adapt to the complexity of the underlying regression problem at hand, we finally choose two hidden layers each containing 400 nodes as a compromise between high accuracy and maintainable duration of the training process. With this, the final shape of the weight matrices \({\mathbf {W}}^{(1)}\), \({\mathbf {W}}^{(2)}\) and \({\mathbf {W}}^{(3)}\) are \(400\times 6\), \(400\times 401\) and \(1\times 401\) , respectively.

Fig. 11
figure 11

Spatial distribution of the pixels sampling probability for the compilation of the teacher data. Masked regions, i.e., thermistors or other static artifacts, correspond to a zero sampling probability

4.3 Training of the artificial neural network

For the training of the ANN, i.e., the optimization of \({\mathbf {W}}^{(n)}\), a teacher data set is required. It consisted of subsets of positions and colors at known temperatures, and was created through a calibration experiment (see Sect. 2.2). By analyzing the measured temperatures of the thermocouples along the upper and lower fluid boundary as well as the temperatures measured by the thermistors within the fluid, time periods were determined for each calibration point for which the temporal fluctuations of each individual sensor showed a maximal standard deviation of \(0.039\,\hbox {K}\) and for which the differences between the mean values of all the different sensors were less than \(0.24\,\hbox {K}\). Like this, for each calibration temperature, at least 150 raw images were selected. These images were then processed with the same image segmentation and color interpolation algorithms (see Sects. 3.1 and 3.2) that were later used for the solidification experiments. To compute the final calibration images, all frames of each temperature point were averaged pixel-wise to minimize remaining temporal fluctuations in the TLC concentration and local lighting intensity.

To limit the computational time for the training of the ANN and to avoid overtraining, it was necessary to only use a certain number of sampled pixels from each calibration image as the actual teacher data. At this point, one has to consider the localized steep spatial color gradients present in the calibration images as shown in Fig. 9. Since these gradients were caused by the setup of the measurement cell in combination with the illumination and camera setup, they could be considered as systematic errors. As far as they were also present during later solidification experiments, their effect had to be regarded during the training process. One efficient way to achieve this was to introduce a spatially biased sampling procedure or a sampling density distribution, respectively, as shown in Fig. 11. It consisted of an uniform density for the entire fluid container onto which a circular Gaussian distribution around every thermistor, and a symmetric Gaussian distribution in x-direction at \(x=100,\) were added. During the solidification experiments, crystallization along the walls of the fluid container significantly altered the illumination conditions within these regions compared to the calibration experiment. An impairment of the calibration was prevented by excluding a corresponding thin pixel region along the circumference of the images from the sampling procedure (compare Fig. 11). Likewise, masked pixel regions, i.e., thermistors and other artifacts present in the calibration images, were also excluded. With regard to this, from each calibration image, 30,000 pixels in total were randomly selected as schematically shown in Fig. 12a. As a result, 1.5% of the acquired pixels were finally utilized for the training of the ANN. The sampled sets of reference temperature, position and color were then normalized and stored into the teacher data set as illustrated in Fig. 12b. For fast convergence of the training and to distribute the influence of each subset of teacher data (and thus the influence of each calibration temperature) evenly, the rows of the teacher data set were finally randomly permuted and used segment-wise during a so-called “mini-batch” training. The learning process itself was conducted by using the adaptive momentum estimation (Adam) proposed by Kingma and Ba (2017) as an optimizer. In total, the optimization was run for 10,000 learning epochs.

Fig. 12
figure 12

Scheme of teacher data compilation employing images from the calibration experiment at known uniform temperatures. a RGB intensities are sampled from the image stack at biased random positions (indicated by red squares) and stored into a teacher data set b as normalized values. The rows of the teacher data set are randomly permuted to enable the subsequent “mini-batch” training

In general, both the actual structure of the ANN and the design of the training process are somewhat arbitrary and thus could be optimized infinitely. Because of this, for practical concerns, one has to define an optimization target and a corresponding measure. In our case, we quantified the result of the ANN calibration by the root-mean-square error \({{RMSE}}\) defined as

$$\begin{aligned} {{RMSE}} = \sqrt{\frac{1}{n}\sum _{i}^{n}\left( T_{{\rm ANN}}\left( {\mathbf{x}}_i\right) - {T_\mathrm {ref}}_i\right) ^2}. \end{aligned}$$
(13)

Hereby, \(T_{{\rm ANN}}\) denotes the temperature resulting from a certain state of the ANN training applied to a (sub-)set \({\mathbf{x}}_i\) of the original data and \(T_{{\rm ref}}\) denotes the corresponding reference temperature. Since the ANN’s performance practically cannot exceed the accuracy of the reference sensors or the calibration conditions, respectively, we took the corresponding values as the criterion for a successful ANN structure and training process. In detail, we considered \({{RMSE}}\le 0.1\,\hbox {K}\) as the target accuracy.

To assess the choice of the ANN structure, to measure the progress of the training process and to choose the optimal epoch after the training is finished, an additional test data set was compiled. For this, from each calibration image, 30,000 pixels (which is the same amount as for the teacher data set) were spatially randomly sampled. This test data was then processed with the current version of the ANN and corresponding values \({{RMSE}}_{{\rm test}}\) were computed.

Fig. 13
figure 13

ANN’s training progress illustrated by the \({{RMSE}}_{{\rm test}}\) calculated from a test data set. The local minimum values drop considerably for the first 3000 epochs indicating a fast learning progress. For later epochs, the learning progress slows down. The strong fluctuations make it necessary to select the optimal epoch possessing the minimal \({{RMSE}}_{{\rm test}}\) in order to meet the target accuracy

Fig. 14
figure 14

Result of the optimized ANN color-to-temperature conversion applied to the full calibration images. The resulting temperature values averaged along the y-axis at each x-position are shown as colored solid lines. The corresponding reference temperatures are shown as gray dashed lines

With this test, it became apparent that the \({{RMSE}}\) values of the lowest and highest calibration temperature (18.84 and \(24.67\,^{\circ }{\hbox{C}}\) , respectively) exceeded the values of the other 20 temperature points by up to one order of magnitude. In addition, the exclusion of these two calibration points reduced the \({{RMSE}}\) within the remaining temperature range. The reason for this most likely was the very low color saturation at these temperatures (compare Fig. 7) whereby the corresponding calibration images contained no additional information. Accordingly, we limited the teacher data sampling to the 20 calibration images of the range from 19.31 to \(24.23\,^{\circ }{\hbox{C}}\). For this choice of calibration temperatures, Fig. 13 shows the corresponding \({{RMSE}}_{{\rm test}}\) of the test data set averaged over all selected calibration temperatures for each learning epoch. Although the accuracy increased until 10,000 epochs, the learning rate decreased considerably after around 2000 epochs. Since test and teacher data sets were independently sampled, the continuous decline of the \({{RMSE}}_{{\rm test}}\) indicates that no overtraining occurred during the first 10,000 epochs. In Fig. 13, it also becomes apparent that the instantaneous values of \({{RMSE}}_{{\rm test}}\) fluctuated considerably. In order not to loose accuracy unnecessarily, we chose the epoch 9911 which exhibited the minimal value of \({{RMSE}}_{{\rm test}}= 0.0907\,\hbox {K}\) as the optimized state of our ANN for the further application. With this, the target value of \(0.1\,\hbox {K}\) was reached. The robustness of this procedure was tested by comparing five independently sampled test data sets. Up to a precision better than \({1}\,\hbox {mK}\) all show the same trend of \({{RMSE}}_{{\rm test}}\) and indicate epoch 9911 as the optimal choice. A further qualification of the ANN’s performance will be given in the next section.

4.4 Performance of the neural network calibration

To validate the optimized ANN system with special regard to the spatial color gradients present in the calibration images, the complete calibration images were tested. In Fig. 14, the respective temperature values averaged along the y-axis of the images at each x-position (solid lines) are shown. Over almost the complete calibrated temperature range, especially from 19.84 to \(23.75\,^{\circ }{\hbox{C}}\), they agreed very well with the reference temperatures (dashed lines) for nearly the entire range of x. This result illustrates that the constructed ANN system successfully reproduced the specific temperature dependency of the TLC’s coloration. In addition, it can be seen that the spatial color gradients especially around the thermistors at \(x= 100\,\hbox {mm}\) were correctly transferred into a homogeneous temperature distribution.

Fig. 15
figure 15

Performance of the optimized ANN system applied to the calibration images. Blue squares show temperature-dependent deviations between calibrated and reference temperatures averaged over the entire fluid layer. Red circles show temperature-dependent \({{RMSE}}\) values averaged over the entire fluid layer

To finally check, whether the target value of the ANN’s performance was reached, Fig. 15 shows the temperature-dependent deviation between calibrated and reference temperature. Over the complete calibrated temperature range, the absolute deviations averaged over the entire fluid layer stayed below \(\pm 0.13\,\hbox {K}\) and within the range of 19.84–\(23.75\,{^{\circ }{\hbox{C}}}\) even below \({\pm 0.04}\,\hbox {K}\). The corresponding \({{RMSE}}\) values determined over the complete fluid layer showed a similar trend: For the full temperature range, they were below \(0.2\,\hbox {K}\) and within a limited range of 19.84–\(22.28\,{^{\circ }{\hbox{C}}}\) below \(0.1\,\hbox {K}\). These trends were caused by the combination of relatively low saturation values outside the range of 20–\(23\,{^{\circ }{\hbox{C}}}\) and the nearly constant RGB intensities below \(19.5\,^{\circ }{\hbox{C}}\) and above \(23\,^{\circ }{\hbox{C}}\) (compare Fig. 7).

One important aspect that is not covered by the above analysis of the ANN’s calibration accuracy is the robustness of the resulting temperature fields against small fluctuations of the input variables present during solidification experiments. For this, we conducted a sensitivity analysis by varying each component k of the input vector \({\mathbf{x}}\) of the above mentioned test data independently with some shift \(\varDelta _k\cdot {{\mathbf {e}}}_k\). The corresponding sensitivities were then computed from the resulting temperature changes according to

$$\begin{aligned} {\text{sens}}_k := \frac{T({\mathbf{x}}+\varDelta _k\cdot {\mathbf {e}}_k ) - T({\mathbf{x}}-\varDelta _k\cdot {\mathbf {e}}_k)}{2\varDelta _k}. \end{aligned}$$
(14)

As a reasonable shift, we took the respective discretization uncertainty of \(\pm 0.5\,\hbox {bit}\) for the color channels and \(\pm 0.5\,\hbox {px}\) for the spatial coordinates. The resulting RGB sensitivities given in Fig. 16 showed a similar trend as the \({{RMSE}}\) values given in Fig. 15: The temperature uncertainties, i.e., mean values plus standard deviations, stayed below \(\pm 0.2\,\hbox {K}\) for nearly the entire temperature range and even below \(\pm 0.1\,\hbox {K}\) for temperatures below \(22.5\,^{\circ }{\hbox{C}}\). The sensitivity analysis for the spatial coordinates revealed only insignificant sensitivities below \(0.01\,\hbox {K/px}\) which are therefore not included in Fig. 16.

Fig. 16
figure 16

Sensitivity of the optimized ANN system against small variations in each color channel. For each color channel R,G and B, the mean temperature shift resulting from a shift in the corresponding color’s intensity by \(\pm 0.5\,\hbox {bit}\) is plotted in dependency of the reference temperature. Error bars show the corresponding standard deviations over the fluid layer

Fig. 17
figure 17

Postprocessing of the temperature field: a Original LCT temperature field without postprocessing. b Saturation minimum masked temperature field. c Smoothed temperature field after applying temporal and spatial averaging as well as a minimum threshold for the local number of valid data points. In ac, regions masked according to image segmentation are indicated by black color. In b and c, regions masked due to insufficient saturation are indicated by gray color. The figure shows the same detail view of the same frame as used in Fig. 4

The above discussion shows that our optimized ANN can be used to calibrate TLCs with an accuracy better than \(\pm 0.2 \,\hbox {K}\) over the range from 19.31 to \(24.23\,{^{\circ }{\hbox{C}}}\) which is almost the full \(5\,\hbox {K}\) range stated by the manufacturer. By limiting the temperature range, the corresponding accuracy could be further improved. The question whether the target accuracy of \(\pm 0.1\,\hbox {K}\) was met clearly depends on the exact definition of the overall accuracy. As can be seen in Fig. 15, for the temperature-dependent \({\hbox{RMSE}}\) values, this was only given over a limited range. For all calibration images together, however, the corresponding mean value of \({{RMSE}}= 0.0910\,\hbox {K}\) would be clearly below the criterion (\({{RMSE}}\le 0.1\,\hbox {K}\)). Finally, if one takes the deviation of the averaged temperatures, the target accuracy was clearly met over a large temperature range. Since the above accuracy tests require a priori known temperature fields, they can only be applied to data taken from calibration experiments. The corresponding values strictly speaking are therefore only valid as long as no solid crystals are present. In Sect. 6.3, a discussion of the uncertainties during solidification experiments will be given.

Before the optimized ANN could be finally applied to the solidification experiments, one additional challenge had to be solved. This was the reliable automatic detection and masking of pixels exhibiting nonsignificant RGB values. These would have otherwise introduced spurious temperature values and thus complicated the interpretation of the resulting temperature fields (compare Fig. 17a). During the experiments, various circumstances could lead to such RGB values: The local temperature might lie outside of the effective range of the TLC’s coloration, large salt crystals can cause shadows, or a long-lasting fluid stratification could severely reduce the local TLC number density. As can be seen in Fig. 7, within the effective temperature range, the light scattered by the TLC particles exhibited a distinct coloration which is equivalent to a relatively high saturation S. In Schmeling et al. (2014) a masking procedure is described, where the significance of the color information of single pixels in the HSV color space is determined by the local saturation and value information. Adopting this notion, we computed a local saturation threshold by taking the minimum value of S at each pixel throughout all temperature calibration images. Accordingly, in the images resulting from the solidification experiments, a pixel was masked, if its saturation value resulting from the masked color interpolation (compare Fig. 4c) was below the local saturation threshold. With this, pixels with nonsignificant RGB values could effectively be filtered out prior to the RGB-to-temperature conversion (compare Fig. 17b). Finally, a spatial and temporal average of this filtered data together with the masking of regions with insufficient valid data points yielded the desired smooth and reliable temperature fields (compare Fig. 17c). Hereby, the averaging parameters had to be selected according to the individual phenomena under consideration—e.g., a compromise between spatial and temporal resolution and the smoothness of the temperature field had to be found. A video showing the application of the ANN RGB-to-temperature conversion to an image sequence from the solidification experiments together with the above postprocessing can be found in Online Resource 2.

5 Velocity measurements and solid fraction estimation

In addition to the use for thermometry, TLC particles have been simultaneously employed as tracer particles for velocity measurements—the so-called particle image velocimetry/thermometry (PIV/T) (Ozawa et al. 1992; Park et al. 2001; Dabiri 2009). This offers the advantage that no additional seeding or imaging is necessary for applying PIV. In our case of a particle laden flow, the main challenge lies in the cross-talk between the displacements of tracer particles (i.e., TLC particles) and the dispersed phase (i.e., crystals) during the PIV correlation. Because state-of-the-art masking techniques proved to be incapable of effectively masking an additional moving particle fraction (i.e., crystals), we developed the so-called spectral random masking. Hereby, the pixel regions represented by a given binary mask (see Sect. 3.1) are filled with random intensities exhibiting a similar spectrum as their individual unmasked neighborhood. Since random intensity distributions with a similar spectrum as the background do not generate correlation peaks, the above procedure effectively renders the masked regions invisible to the PIV analysis (for further details see Anders et al. 2019). This technique enabled us to compute the velocity field of the salt solution without interference from the freely suspended equiaxed crystals. In this study, we used the PIV software PIVview2C version 3.6.0 with a multipass FFT correlation and a Gaussian least-square sub-pixel peak-fitting.

Regarding the accuracy of the PIV analysis, the main source of uncertainty in our setup results from the relatively thick lightsheet (\(\sim 5\,\hbox {mm}\)), which illuminates around 50% of the depth of the fluid layer. Correspondingly, a certain averaging of the velocity field in z-direction has to be assumed. The chosen illumination depth represents a compromise between a sufficient coloration signal of the TLC particles, a sufficient illumination of the salt crystals irrespective of their position in z-direction and a sufficiently small illumination depth regarding the flow visualization. Since a full elimination of this effect would probably necessitate a considerably more complex image acquisition system, this was not further addressed during the current work. As the measurement cell was designed to avoid three-dimensional phenomena at least in the meaning of large-scale flows, the averaging effect is, in the present case, confined mainly to the rather thin solute plumes ejected from the bottom mushy zone. Correspondingly with respect to fluid velocities, the latter are only qualitatively discussed in Sect. 6.1.

To analyze the interplay between size, growth and movement of the equiaxed crystals along their individual trajectories, we implemented the so-called particle tracking velocimetry (PTV) with a nearest velocity prediction using the python library Trackpy version 0.4.2. (Allan et al. 2019). During tracking, we allowed for a maximal search range of \({5}\times {10}\,\hbox {px}\) and for the intermittent disappearance of particles for one consecutive frame. To exclude trajectories of falsely identified equiaxed crystals, we dismissed all trajectories shorter than ten frames and such whose endpoints are closer than \(20\,{\hbox {px}}\). After this filtering, the particles that could be successfully associated with a corresponding trajectory constituted a more reliable estimation of the equiaxed crystal fraction than the total number of particles likewise classified merely by the image segmentation. We therefore only used tracked particles for the subsequent analysis of equiaxed crystals. Since no interpolation of the particle positions was employed, the accuracy of the PTV analysis of the tracked salt crystals depends only on the accuracy of the respective image segmentation and therefore possesses a maximal uncertainty in the order of \(\pm {0.5}\,{\hbox {px/frame}} \equiv \pm {0.15}\,{\hbox {mm}/\hbox {s}}\).

Fig. 18
figure 18

Global pattern of convection and crystallization at the onset of equiaxed crystallization (\({17.3}\,{\hbox {min}}\) from the start). a PIV reconstruction of the velocity field averaged over a period of 50 frames (\({16.7}\,{\hbox {s}}\)). The contour plot shows the absolute velocity. For better visibility, only every seventh vector is shown. b PTV reconstruction of the crystals trajectories. The local velocity along each trajectory is indicated by color coding and only the trajectories of crystals present in the current frame are shown. The figures display the complete fluid layer

For the quantitative global comparison of different crystallization regimes, the solid fraction of the crystals is typically used (compare for example Stefan-Kharicha et al. 2014). Our combination of optical measurements and image processing allows for a plausible measurement of the projected areas of the different crystal fractions. To attain a better comparability and a physically more meaningful quantity, we convert these areas into corresponding volume fractions. Assuming that the regions of columnar crystals and of the mushy zone fill the whole depth of the fluid container along the z-axis and that each equiaxed crystal possesses a spherical shape, the solid fraction can be computed as

$$\begin{aligned} c_{{\rm x}} = \frac{V_{{\rm x}}}{V_{{\rm cell}}} {100}\%. \end{aligned}$$
(15)

Here, \(V_{{\rm x}}\) denotes the cumulative volume of the crystal fraction \(\hbox {x}\) and \(V_{{\rm cell}} = {200}\,\hbox {mL}\) is the fluid cell’s inner volume. A corresponding trend of the solid fraction is given in Fig. 19 which is discussed in Sect. 6. We have to acknowledge that all three crystal fractions have locally and temporally different porosities which are almost impossible to measure accurately. Our estimations therefore can only be regarded as a qualitative indication of the evolution of the different fractions.

6 Exemplary applications of measurement techniques

In this section, we describe a typical solidification experiment. Please note that in this paper, we do not intend to give a full analysis of the interplay between solidification and double-diffusive convection. We merely want to highlight the benefits of the novel measurement techniques illustrated above. The general experimental procedure and temperature regime (see Fig. 3) is given in Sect. 2.2. Here, we show the results of an experiment where the difference between top and bottom boundary temperature was set to \(\varDelta T=0\,\hbox {K}\). With an initial boundary temperature of \(32.5\,^{\circ }{\hbox{C}}\) and a subsequent cooling with \({\dot{T}}={-1}\,{\hbox {K/min}}\) from \(t=0\;\hbox {to}\;{20}\,{\hbox {min}}\), the temperatures fell below the saturation temperature after \({6.1}\,{\hbox {min}}\) at the boundary and after \({11.4}\,{\hbox {min}}\) on average in the bulk fluid. At the end of the experiment, the mean bulk supercooling reached \(10.75\,\hbox {K}\) with respect to the initial salt concentration (the nominal supercooling calculated from the boundary temperatures was set to \(15\,\hbox {K}\)).

In this publication, we focus on the illustration of the experimental run by snapshots of the correspondingly measured field variables: Fig. 18 shows the global velocity fields of the fluid and the crystals during an early stage of the experiment which is mainly governed by global thermal convection, and Fig. 20 shows the velocity and temperature field of the fluid during a later stage exhibiting different phenomena specific to double-diffusive convection. In particular, during this stage, the benefits of our synchronous velocity and temperature measurement become apparent as it reveals the complex interaction between convection and crystallization that could otherwise only be simulated or merely presumed. In addition to the figures shown in this section, corresponding videos (Online Resource 3–5) illustrate the application of the established measurement scheme to the solidification experiment.

Fig. 19
figure 19

Development of the solid fraction of different types of crystals. Heavy precipitation of equiaxed crystals was confined to a period between 15 and \({\sim 40}\,{\hbox {min}}\). The peak for equiaxed crystals at \({16}\,{\hbox {min}}\) can be associated with a short period of increased sedimentation of fragments of columnar crystals originating from the upper wall. The distinct jumps in the curves for the mushy and columnar region were caused by the detachment and sedimentation of large columnar fragments

Fig. 20
figure 20

Double-diffusive convection at \(t={90}\,{\hbox {min}}\). a PIV reconstruction of the flow field averaged over five frames (\({1.67}\,{\hbox {s}}\)). The contour plot shows the absolute velocity. For better visibility, only every eleventh vector is shown. b Temperature field calibrated by the ANN averaged temporally over five frames (\({1.67}\,{\hbox {s}}\)) and spatially by a \(5\times 5\) Gaussian kernel. Only regions with at least 50% valid data points are shown. The figures display the complete fluid layer

6.1 Evolution of the flow structure during solidification

At the beginning of the cooling process (\(t\approx {2.5}\,{\hbox {min}})\) a number of smaller thermal plumes emerged from the top boundary and finally (\(t=15\dots {20}\,{\hbox {min}}\)) merged into two large counter rotating rolls (see Fig. 18a). During this period, the fluid velocity reached maximal values of \({\sim 5}\,{\hbox {mm}/\hbox {s}}\). Subsequently, the flow decomposed into smaller scales and slowed down to maximal values of \({\sim 3}\,{\hbox {mm}/\hbox {s}}\) at \({40}\,{\hbox {min}}\). In preliminary experiments conducted in the same measurement cell with similar thermal boundary conditions (Anders and Eckert 2017), we found a similar development of the flow structure together with fluid velocities of the same order of magnitude. Since in these studies, a combination of laser lightsheet and backlight illumination together with a classical 2D-2C-PIV analysis of the fluid velocity was used, this demonstrates the plausibility of the PIV/T measurement presented in the current work.

During the same period (after \({\sim 30}\,{\hbox {min}}\)), the first plumes of solute ejected from the bottom mushy layer appeared and gradually increased in strength. Since this solute was depleted of \(\hbox {NH}_{4}\hbox {Cl}\), it was of lower density than the surrounding fluid even if it possessed a lower temperature (compare Fig. 20b). The resulting buoyancy drove a solutal convection in the lower part of the fluid volume (see Fig. 20a). This mechanism of a plume-driven solutal convection had been reported previously for a Hele–Shaw configuration by Nishimura et al. (2003).

In the upper part of the cell, the continuing solidification and the resulting depletion of the fluid from \(\hbox {NH}_{4}\hbox {Cl}\) lead to a growing layer of quiescent cold liquid (\(T<20\,^{\circ }{\hbox{C}}\)) (see Fig. 20). This first became visible at \(t={31.6}\,{\hbox {min}}\) and continued throughout the rest of the experiment. The LCT method revealed the sharp transition between these two fluid layers with temperature gradients in the order of \({0.3}\,{\hbox { K/mm}}\). During the second half of the experiment (\(t>{60}\,{\hbox {min}}\)), the flow in the lower part of the volume organized into a number of small vertically stretched convection cells that were fed by the ascending solute plumes (compare Fig. 20a). In particular, after \(t={90}\,{\hbox {min}}\) , the global convection slowed down considerably, and the flow field was increasingly dominated by solute plumes.

In the past, similar layering phenomena of double-diffusive convection were reported for Hele–Shaw cells (Nishimura et al. 1998). For various configurations with cooled sidewalls, layering was reported in the form of a stratified quiescent layer above a strongly convecting layer (Beckermann and Viskanta 1988), layered convection cells (Skudarnov et al. 2002) or as a so-called meandering flow regime (Kharicha et al. 2013).

6.2 Crystallization phenomena

The first isolated columnar crystals grew at the upper and lower fluid boundary \({10}\,{\hbox {min}}\) after the start of the cooling process. Eventually, some of them were released from the upper mushy zone by the strong convective flow (see above) and subsequently sedimented. In Fig. 19, this process appears as a local peak in the development of \(c_{{\rm equi}}\) at \(t\approx {16}\,{\hbox {min}}\). After \({16.5}\,{\hbox {min}}\) , a closed columnar front formed at the upper boundary and the sedimentation of larger fragments diminished. One of the reasons for this lies in the increased mechanical strength against detachment as soon as the columnar crystals formed a continuous layer along the top boundary.

In accordance with Stefan-Kharicha et al. (2018b), we assume that after that time, only smaller crystal fragments whose size is below the camera resolution were further detached from the upper columnar front in larger quantities. These then stayed suspended in the convectional flow of the increasingly supercooled fluid (\(T_{{\rm sup}}\approx 1.8\dots 4.2\,\hbox {K}\) at \({16.5}\,{\hbox {min}}\)) where they grew into visible equiaxed crystals. In Fig. 19, the latter corresponds to the sharp increase of \(c_\mathrm {equi}\) between 15 and \({25}\,{\hbox {min}}\). Figure 18b shows the trajectories of these crystals shortly after the onset of a strong equiaxed crystallization. Depending on their size, the crystals followed the convectional flow of the liquid (compare Fig. 18a). During this period, enhanced crystal settling was mostly confined to regions of moderate upward flow and showed relative velocities in the order of \({1}\,{\hbox {mm}/\hbox {s}}\). Similar observations were made for example by Beckermann and Wang (1996).

After \(t\approx {30}\,{\hbox {min}}\) , the number of equiaxed crystals decreased. We attribute this to the afore mentioned quiescent fluid layer around the upper columnar region which led to less fragments and in turn to a smaller number of nuclei available for equiaxed crystallization. From the continuously high solid fraction of equiaxed crystals (compare Fig. 19), an increase in their average size can be deduced. This in turn can be explained by the increasing supercooling of the bulk liquid (\(T_{{\rm sup}}=5.1\dots 6.7\,\hbox {K}\) at \({30}\,{\hbox {min}}\)) which led to a stronger crystal growth. From \(t=30\) to \({60}\,{\hbox {min}}\) , equiaxed crystallization continuously declined and eventually ceased nearly completely. This can be attributed to two reasons mainly: The first being the above mentioned reduction of available nuclei from which equiaxed crystals could grow. The second reason is the continuous depletion of salt in the bulk fluid which reduced the effective supercooling. At the same time, the sedimentation of the freely moving crystals continues. After a certain period of growth in bulk, these have reached a mass that makes it difficult for convection to keep the crystals suspended, whereupon they sink onto the lower mushy zone and thus contribute to its growth.

Fig. 21
figure 21

LCT temperature field of a rapidly sinking large columnar crystal that detached from the upper columnar region at \(t={106.4}\,{\hbox {min}}\). a Directly before the detachment, b during sedimentation and c after the regeneration of the fluid stratification \({41}\,{\hbox {s}}\) after the initial detachment. In b, c, regions of insignificant temperature data due to the shadow of a large crystal are indicated by black rectangles. The temperature fields were spatially averaged by a \(5\times 5\) Gaussian kernel and only regions with at least 50% valid data points are shown. The figure shows detail views over nearly the full height of the fluid layer

Up to \({40}\,{\hbox {min}}\) , the upper columnar crystals showed a nearly constant growth, whereupon the growth gradually declined. At \(t\approx {60}\,{\hbox {min}}\) , the columnar front reached its final extension and ceased almost completely to grow any further (compare Fig. 19). This can be directly attributed to the quiescent layer of cold low-concentrated fluid which encompassed the columnar front completely. While the PIV analysis in Fig. 20a illustrates the stagnant nature of this layer, the LCT measurement in Fig. 20b reveals the low temperatures present in the upper part of the cell. In contrast to the upper columnar region, the lower mushy zone was constantly supplied with higher concentrated cold fluid and therefore subjected to a higher supercooling. This in turn led to further crystallization within the lower mushy zone which persisted until the end of the experiment. While one direct indication for this sustained growth is the continuing increase of \(c_{{\rm mush}}\) in Fig. 19), an additional indirect trace lies in the persistence of cold solute plumes emerging from the bottom mushy layer (see lower left part of Fig. 20b).

Occasionally, individual columnar crystals with a length of a few centimeters broke off and sank rapidly to the mushy zone (see the image sequence in Fig. 21 and compare with the distinct jumps in \(c_{{\rm col}}\) and \(c_{{\rm mush}}\) in Fig. 19). The strong wake of this sedimentation caused fluid velocities in the order of \({1.5}\,{\hbox {cm}/\hbox {s}}\). With the help of LCT, the rapid recovery of the upper quiescent fluid layer could be visualized. After less than one minute, the stratification of the fluid was restored. A corresponding video of this process can be found in Online Resource 5.

6.3 Accuracy and limitations of the LCT measurement during multiphase flow

So far in Sect. 4.4, we discussed the accuracy of the ANN concerning the RGB-to-temperature conversion only for the ideal conditions of the calibration experiment where no crystallization is present. However, it still has to be analyzed how reliable our measurement system performs under the conditions of the solidification experiments where substantial crystallization was present. For this, representative temperature values measured by the ANN system \(T_{{\rm ANN}}\) , and the directly measured temperature profiles from the thermistors immersed inside the fluid layer \(T_{{\mathrm {TH}}_i}\) were compared. Here, \(T_{{\rm ANN}}\) was calculated as the average of the LCT temperature fields within a \({30}\,{\hbox {px}}\) radius around each thermistor’s center. The corresponding deviations \(T_{{\rm ANN}} - T_{{\mathrm {TH}}_i}\) at each thermistor are plotted in Fig. 22, where solid lines represent the time ranges where the corresponding thermistors were not covered by crystals and correspondingly meaningful temperature deviations could be computed. Throughout the periods with meaningful data, the deviations at \(\hbox {TH}_{2-4}\) stayed within \({\pm 0.5}\,\hbox {K}\) which was even the case during the period with intense equiaxed crystallization 20–40 min.

However, as these deviations exceed the values of the performance tests described in Sect. 4.4, some typical causes and limitations have to be discussed. The deviations shown above were calculated from mean values in the direct vicinity of the thermistors which constitute geometrical distortions prone to be covered by crystallization. This in turn would lead to a time-dependent alteration of the local lighting conditions and correspondingly altered RGB values. In addition, the lightsheet’s thickness of 4–5 mm centered between front and back wall implies a certain integration in z-direction of the temperature fields obtained by the ANN. In contrast, the thermistors protruded only \(1\,{\text{mm}}\) into the fluid and only integrated the temperature directly around their tips. Moreover, in the color images, the masked regions corresponding to the thermistors were much larger than those of the equiaxed crystals in most cases which means that the regions for averaging \(T_{{\rm ANN}}\) had a comparably large distance to the sensors. Considering all this, inferring the temperature from the LCT at the exact position of the thermistors can be regarded as a worst-case scenario, and the deviations given in Fig. 22 represent a very conservative estimation.

Fig. 22
figure 22

Temperature accuracy of the ANN during the solidification experiments. Solid lines represent time ranges where the reference sensors showed a valid signal. Dashed lines indicate the time ranges where the reference sensors were either covered by crystals or the temperature was out of the valid range of ANN calibration

As already discussed in Sect. 4.4, the ANN cannot be applied to regions of insignificant saturation. During experiments, this can have two main reasons: First, the fluid temperature might be outside of the TLC’s temperature range, and second, the presence of large crystals or other objects might block the incident light and create shaded regions. The first cause can be mitigated through a careful coordination of the experiment’s temperature regime with the effective temperature range of the TLCs. During solidification experiments, the solutes concentration and the respective supercooling of the fluid also have to be selected accordingly to synchronize the crystallization with the color appearance. The second cause of insignificant saturation however is harder to avoid. The varying effects of shades and reflections of the discrete phase during solidification experiments must be considered impossible to regard during calibration. In our image processing procedure, we took two countermeasures: First, we implemented a masked color interpolation (see Sect. 3.2), and second, we filtered out remaining regions with insignificant saturation values (see Sect. 4.4). As the results presented in Sects. 6.1 and 6.2 illustrate, these countermeasures yielded reliable temperature fields for most of the experimental run. Considerable regions of spurious temperatures only remained for large shaded regions as present for example during the breakdown of large crystals (compare the region of unreasonably high temperatures left of the sinking crystal indicated by black rectangles in Fig. 21b, c).

7 Summary and prospects

In this work, we introduced an experimental setup and an image processing procedure which enabled us to simultaneously measure the solid and liquid velocity together with the liquid’s temperature fields during double-diffusive convection in the presence of crystallization. Moreover, this was achieved by a single optical measurement system with only one camera and lightsource which considerably reduced the technical effort for setup and calibration and corresponding errors. Our image segmentation procedure classifies objects in the digital images as columnar crystals, equiaxed crystals, tracer particles and optical artifacts. This allows for the subsequent application of common state-of-the-art flow measurement techniques for separate particle fractions. We’ve proposed a novel liquid crystal thermometry employing an artificial neural network using spatial coordinates and RGB intensities as input vectors. With this, global temperature fields of the entire fluid layer can be successfully acquired under ideal conditions without crystallization with an accuracy better than \({\pm 0.2}\,\hbox {K}\) for almost the complete temperature range of the TLCs and even up to \({\pm 0.1}\,\hbox {K}\) for a limited range. During the solidification experiments, the constructed ANN yielded an accuracy better than \({\pm 0.5}\,\hbox {K}\) even in the presence of strong crystallization.

Due to the simple generic imaging setup, we believe that the methods established in this paper can be applied for optical flow measurements in a multitude of multiphase flows regardless of the specific presence of phase transitions. In addition, we think, the methods for determining and calibrating the coloration of TLC particles and the correspondingly achieved accuracy will be of great value to researchers interested in optical temperature measurements in general. In the present case of convection with simultaneous crystallization, a number of fascinating features could be successfully quantified. Here, the noninvasive temperature measurement by LCT yielded spatially and temporally resolved temperature fields over the entire fluid layer with almost constant quality. Conventional techniques like sensor arrays, in contrast, either yield only a local temperature information or must be regarded as a highly invasive technique which is likely to alter the flow and solidification regimes considerably (consider for example the crystallization on the measuring tips of the thermistors).

In addition to this, the application of PIV and PTV techniques allowed for the simultaneous measurement of corresponding velocity fields. With this, it could for example be revealed how segregation phenomena, e.g., solute plumes accompanying the crystallization, lead to a quiescent layer of cold-depleted liquid which ultimately suppressed further columnar crystal growth. In the future, we will employ the established measurement scheme for a detailed study of the influence of parameters as external temperature difference, cooling rate or supercooling on the development of different convection and solidification regimes.