1 Introduction

Over the past several decades, particle image velocimetry (PIV) has evolved as a widely useful flow diagnostic tool in the discipline of experimental fluid mechanics (Westerweel et al. 2013). Since its invention (Adrian 1984; Westerweel 1997), research into PIV techniques has concentrated on improving the robustness, spatial and temporal resolution, and accuracy of the method (Huang et al. 1997; Scarano and Riethmuller 1999; Hart 2000; Roth and Katz 2001). Through these efforts, along with recent technological advances in digital imaging, lasers, and computers, PIV has made great strides. However, most PIV algorithms developed to date have been limited to flows in a fluid-only region. Despite the fact that many flows of interest involve a free surface, few studies have addressed the need for PIV algorithms that characterize flows around an arbitrarily moving free surface. Systems in the presence of flows with a free surface occur both in nature and in a variety of engineering fields. Typical examples of such systems are open-channel flows and sloshing flows. The defining property of a free surface, a compliant water–air interface between the liquid and air phases, is its high deformability, which makes the flows with a free surface challenging to be analyzed with PIV algorithms.

In laboratory PIV experiments, a working fluid is usually confined in a solid container with vertical walls. As the fluid meets the solid wall, a meniscus forms at the free surface, causing the free surface to curve upwards at rest. When agitated, two different dynamic meniscuses are produced with varying meniscus thicknesses, depending on the direction and velocity of the free surface, which make it difficult to determine the positions of the free surface in the PIV images, as will be discussed later. Previous research on PIV measurement methods for free surface flows has mostly employed the intensity-based methods to locate the free surface (Siddiqui et al. 2001; Li et al. 2005, 2008; Nezu and Sanjou 2011). They identified the location of a free surface using the maximum intensity gradient points in the PIV images. Since the intensity-based methods analyze images pixel by pixel, they may be applicable to even violent free surface flows with foams, whitecaps, or singularity points. However, the intensity-based methods are not only time-consuming since all the pixels in PIV images are processed (Jeon and Sung 2011), but also of dubious accuracy because neither the maximum intensity points nor the maximum intensity gradient points can accurately represent the actual free surface (Zarruk 2005). Moreover, the water–air interface works as a semi-reflective mirror inducing non-uniform pixel intensity profiles in PIV images; thus, intensity-based free surface detection schemes (e.g., Sobel or Canny edge detection) are not robust enough for accurate detection (André and Bardet 2014). The difficulties associated with tracking a free surface in a PIV image have been reduced by utilizing additional equipment. A laser focus displacement meter (LFD) was used to measure the instantaneous free surface elevation in combination with PIV measurements (Hazuku et al. 2003). André and Bardet (2014) employed a planar laser-induced fluorescence (PLIF) method in which an additional camera was used to identify the free surface location, and the free surface velocity was determined using an extrapolation/interpolation scheme. Although the LFD and PLIF methods detected the free surface profile with reasonable accuracy, both methods required additional equipment and post-processing steps. Most importantly, none of the PIV measurement methods above was capable of directly measuring the velocity profiles of the free surface and the liquid underneath the free surface. Instead, the fluid-only region, the interrogation windows of which are free from the free surface, was solely analyzed based on the determined free surface location. In this regard, the previous PIV measurements methods were fundamentally limited to fully understand the free surface dynamics.

Technologically mature cross-correlation-based PIV algorithms have been widely utilized to date. However, when resolving free surface flows using these PIV algorithms, the square-shaped interrogation windows overlapping the highly deformable water–air interface are susceptible to a lack, or even an absence, of seeding particles, which leads to less reliable PIV measurement results (Huang et al. 1997; Theunissen et al. 2008). Novel approaches to applying PIV methods to flows that involve an arbitrarily moving free surface are required. Nguyen and Wells (2006) and Nguyen et al. (2010) outlined a PIV technique, called PIV/interface gradiometry (PIV/IG), for measuring the velocity field in proximity to a curved fixed wall. An iterative linear window deformation (Scarano 2002) was used in the PIV/IG method to determine the wall shear gradient and the tangential velocity profile. Utilizing the above-mentioned PIV/IG algorithm, Jeon and Sung (2011) performed PIV measurements on the flow around an arbitrarily moving solid–liquid interface with a contour–texture analysis method based on user-defined textons, a set of image patterns resembling the interface, to accurately detect the interface (Malik et al. 2001). The solid–liquid interface was tracked using user-defined textons that resembled the real interface, and the raw PIV images with a curved interface were transformed using a linear interpolation scheme to reconstruct the PIV images with a straightened interface. The modified PIV/IG algorithm was applied to the transformed PIV images to calculate the solid–liquid interface velocity based on the velocity field of the flow around the interface. Notwithstanding its satisfactory results, this PIV measurement technique is not suitable to characterize free surface flows due to two main limitations: First, the single texton-based interface tracking method cannot accurately detect a free surface that features varying interface intensity profiles; second, the linear interpolation-based image transform is not appropriate for PIV images of free surface flows in which the water–air interface is highly deformable, as will be described later.

Sloshing flows, which form a subset of the various free surface flow systems, were selected to examine the applicability of the proposed method in the present study. Sloshing is a free surface motion in a partially filled tank. Such motions are commonly encountered in liquids in storage tanks under an external excitation. Sloshing-induced forces that act on a liquid tank may critically affect the stability of the system, and characterizing the free surface motions can be quite important. While numerous analytic and numerical studies have been conducted over the last few decades, few experimental studies examined sloshing phenomena due the difficulty of measuring the free surface velocity profile (Sawada et al. 2002; Faltinsen et al. 2006). The previous experimental research into sloshing flows utilized wave probes (Faltinsen et al. 2000; Pal and Bhattacharyya 2010), ultrasonic sensors (Sawada et al. 1999; Cruchaga et al. 2013), or intensity-based image processing (La Rocca et al. 2005; Eswaran et al. 2011) in order to measure the free surface elevation at points of interest. However, none of them proposed a method to resolve the vertical and horizontal velocities of the free surface and the fluid underneath it.

This paper presents an image preprocessing method of PIV measurements for resolving free surface flows. The proposed method is, unlike the previous PIV techniques that cannot directly measure the free surface velocity, capable of resolving the velocity profiles of the free surface and the fluid underneath it. The free surface position was detected using a modified contour–texture analysis with multiple textons of various meniscus thicknesses to exactly locate the free surface. The entire free surface profile was determined by interpolating the discretely detected free surface points using a cubic Hermite spline interpolation scheme. The raw PIV images, along with the free surfaces, were transformed so that the newly constructed images presented straightened free surfaces. After the image preprocessing step, the velocity field of the fluid-only region was measured by applying standard PIV methods with a linear window deformation. A revised PIV/IG was subsequently applied to the reconstructed PIV images to measure the free surface velocity. Finally, the full velocity field in the original PIV images was established using an inverse transform applied to the transformed images. The presented interpolation scheme was quantitatively examined with the linear interpolation by applying them to two types of synthetic numerically produced PIV images: a moving sphere in a uniform flow and a rotating sphere in a rotational flow. In addition, externally induced sloshing was investigated to confirm the applicability of the proposed method.

2 Experimental methods

2.1 Sloshing setup

The free surface motions associated with sloshing during periodic tank oscillations depend largely on the oscillation frequency, the amplitude of excitation, the liquid container geometry, and the liquid fill depth with respect to the length of the tank (Akyildiz and Unal 2005). Figure 1 shows a schematic diagram of the experimental apparatus used to investigate externally induced two-dimensional sloshing in a rectangular tank. The sloshing tank was made of 10-mm-thick transparent acrylic plastic plates with dimensions of 500 mm in length (L), 100 mm in breadth (B), and 500 mm in height (H). The dimensions of the sloshing tank were carefully chosen to be L/B = 5 so that the liquid sloshing in the rectangular tank was assured to be two-dimensional (Ji et al. 2012). The tank was placed on a shaking table connected to a DC motor with a crank arm so that the rotary motion of the DC motor was converted into a lateral harmonic table oscillation. The sloshing tank moved in a periodic manner along the longitudinal axis according to X = X 0 sin(2πft), where X is the lateral displacement of the tank, Y is the vertical displacement of the tank, X 0 is the amplitude of the tank displacement, and f is the forcing frequency in the stationary coordinate system XYZ. The vertical displacement of the tank was not considered because the sloshing tank moved only in the longitudinal direction.

Fig. 1
figure 1

Experimental setup

Numerous sloshing experiments have employed sensor-based equipment to keep track of the tank position. Here, an inexpensive, readily available laser pointer was used for this purpose. The laser pointer remained stationary in the absolute coordinate system and directed red visible light onto a piece of black paper attached to the tank surface, thereby forming a reference point. The position of the reference point in the PIV images moved in the direction opposite to the tank motion as the tank oscillated laterally. The reference point position varied in the moving relative coordinate system fixed on the tank while remaining stationary in the absolute coordinate system. The free surface displacements at the liquid–air interface were measured in the moving relative coordinate system ξηζ as indicated in Fig. 1. The tank was partially filled with water to a fill depth of h l  = 200 mm in the sloshing tank to form the working fluid.

2.2 PIV image acquisition

A planar laser sheet with a thickness of 2 mm was produced using a continuous 532 nm Nd:YAG laser (Millenia Vs, Spectra-Physics) and a cylindrical Galilean beam expander that is comprised of a plano-concave and a plano-convex cylindrical lenses. Water in the sloshing tank was seeded with 50-μm polyamide seeding particles (PSP-50, Dantec Dynamics) for visualization. A high-speed CMOS camera (MotionPro, Redlake) with a maximum resolution of 1,280 × 1,024 pixels2 and a maximum frame rate of 2,000 fps (frames per second) was anchored to the shaking table with a distance of 1,000 mm from the tank centerline. The particle images were then captured in the relative moving coordinates of the oscillating sloshing container. The field of view was set to be approximately 600 × 600 mm2 using a zoom lens with manual focus and aperture adjustment (AF Zoom-Nikkor 18–35 mm f/3.5–4.5D) mounted on the CMOS camera. The micro-particles were illuminated by the laser sheet, and the 8-bit grayscale images of the seeding particles were recorded at a resolution of 1,024 × 1,024 pixels2 and at 100 fps.

In a typical PIV measurement, particle images were divided into a set of interrogation windows, known as sub-images, to measure the flow velocities using a cross-correlation analysis. Figure 2a shows an example of the window arrangement for a fluid-only region. The location of the liquid–air interface in a free surface flow system must be considered when implementing PIV. The interrogation windows positioned with the typical window arrangement shown in Fig. 2b can produce erroneous results due to the non-uniform intensity profiles of the free surface and a lack, or even absence, of seeding particles in the windows neighboring the free surface (Huang et al. 1997; Theunissen et al. 2008), as mentioned earlier. This is simply because the free surface fluctuates within the interrogation windows, thereby affecting the number of particles in each interrogation window. The interrogation windows in a PIV system used to measure the free surface flow should be aligned with the curvilinear liquid–air interface, and this arrangement requires the exact location of the free surface. It is, therefore, important to accurately identify the location of the interface of the free surface flow.

Fig. 2
figure 2

Interrogation window arrangement. a In the fluid-only region; b near the free surface. c A free surface flow image without Rhodamine B; d a free surface image with Rhodamine B

The solid–liquid interface is defined by a radical change in the PIV image intensity level because photons cannot penetrate the surface of a solid object. The amount of light scattered and reflected toward the CMOS camera sensor is quite large. For these reasons, identifying the solid–liquid interface is not challenging; however, the liquid–air interface is relatively difficult to detect because only a small fraction of light is scattered and reflected along the direction perpendicular to the laser sheet path. The interface is characterized by a low-intensity gradient at the interface, as shown in Fig. 2c. For the purpose of addressing this problem, a very small amount of Rhodamine B (Junsei Chemical Co., Ltd.) solution was added to the working fluid to increase the overall intensity level of the liquid phase region, as shown in Fig. 2d. The Rhodamine B molecules dissolved in water-radiated fluorescence when stimulated by the laser sheet, leading to better detection at the liquid–air interface.

3 Image preprocessing

3.1 Free surface detection

As discussed earlier, it is essential to determine the free surface location when applying the PIV method to the free surface flow. Unlike solid–liquid interfaces, liquid–air interfaces form a meniscus at the intersection between the free surface and the container walls, resulting in three-dimensional waves with a small wave amplitude relative to the mainstream wave amplitude. Figure 3a shows a sample PIV image of the free surface flow. The free surface flow in a container can be characterized as a set of meniscuses with different curvatures and thicknesses. The meniscus at an interface must be corrected to achieve accurate interface tracking. A concave meniscus is present on a free surface without external perturbations. The water–air interface present in sloshing flows (more generally in free surface flows) features varying intensity profiles in the PIV images depending on the meniscus shape. Induced by the dynamic meniscus, the deformed free surface is produced in the foreground of the PIV image plane depending on the moving direction of the free surface (a concave meniscus when moving downward and a convex meniscus when moving upward). It should be noted that the near-wall free surface is illuminated by the refracted and scattered light even though the light sheet is placed in the tank centerline. When illuminated, the free surface works as a semi-reflective mirror (André and Bardet 2014). The directions of the refracted light by the free surface are schematically indicated in the inset of Fig. 3b. With the convex meniscus, the partially refracted light converges, so the free surface in this case is characterized with an obscure interface indicated as I in Fig. 3a. With the convex meniscus, on the other hand, the fractionally refracted light diverges, so some of the refracted light reaches the CCD camera. In such a case, the free surface appears as II in Fig. 3a. The thickness of the concave meniscus is commensurate with the magnitude of the free surface velocity (downward) in the vicinity of the wall. When a thick concave meniscus is produced, the free surface with the thick concave meniscus appears as III in Fig. 3a. The varying intensity profiles of the free surface due to the dynamic meniscus make the free surface difficult to be detected in PIV images. In order to exactly locate the free surface position, the meniscus present in the free surface must be considered. Moreover, when performing PIV measurements near free surfaces, high pixel intensity (usually even higher than seeding particles) of the dynamic meniscus (concave meniscus particularly) may produce significant errors into the velocity vector measurement using PIV calculation. The intensity profiles of three free surface points (circles in Fig. 3a) have been drawn in Fig. 3b. A single texton-based interface tracking method is inappropriate for determining the free surface location since there are various intensity profile patterns on the free surface. Therefore, we propose a novel free surface detection method using multiple textons of different meniscus thicknesses.

Fig. 3
figure 3

a A free surface image with varying meniscus thicknesses. b Intensity profiles at three free surface points

Figure 4 shows the user-defined textons that resemble the free surface captured in the PIV images. The structure of the sn coordinate system is described in Fig. 4a. The coordinates include the free surface-parallel direction (s) and the free surface-normal direction (n). The texton for n > 0 represents the liquid region, and the texton for n < 0 represents the air region. The inclined angle is defined, as shown in Fig. 4b. Note that each of the three textons illustrated in Fig. 4 has a meniscus thickness that varies as indicated in Fig. 4c. For each meniscus thickness, 72 textons are generated, each of which differs in its inclined angle by 5°. The user-defined textons utilized in this paper are defined as

Fig. 4
figure 4

User-defined texton. a The sn coordinate system of the textons. b The inclined angle of the textons. c Texton interface thickness

$$T(i,j,\theta ,\sigma ) = \exp \left[ { - \frac{{(i\sin \theta - j\cos \theta )^{2} }}{{2\sigma^{2} }}} \right] + M(i,j,\theta ) ,$$
(1)

where

$$M(i,j,\theta ) = \left\{ {\begin{array}{*{20}c} {M_{a} \,\,{\text{for}}\,\,d_{r} \le t_{s} /2\,\,{\text{and}}\,\,n < 0.} \\ {M_{l} \,\,{\text{for}}\,\,d_{r} \le t_{s} /2\,\,{\text{and}}\,\,n \ge 0.} \\ \end{array} } \right.$$

T(ijθσ) represents multiple textons with various inclined angles θ and meniscus thicknesses in the rectangular coordinate system i and j. The orthogonal system that is comprised of n and s axes, attached along with the centerline of the textons, is shown in Fig. 4a. M a and M l are the average intensities of the air and liquid region, respectively, and d r is the radius from the center of T(ijθσ). The texton size is t s , as denoted in Fig. 4c. The summation symbol indicates the integral of the pixel intensity over the texton size in the s direction. In other words, the upper and lower limits of the summation limits are t s and −t s , respectively.

The objective of the free surface detection method was to discretely locate the free surface position (x and y) and obtain the inclined angle (θ) and the meniscus thickness (σ) at each free surface location. The computation time required to locate the whole free surface profile was reduced using the proposed detection method based on an iterative prediction and correction scheme, resulting in discretely detected free surface points with a shooting distance L between each step (Fig. 5a). That is, the free surface location (x, y) k shown in Fig. 5b was attained by shooting the free surface location (x, y) k-1 along with the inclined angle θ k-1 and the meniscus thickness σ k-1 across a shooting distance L, according to

Fig. 5
figure 5

a Schematic diagram showing the detected free surface. b A position predicted based on (x, y, θ, m t ) k-1 . c Position correction, d angle correction, e position correction using the newly generated textons

$$\begin{array}{*{20}c} {x_{k} = x_{k - 1} - \frac{{\sigma_{k - 1} }}{2}\cos(\theta_{k - 1} + \frac{\pi }{2}) + L\cos\theta_{k - 1} ,} \\ {y_{k} = y_{k - 1} - \frac{{\sigma_{k - 1} }}{2}\sin(\theta_{k - 1} + \frac{\pi }{2}) + L\cos\theta_{k - 1} .} \\ \end{array}$$
(2)

It should be noted that the predicted location was displaced by the distance σ k-1 /2 along the direction normal to the inclined angle, as shown in Fig. 5e, thereby precisely locating the free surface but not the meniscus. The predicted free surface location was not the actual location of the free surface, as shown in Fig. 5b. The correction procedures were applied based on the predicted location, according to three steps: the position correction, angle correction, and position correction using the newly generated textons, as shown in Fig. 5c–e. First, the free surface location was corrected along the direction perpendicular to the inclined angle θ k-1 by the maximum value of the probability function P Δ(Δ), as shown in Fig. 5c, based on the following equations:

$$P_{\varDelta } (\varDelta_{k} ) = \,\,\frac{1}{{(t_{s} + 1)^{2} }}\sum\limits_{{i = - t_{s} /2}}^{{t_{s} /2}} {\sum\limits_{{j = - t_{s} /2}}^{{t_{s} /2}} {\frac{{\left[ {I(x_{k} + \varDelta_{k} \cos (\theta_{k - 1} + \frac{\pi }{2}),y_{k} + \varDelta_{k} \sin (\theta_{k - 1} + \frac{\pi }{2})) - I_{\text{avg}} } \right]\left[ {T(i,j,\theta_{k - 1} ,\sigma_{k - 1} ) - T_{\text{avg}} } \right]}}{{I_{\text{std}} T_{\text{std}} }}} } .$$
(3)
$$\begin{array}{*{20}c} {x_{k} \leftarrow x_{k} + \hbox{max} P_{\varDelta } (\varDelta )\cos (\theta_{k} + \frac{\pi }{2}),} \\ {y_{k} \leftarrow y_{k} + \hbox{max} P_{\varDelta } (\varDelta )\sin (\theta_{k} + \frac{\pi }{2}).} \\ \end{array}$$
(4)

Next, the inclined angle θ k was determined to be the maximum value of the normalized cross-correlation function with the 72 pre-described textons of different inclined angles at the free surface location (x, y) k , as shown in Eq. (5).

$$\theta_{k} (x_{k} ,y_{k} ,\sigma_{k - 1} ) = \hbox{max} \,\,\,\frac{1}{{(t_{s} + 1)^{2} }}\sum\limits_{{i = - t_{s} /2}}^{{t_{s} /2}} {\sum\limits_{{j = - t_{s} /2}}^{{t_{s} /2}} {\frac{{\left[ {I(x_{k} + i,y_{k} + j) - I_{\text{avg}} } \right]\left[ {T(i,j,\theta ,\sigma_{k - 1} ) - T_{\text{avg}} } \right]}}{{I_{\text{std}} T_{\text{std}} }}} } ,$$
(5)

where I avg is the average intensity of the sub-image, T avg is the average intensity of the texton, I std is the standard deviation of the sub-image intensity, and T std is the standard deviation of the texton intensity. Lastly, the meniscus thickness at the given free surface position was obtained as the maximum value of the normalized cross-correlation function, as in Eq. (6).

$$\sigma_{k} (x_{k} ,y_{k} ,\theta_{k} ) = \,\hbox{max} \,\,\frac{1}{{(t_{s} + 1)^{2} }}\sum\limits_{{i = - t_{s} /2}}^{{t_{s} /2}} {\sum\limits_{{j = - t_{s} /2}}^{{t_{s} /2}} {\frac{{\left[ {I(x_{k} + i,y_{k} + j) - I_{\text{avg}} } \right]\left[ {T(i,j,\theta_{k} ,\sigma ) - T_{\text{avg}} } \right]}}{{I_{\text{std}} T_{\text{std}} }}} } .$$
(6)

After iterative applications of the correction steps, (x, y, θ, σ) k was finalized, and all discrete free surface locations were obtained using an iterative application of the prediction and correction scheme.

3.2 Image transform

As mentioned earlier, the PIV images that involve a curvilinear free surface should be transformed into images with a straightened free surface so that the uniform interrogation window arrangement could be applied. A new coordinate system with two orthogonal axes was defined based on the curvilinear s-axis in which the free surface was oriented from left to right and the free surface-normal n-axis. An intermediate coordinate system xy′ was defined to interpolate the free surface points, as shown in Fig. 6b. The red circles on the free surface represent discretely detected free surface points (x, y) k . The PIV images in the original coordinate system xy in Fig. 6a were transformed into those in the intermediate coordinate, as represented in Fig. 6b, based on the following counterclockwise rotation–translation transform matrix operation:

Fig. 6
figure 6

Illustration of the coordinate transform. a Original coordinates; b intermediate coordinates after the rotation-translation transform; c new coordinates along with the free surface; and d transformed coordinates

$$\left( {\begin{array}{*{20}c} {x_{k}^{{\prime }} } \\ {y_{k}^{{\prime }} } \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {\begin{array}{*{20}c} {\cos \alpha_{k} } & { - \sin \alpha } \\ \end{array}_{k} } \\ {\begin{array}{*{20}c} {\sin \alpha_{k} } & {\cos \alpha_{k} } \\ \end{array} } \\ \end{array} } \right)\left( {\begin{array}{*{20}c} x \\ y \\ \end{array} } \right) - \left( {\begin{array}{*{20}c} {x_{k} } \\ {y_{k} } \\ \end{array} } \right)\,,$$
(7)

where α k is the tilt angle between two discrete free surface points. After the rotation–translation transform, the whole free surface profile was interpolated using the cubic Hermite interpolation based on the discretely detected free surface points. This not only preserved the monotonicity of the interpolated free surface, but also allowed for the accurate detection of a highly wavy and complex free surface. The fundamental concept of the cubic Hermite spline interpolation was fit to a piecewise third-degree polynomial along its designated interval as follows:

$$s_{k} (x) = a_{k} x^{3} + b_{k} x^{2} + c_{k} x + d_{k} \,\,{\text{for}}\,x_{k} \le x \le x_{k + 1} .$$
(8)

After the coordinate transform, we applied the spline functions of the form

$$s_{k} (x^{{\prime }} ) = a_{k} x^{{{\prime }3}} + b_{k} x^{{{\prime }2}} + c_{k} x^{{\prime }} + d_{k} \,\,{\text{for}}\,0 \le x^{{\prime }} \le L_{k} ,$$
(9)

where \(\,L_{k} = \sqrt {(x_{k + 1} - x_{k} )^{2} + (y_{k + 1} - y_{k} )^{2} } .\) Since the cubic Hermite spline interpolation function s(x ) must be continuous and smooth on all intervals, we established boundary conditions (10) and (11) according to

$$s_{k} (0) = s_{k} (L_{k} ) = 0,$$
(10)
$$\left. {\frac{{{\text{d}}s_{k} }}{{{\text{d}}x'}}} \right|_{x' = 0} = \tan (\theta_{k} - \alpha_{k} ),\,\,\left. {\,\frac{{{\text{d}}s_{k} }}{{{\text{d}}x'}}} \right|_{{x' = L_{k} }} = \tan (\theta_{k + 1} - \alpha_{k} ).$$
(11)

By applying Eqs. (10) and (11) to (9), we produced the cubic Hermite spline interpolation function s(x ) that interpolated all of the free surface points in the intermediate coordinate system, as described in Eq. (10), where the coefficients are

$$a_{k} = \frac{{\tan (\theta_{k} - \alpha_{k} ) + \tan (\theta_{k + 1} - \alpha_{k} )}}{{L_{k}^{2} }},$$
(12)
$$b_{k} = - \frac{{2\tan (\theta_{k} - \alpha_{k} ) + \tan (\theta_{k + 1} - \alpha_{k} )}}{{L_{k} }},$$
(13)
$$c_{k} = \tan (\theta_{k} - \alpha_{k} ),$$
(14)
$$d_{k} = 0.$$
(15)

The interpolated free surface points (x , y ) could be used to build the ns coordinate system, as described in Fig. 6b. After a clockwise rotation–translation matrix operation, the transformed PIV image I(s, n) in the sn-coordinate system in Fig. 6c could be represented as I(x trans, y trans) (Fig. 6d) as defined in Eq. (16):

$$\left( {\begin{array}{*{20}c} {x_{\text{trans}} } \\ {y_{\text{trans}} } \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} s \\ n \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {\begin{array}{*{20}c} {\cos \alpha_{k} } & {\sin \alpha } \\ \end{array}_{k} } \\ {\begin{array}{*{20}c} { - \sin \alpha_{k} } & {\cos \alpha_{k} } \\ \end{array} } \\ \end{array} } \right)\left( {\begin{array}{*{20}c} {x^{{\prime }} } \\ {y^{{\prime }} } \\ \end{array} } \right) + \left( {\begin{array}{*{20}c} {x_{k} } \\ {y_{k} } \\ \end{array} } \right)\,\,\,{\text{for}}\,\,x_{k} \le x^{{\prime }} < x_{k + 1} ,$$
(16)

where

$$x_{\text{trans}} = x_{k} + n\cos \left( {\theta_{k} + \frac{\pi }{2}} \right) + L_{k} (n)s\,\cos \alpha_{k} + f_{k} (s,n)\sin \alpha_{k} ,$$
(17)
$$y_{\text{trans}} = y_{k} + n\sin \left( {\theta_{k} + \frac{\pi }{2}} \right) - L_{k} (n)s\,\sin \alpha_{k} + f_{k} (s,n)\cos \alpha_{k} ,$$
(18)
$$f_{k} (s,n) = L_{k} (n)\left[ {\left\{ {\tan (\theta_{k} - \alpha_{k} ) + \tan (\theta_{k + 1} - \alpha_{k} )} \right\}s^{3} - 2\left\{ {2\tan (\theta_{k} - \alpha_{k} ) + \tan (\theta_{k + 1} - \alpha_{k} )} \right\}s^{2} + \tan (\theta_{k} - \alpha_{k} )s} \right],$$
(19)
$$L_{k} (n) = \sqrt {\left[ {\left\{ {x_{k + 1} + n\cos \left( {\theta_{k + 1} + \frac{\pi }{2}} \right)} \right\} - \left\{ {x_{k} + n\cos \left( {\theta_{k} + \frac{\pi }{2}} \right)} \right\}} \right]^{2} + \left[ {\left\{ {y_{k + 1} + n\sin \left( {\theta_{k + 1} + \frac{\pi }{2}} \right)} \right\} - \left\{ {y_{k} + n\sin \left( {\theta_{k} + \frac{\pi }{2}} \right)} \right\}} \right]^{2} } .$$
(20)

When transforming a PIV image with a curvilinear free surface into an image with a straight free surface, the original particle image is stretched along the free surface. This image extension causes the free surface-parallel velocity vector u distorted in the transformed images while the free surface-normal velocity is preserved under the condition that the s-axis overlaps with the x trans-axis in Fig. 6. The displacements ds and dx trans are equivalent at the free surface (n = 0) whereas they are not the same values (n ≠ 0). As conducted in Jeon and Sung (2011), the velocity vector u was modified as \(\,u \leftarrow (1 - \frac{n}{L}\Delta \theta )\,u\) to correct the vector distortion. Here note that the shooting distance L should not be too small, and the inclined angle θ k has to be smoothed as \(\theta_{k} \leftarrow 0. 2 5\theta_{k - 1} + 0. 5\theta_{k} + 0. 2 5\theta_{k + 1}\) to minimize the random error induced by the vector modification.

3.3 PIV algorithms

After applying the image preprocessing steps described in the previous section, the PIV images with a curvilinear free surface were transformed into those with a straight free surface. Hence, a standard PIV algorithm with a structured interrogation window arrangement could be applied to the images. Standard PIV with linear window deformation was applied to the transformed images to calculate the fluid-only region velocities (white circles in Fig. 7a). The flow velocities obtained permitted resolution of the free surface velocities using a modified PIV/interface gradiometry (PIV/IG) method. PIV/IG is a direct method for measuring the flow velocity gradients at the interface proposed by Nguyen and Wells (2006) and Nguyen et al. (2010). The modified PIV/IG method developed by Jeon and Sung (2011) for measuring the interface velocity based on a window deformation with a first-order truncation error was applied to the transformed images to measure the free surface velocities. The fundamental goal of this algorithm was to identify free surface vectors that maximized the normalized cross-correlation coefficient given in Eq. (21) so that the interrogation windows and free surfaces were identical when deformed based on the free surface vector predictors.

$$G_{{\frac{du}{dn},\frac{dy}{ds}}} = \frac{{\sum\nolimits_{{i = n - w_{x} /2}}^{{n + w_{x} /2}} {\sum\nolimits_{{s = n - w_{y} /2}}^{{s + w_{y} /2}} {[(I_{1}^{{\prime }} (i + j\frac{du}{dn},j + i\frac{dv}{ds}) - \overline{{I_{1} }}^{'}_{{\frac{du}{dn},\frac{dv}{ds}}} )(I_{2}^{{\prime }} (i,j) - \overline{{I_{2} }}^{'} )]} } }}{{\sqrt {\sum\nolimits_{{i = n - w_{x} /2}}^{{n + w_{x} /2}} {\sum\nolimits_{{s = n - w_{y} /2}}^{{s + w_{y} /2}} {\left[ {I_{1}^{{\prime }} (i + j\frac{du}{dn},j + i\frac{dv}{ds}) - \overline{{I_{1} }}^{'}_{{\frac{du}{dn},\frac{dv}{ds}}} } \right]}^{2} } } \sqrt {\sum\nolimits_{{i = n - w_{x} /2}}^{{n + w_{x} /2}} {\sum\nolimits_{{s = n - w_{y} /2}}^{{s + w_{y} /2}} {\left[ {I_{1}^{{\prime }} (i,j) - \overline{{I_{2} }}^{'} } \right]^{2} } } } }},$$
(21)

where

$$\overline{I}^{\prime}_{{\frac{du}{dn},\frac{dv}{ds}}} = \frac{1}{{w_{x} w_{y} }}\sum\limits_{{i = n - w_{x} /2}}^{{n + w_{x}/2}} {\sum\limits_{{s = n - w_{y} /2}}^{{s + w_{y} /2}}} I^{\prime}\left(i + j\frac{du}{dn},j + i\frac{dv}{ds} \right),$$
(22)
$$\overline{I}^{'} = \frac{1}{{w_{x} w_{y} }}\sum\limits_{{i = n - w_{x} /2}}^{{n + w_{x} /2}} {\sum\limits_{{s = n - w_{y} /2}}^{{s + w_{y} /2}} {I^{'} (i,j} } ).$$
(23)

Here, I 1 and I 2 are a pair of PIV images; w x and w y are the width and height of the interrogation windows; u and v are the horizontal and vertical velocities. As illustrated in Fig. 7b, c, the velocities at the free surface (red circles) could be directly measured using the velocities in the fluid-only region (white circles) and the linear window deformation.

Fig. 7
figure 7

Illustration of the PIV/IG method. a PIV results obtained on the flow region. b Enlarged image. c Velocities at the free surface were obtained under the assumption of a linear window deformation

The velocity field at and near the free surface in the original PIV images could be established by combining the inverse-transformed velocities of the free surface and the velocities of the fluid-only region. It should be noted that, during the inverse-transformation, the velocities should be scaled according to the distance from the free surface. Moreover, during the entire process, the sub-pixel intensity level must be determined using an interpolation scheme. Kim and Sung (2006) performed a comparative study on various interpolation schemes for PIV with both uniform and shear flows. After an in-depth parametric study, they concluded that the cubic, Lagrange, and sinc interpolation schemes are excellent in terms of the mean and random errors. In the present study, the cubic spline interpolation function \(c\left( x \right) = \left( {a + 2.0} \right)\left| x \right|^{ 3} - \left( {a + 3.0} \right)\left| x \right|^{ 2} + 1.0\) with a = − 0.8 was employed, as suggested by Kim and Sung (2006) for better accuracy.

4 Results and discussion

4.1 Validation with synthetic images

Synthetic PIV images were generated and evaluated to quantitatively validate the advantages of the cubic Hermite spline image mapping method over the linear image mapping method. A systematic comparison was conducted using two sets of numerically created 8-bit synthetic images of a spherical body with rectilinear motion in a uniform flow or with rotational motion in a rotational flow. These settings were chosen because any free surface motion can be decomposed into a translation component and a rotation component. In the former PIV image set, the sphere moved only along the horizontal direction in a uniform flow with a moving sphere velocity of u sphere = 3.0 pixels and a uniform flow velocity of u flow = 3.0 pixels. In the latter set, by contrast, the spherical body rotated on the spot at an angular velocity of v θ = 3.0 r/R pixels along with the rotational flow, which had the same angular velocity as the body. The sphere was chosen to examine the effects of the free surface curvature on the accuracy of the proposed PIV algorithms. The synthetic tracer particles were scattered at random positions with a uniform particle density of 0.05 ppp (particles per pixel). A total of 25.6 particles on average were placed in each interrogation window (w x × w y = 32 × 32 pixels2). As opposed to ideal synthetic PIV images, real PIV images are inherently subject to errors induced by numerous factors. The typical sources of the errors include the improper particle seeding, the linear and nonlinear camera response, the strong velocity gradients, the non-uniform illumination and the non-uniform reflection of tracing particles (Huang et al. 1997). In this regard, a background noise of 15.0 ± 5.0 % (out of a maximum intensity level of 255) was intentionally applied to the synthetic images in order to improve the analogy with real PIV images. The particle diameter was set to a diameter of 2.2 pixels, and the interface of the sphere had a thickness of 5.0 pixels with a random noise of 15.0 ± 5.0 % with the same intention mentioned above. The cross-sectional intensity profile of the sphere interface was set to have a one-dimensional Gaussian distribution. The two image mapping methods were systematically assessed by fixing the shooting distance and the texton size at L = 30 pixels and t s = 31 pixels, respectively, to act as control variables in both cases. The image sizes of the uniform and rotational flow were 1,024 × 512 pixels2 and 512 × 512 pixels2, respectively.

Figure 8 illustrates the comparison between the two aforementioned interpolation schemes. The two distinct interface profiles interpolated with respective interpolation methods in Fig. 8a suggested that under circumstances in which curved interfaces were present, the linear interpolation-based image transform resulted in distorted image regions. These distorted image regions prevented the transformed images from forming straightened interface profiles and caused skewed images (Fig. 8b). On the other hand, the cubic Hermite spline interpolation yielded a transformed image with a straightened interface that was amenable to the Cartesian grid-based interrogation window arrangement (Fig. 8c). The image distortion caused by the linear interpolation introduced erroneous velocity vectors into the PIV calculations due to the skewed image. It can be inferred that as the curvature increases, the image distortion worsens, causing the cross-correlation computation in PIV algorithms to be negatively influenced. In this regard, the curvature effect on the displacement calculation from PIV was examined by error analysis on the two sets of synthetic PIV images. The conducted error analysis has employed the definition of the bias and random errors described in Kim and Sung (2011). The bias error is defined as \(\beta = \bar{u} - u_{\text{exact}}\) where \(\,\bar{u}\,\) is the average measured displacement from PIV measurements, and u exact is the exact displacement which is a given value determined by us. The random error is defined as \(\,\sigma = \sqrt {\frac{1}{N}\sum\nolimits_{n = 1}^{N} {(u_{n} - \bar{u})^{2} } }\).

Fig. 8
figure 8

a Two interface profiles with different interpolation schemes. b Part of the transformed image with a linear interpolation, c or with a cubic Hermite spline interpolation

Figure 9 shows the error analysis results of the sphere moving in a uniform flow. The abscissa represents the curvature 1/R, and the ordinate corresponds to bias errors (β) and random errors (σ). The circle symbols indicate the errors of the free surface velocities (n = 0), and the triangle symbols indicate the fluid-only region velocities (n = w y). Whereas the cubic Hermite spline interpolation yielded reasonable level of bias errors within the given curvature range, the linear interpolation produced increasing bias errors of the horizontal velocities with curvature 1/R, which is in line with the results of Jean and Sung (2011). With the given window size (32 × 32 pixels2), the linearly interpolated images inevitably contained the interface which is not completely straightened. As a result, the linear interpolation scheme exhibited large amount of bias error for high-curvature interfaces due to the severely distorted interface images. The increasing bias errors on the linearly interpolated images were largely attributed to the increasing level of the interface distortion. In contrast to the stark difference in bias errors, two interpolation schemes did not exhibit a noticeable difference in random errors. Even though the random error level was larger in the direction of the flow and the sphere (horizontal direction), the overall level of random errors remained at reasonable levels. The negative bias errors of the vertical velocity produced indicated the underestimated displacements in the vertical direction. Furthermore, the rate of increasing bias errors was found to be higher in the horizontal direction than the vertical direction. From these results, it is clear that the cubic Hermite spline interpolation outperforms the linear interpolation when resolving the velocities of the liquid and the free surface that features large curvature.

Fig. 9
figure 9

Error analysis of the a horizontal and b vertical velocities under a uniform flow over a moving sphere

The same error analysis applied to the rotational flow over a rotating sphere is shown in Fig. 10. While the random error of both interpolation methods remained at comparatively low levels, the bias error of the linear interpolation was found to be relatively large compared to the error produced by the cubic spline interpolation. An increasing tendency in bias errors of the linear interpolation in both directions was ascribed to the distorted interface in the transformed image, which is in accordance with the results of the uniform flow. Moreover, there was no significant difference with respect to the random errors of the horizontal and vertical velocities, as in the case of the moving sphere. Unlike the moving sphere in a uniform flow, the rotational sphere in a rotational flow showed a similar tendency in both directions since the rotational motion was associated with both directions. A large amount of the bias and random errors from the linear interpolation scheme for large curvature 1/R suggested that the cubic spline interpolation scheme was more suitable for application to the image transform of the highly deformable free surfaces in which curvature 1/R is rather large. In conclusion, the cubic spline interpolation outperformed the linear interpolation method in terms of the bias error. The high levels of the bias error in the linear interpolation were attributed to the curved free surface (not completely straightened) in the transformed images. Regardless of the curvature, the both error levels of the cubic spline interpolation scheme remained at reasonable levels. These results suggested that the cubic spline mapping method was indispensable for obtaining accurate PIV measurement results of the free surface flow because the free surface usually has a large curvature value.

Fig. 10
figure 10

Error analysis of the a horizontal and b vertical velocities for a rotational flow over a rotating sphere

4.2 Sloshing experiments

The characterization of the sloshing phenomenon is of great significance in various engineering applications, including in fuel tank trucks and liquid cargo vessels. The utility and applicability of the present image preprocessing method for PIV measurements to model free surface flows were examined by studying externally induced sloshing in a rectangular container under steady-state conditions from a variety of perspectives. The four major factors that govern the sloshing dynamics are the forcing frequency, the excitation amplitude, the tank shape, and the liquid fill ratio. Depending on the factors, sloshing flows are categorized into four wave systems: standing waves, progressive non-breaking waves, progressive breaking waves, and hydraulic jumps (Faltinsen and Timokha 2009). As described in 3.1, the proposed free surface detection method is based on an iterative prediction and correction scheme. This method predicts each free surface point based on the previously detected free surface point and corrects it with iterative position/inclined angle/meniscus correction steps. In contrast to the intensity-based detection methods that process all the pixels, the present method is more robust and requires less computing time since the pixels neighboring the free surface are only applied to the computation as discussed earlier. However, the iterative prediction and correction-based method have inherent limitations that it cannot be applied to violent free surface flows (e.g., breaking waves) since the free surface profile of such flows may entrain foams, whitecaps, or singularity points at which two distinct inclined angles exist. Consequently, the proposed free detection method may not be suitable to accurately identify the free surface in such violent free surface flows. Nevertheless, the present free surface detection method can locate the free surface position of numerous non-breaking free surface flows (standing waves and progressive non-breaking waves in sloshing flows). Figure 11 shows a close-up image of sloshing flows without violent waves. The circle symbols represent the free surface points discretely determined by the free surface detection using multiple textons. After the water–air interface detection, the whole interface profile was constructed with cubic Hermite spline interpolation scheme as indicated with dashed lines in Fig. 11. As discussed in the previous section with Fig. 8, it should be noted that the cubic Hermite spline interpolation is effective in tracking the free surface that is characterized with larger curvature compared to the shooting distance. However, the sloshing flows with violent breaking waves and hydraulic jumps cannot be resolved with the present method since the free surface of such systems entrains foam, whitecaps, or singularity points. Thus, the sloshing parameters were carefully chosen to produce applicable sloshing flows.

Fig. 11
figure 11

A close-up PIV image of a free surface

Three sets of liquid sloshing images with different forcing frequencies (f = 0.93, 1.88, and 2.31 Hz) were evaluated holding other factors fixed. The amplitude of the excitation was X 0 = 5 mm, the liquid-filled ratio was h l/H = 0.4, and the sloshing tank was rectangular. The natural frequency of two-dimensional sloshing in a rectangular tank was studied using the linear theory by Wu et al. (1998) and Faltinsen (1978) as \(\,\omega_{n} = \,\sqrt {g(2n + 1)\pi \tanh \left[ {(2n + 1)\pi h_{l} /L} \right]/L} .\) The equation indicates that the lowest natural frequency ω 0 is 7.24 rad/s (f = 1.15 Hz) and the second lowest natural frequency ω 1 is 13.59 rad/s (f = 2.16 Hz). The frequencies examined here were selected to observe a standing wave-like free surface profile. The free surface profile obtained using the three forcing frequencies assumed standing wave-like patterns: the first harmonic standing wave with free ends (Fig. 12a), the second harmonic standing wave with fixed ends (Fig. 12b), and the third harmonic standing wave with free ends (Fig. 12c). The proposed method for detecting the free surfaces using multiple textons accurately located the liquid–air interface, regardless of the meniscus thickness, and eliminated undesirable reflections at the meniscus by shifting the free surface location to the liquid region by a distance equal to half the meniscus thickness. The maximum and minimum free surface locations and their profiles were successfully obtained using the presented free surface detection method, as shown in Fig. 12. Unlike other experimental measurement techniques mentioned earlier, the free surface detection method proposed here was capable of identifying the entire free surface profile using the free surface elevation data measured at any point of interest. The spatiotemporal information about the free surface alone is essential for characterizing the sloshing dynamics. Most preceding experimental studies that examined sloshing dynamics have used a sensing device to determine the tank position in the absolute coordinates. The present study, however, used an inexpensive laser pointer to form a reference point. The reference tracking procedure was accomplished by a single texton-based image processing method. In order to track the reference point in real PIV images, we produced a binary image pattern of a white-colored circle as a texton. The reference point was readily positioned by locating the position with the maximum value of the cross-correlation between the texton and subsections of the real PIV images. The free surface detection method and the tank position tracking were used to obtain the time-dependent free surface elevation near the tank wall with respect to the tank oscillation, as shown in Fig. 13. The line with empty symbols indicates the tank oscillation (tank motion to the right was associated with the positive direction), and the line with filled symbols indicates the free surface elevation at a near-wall position. The free surface elevation under steady-state conditions was characterized as a sinusoidal pattern, as was the sloshing tank motion. As shown in Fig. 13a–c, the free surface near the node positions fluctuated with an amplitude that was far larger than the forcing amplitude X 0 = 5 mm under near-natural frequencies.

Fig. 12
figure 12

Free surface profiles obtained using three different forcing frequencies of a 0.93 Hz, b 1.88 Hz, c 2.31 Hz

Fig. 13
figure 13

Free surface elevation at a near-wall position (10 mm from the right wall) under three different forcing frequencies: a 0.93 Hz, b 1.88 Hz, c 2.31 Hz

Once the free surface location had been detected, the three sets of sloshing images were transformed into images with a straightened free surface with the help of the cubic spline mapping method. The modified PIV/IG was applied to the transformed images to calculate the vertical and horizontal velocities of the free surface along with the liquid underneath it, as shown in Fig. 14. Unlike the previous PIV measurements of free surface flows, the proposed method is capable of directly resolving the free surface velocity in both horizontal and vertical directions. Figure 15 shows the vertical and horizontal velocity fluctuations near the tank wall. The line with empty symbols indicates the horizontal velocities, and the line with filled symbols indicates the vertical velocities. As with the free surface elevations, the horizontal and vertical velocities fluctuated in an oscillating pattern. It should be noted that as the forcing frequency increased, the horizontal velocities appeared to increase at nodes while the velocities near the antinodes were nearly zero, as shown in Fig. 15b.

Fig. 14
figure 14

Velocity profiles of sloshing flows with three different forcing frequencies: a 0.93 Hz, b 1.88 Hz, c 2.31 Hz

Fig. 15
figure 15

Vertical and horizontal velocity fluctuations at a near-wall position (10 mm from the right wall) under three different forcing frequencies: a 0.93 Hz, b 1.88 Hz, c 2.31 Hz

5 Conclusions

An image preprocessing method for PIV measurements of flow around an arbitrarily moving free surface was devised in the present study. The proposed method is capable of directly resolving the velocity profiles of the free surface along with the liquid underneath it. The image preprocessing consists of the free surface detection and the image transform. The difficulties associated with identifying the free surface were addressed by applying a novel free surface detection scheme using multiple textons. The original PIV images with curvilinear free surfaces were then transformed using the cubic Hermite spline interpolation scheme into newly constructed images with straightened free surfaces. Consequently, the transformed PIV images were suitable to PIV measurements with a structured interrogation window arrangement in a Cartesian grid. The velocities of the fluid-only region were measured by applying a standard PIV method. These images were then used to resolve the velocity field of the free surface using PIV/IG. The entire velocity field in the original PIV images at and near the free surface was resolved by combining the inverse-transformed velocities of the free surface and the fluid-only region. The validity of the proposed interpolation scheme was verified with two sets of numerically produced synthetic images: a moving sphere in a uniform flow and a rotating sphere in a rotational flow. Each set of synthetic PIV images was produced to simulate the translational and rotational motions of the free surface, respectively. These images were analyzed quantitatively with respect to the bias and random errors. The error analysis results revealed that the cubic Hermite interpolation scheme should be adopted, especially to investigate free surface flows in which the water–air interface is highly deformable with large curvature. The method developed here was applied to sloshing flows, as an example of the free surface flows, to verify the applicability and utility of the method. It was confirmed that the proposed free surface detection method is suitable to track the free surface, which has varying intensity profiles, using multiple textons. In addition to the free surface elevation, the horizontal and vertical velocity profiles of the free surface along with the liquid underneath it were directly measured using the proposed method.