Comparison of interpolation techniques for 2D and 3D velocimetry Laurent DAVID, Aurélie ESNAULT, Damien CALLUAUD Laboratoire d’Etudes Aérodynamiques SP2MI, Téléport 2, Boulevard Marie et Pierre Curie 86960 Futuroscope cedex, France; Laurent.David@univ-poitiers.fr Abstract Some difficulties appear when the researcher want to compare some information located in different positions and calculated by several measurements techniques. Even so to simplify the algorithms for 3D PIV measurements, the choice to calculate velocity vectors on specific location from classic 2D PIV vector fields is often prefered than to determine directly velocity vectors on an unstructured grid mesh. As it could introduce some errors, data interpolation seems then necessary. This preliminary work consists to assess four interpolation methods : the bicubic and the thin shell splines, a least squares technique and a weighting function in relation with the distance between the vectors. Irregularly and regularly spaced data have been used for the interpolation. Different vector selection are compared and the influence of this step is estimated on 2D and 3D PIV measurements (figure1). Figure 1 : Scatterplot and probability function for an instantaneous velocity vector field and an interpolated field. Introduction During measurements in the flows, the interpolation techniques to evaluate velocity vectors in specific locations are often employed. On the one hand, these techniques can be used via random vector distributions to calculate velocity vectors on a regular grid. Scalars characterizing the flows are then deduced and the velocity vectors resulting from measurement techniques like PIV, PTV or PSV can be compared at the same locations. On the other hand, the interpolation techniques are also used, via regularly distributed velocity vectors, to determine velocities on an irregular grid. For 3D PIV measurements, these points result from projecting a regular grid of the object reference in the image references. Some authors compared methods to interpolate random distributed vectors on nodes of a regular mesh. Robinson and Rockwell (1993), Spedding and Rignot (1993) carried out comparisons between the techniques Adaptative Gauss Window and Spline Thin Shell onto theoretical and experimental velocity fields. Imaichi and Ohmi (1983), David and Texier (1995) also studied these interpolation effects with the methods of least squares, of weighting according to the distances and by Krigging from random velocity fields. In order to determine the most suitable algorithms to carry out interpolations on a regular grid or on an unstructured grid, a comparative and systematic study between four interpolation techniques (Spline Thin Shell, weighting by the square of the distance, minimization by least squares, Bicubic Spline) is presented in this paper. Using a Columnar vortex, 2D simulated and 3D simulated and projected by real matrices of projection obtained during measurements by 3D-PIV, the interpolation effects of the velocity fields are assessed. In particular, the selection of the points used for the interpolation, the capacity to respect, as far as possible, the instantaneous or mean values of the velocity vectors, the faithful restitution of the velocity gradients are elements particularly highlighted. Interpolation Techniques Four interpolation techniques are compared; they are all well defined in the literature and we present for each only the main characteristics. • The inverse distance weighting methods (called here AGW) This method consists in calculating velocity vector for a location by summing vectors of the selected points origin, weighted by a function W, specific to each point origin. The function W is related to the distance between the points origin (with the number of N) and the point of the interpolation Agui and Jimenez(1987). One can thus write the estimator in the following way : k=N Um = ∑ wk ( x, k =1 k=N y ).U k (1) ∑ wk ( x, y) k =1 The function W can take various expressions. In the case of the interpolation weighted by the inverse of the distances, the function W is written : wk=dk-2, with the distance d k = ( xm − xk ) 2 + ( ym − yk ) 2 and k=N ∑ wk = 1. k =1 In the case of the interpolation by Gaussian window (Adaptive Window Gauss), W takes the − dk 2 σ2 (σ being the width of the window of selection). The first of these two expressions has been form wk ( x, y ) = e computed in this comparison. • The Thin Shell Spline (noticed STS) The principle of the method rests on the search of N functions G and N coefficients λ such that the required velocity value Um could be calculated in a location (x,y) by U m ( x, y ) = k=N ∑ λk Gk ( x, y ) (2) k =1 The problem consists to find functions G suitable. It was proven that a class of named Thin-Shell Splines function minimized a global function proportionnal to the Laplacian of the velocity fields. The following Um function satisfied this condition : U m (t ) = k=N ∑ λk Gk ( M k , M ) + α1x + α 2 y + β k =1 (3) with k=N ∑ λk k=N ∑ λk M k = 0 and M(x,y), Mk(xk,yk), and Gk(Mk,M)=|dk2|log|dk2| =0, k =1 (4) k =1 L.Paihua Montès (1978) studied the resolution of the system which rises from this formulation and calculated the first derivative in the following way: k=N ∂vi = α1 + 2 ∑ λ2, k d k , x log d k 2 + 1 (5) ∂x k =1 { ( )} { ( )} k=N ∂ui = α 2 + 2 ∑ λ1, k d k , y log d k 2 + 1 ∂x k =1 (6) It is noticed that the interest of this method holds in the fact that calculation of interpolation takes into account the velocity derivative. • The least squares minimization (noticed MC in the paper) The method of interpolation by least Squares is based on a development of Taylor carried out in an origin point starting from the sought value in a location. To determine the Um velocity in a point M, Imaichi and Ohmi (1983) wrote the development in a point K where the velocity components are known: ∂U m ∂U m Uk = Um + ( xk − x m ) + ( yk − ym ) (7) ∂x ∂y (The same development is applied for V) . Then, Um and Vm are estimated such as the quantities S and T are minimal: S= k=N ∑ [U k − U m − k =1 T= k=N (8) ∂V ∂Vm ( xk − xm ) − m ( y k − y m )]2 ∂y ∂x (9) ∑ [Vk − UVm − k =1 • ∂U m ∂U m ( xk − xm ) − ( yk − ym )]2 ∂y ∂x The Bicubic Spline (noticed BC) The Bicubic Spline interpolation (from Numerical Recipes in C) is carried out by two successive interpolations according to direction X then Y. The velocity vectors are defined in nodes of a Cartesian grid Ui = U(xi), for i=1 to N and each value U in x location is computed by the following formulation according to a direction X then Y : U = AU j + BU j +1 + CU ' ' j + DU ' ' j +1 (10) x j +1 − x x − xj , C = 1 ( A3 − A ) ( x j +1 − x j ) 2 and D = 1 ( B 3 − B ) ( x j +1 − x j ) 2 6 6 If the expression (10) is derivated, we obtain the expression of U’i: with A = x j +1 − x j ,B = x j +1 − x j dU U j +1 − U j 3 A2 − 1 3 B2 − 1 ( x j +1 − x j )U ' ' j + = − ( x j +1 − x j )U ' ' j +1 6 dx x j +1 − x j 6 and the second derivative : U ' ' = AU ' ' j + BU ' ' j +1 (11) (12) (13) Now to evaluate the second derivative supposing known, the fundamental idea of the Bicubic Spline second interpolation is to seek there such as the first derivative is continuous. This imposes that the equation (12) has the same value in xj and xj+1 what after arrangement gives: x j − x j −1 6 U " j −1 + x j +1 − x j −1 3 U '' j + x j +1 − x j 6 U ' ' j +1 = U j +1 − U j x j +1 − x j − U j − U j −1 x j − x j −1 (14) It’s a system of N-2 equations and by using two boundary conditions (y ’’1 or y’’N or the two, equal ones to zero or y’’1 and y’’N calculated from (12) by imposing the boundary conditions with the first derived ), the N unknown U can then be calculated. Principle of the comparison In order to suppress the uncertainties of experimental data, a Columnar vortex is simulated Robinson and Rockwell (1993). This swirl has a tangential velocity component vt = ( ) Γ 1 − exp − r Vs * Rs * r Rs 2 (15) and a vertical velocity component, r 2 V0 − exp − v= Rs Vs (16) with the parameters : Γ : circulation, Vs : velocity, Rs : vortex radius, V0 : vertical external velocity. To study the influence of the interpolation step of vectors from a random distribution onto a regular grid, three 2D vortices (without vertical velocity) are calculated (figure2 - table1) with different sizes and amplitudes, randomly and repetitively, to obtain 100 fields of velocity vectors. Then they are interpolated on nodes of a regular grid by different interpolation methods : minimization by least squares (noted MC), weighting close to the Adaptative Gauss Window (AGW) and an approximation by a Spline (Spline Thin Shell). In the same way, to evaluate the influence of the interpolation step in a data processing sequence by 3D-PIV, three 3D vortices (Table 1) are simulated and projected to the nodes of a regular grid mesh in two image references (right-hand side and left) using projection parameters resulting from an in-situ calibration Calluaud and David (2002). These regular fields of velocity vectors are interpolated onto an unstructured mesh and are combined by backward projection in the object reference (figure 3). Thus the influence of the preceding interpolation techniques and the influence of approximation by Bicubic Spline are evaluated as a whole in the data processing sequence. 0.3 e m ro n 0.2 0 0.1 2 m) m ( X 4 0 6 0 2 8 4 6 8 Y (mm) 10 10 Figure 2 : Velocity vector magnitude (mm/s ) for the three simulated vortices. Vortex V0 RS VS Γ 2D reference 0 2 5 5 2D plain 0 4 5 5 2D tip 0 2 5 10 3D reference 15 12 10 30 000 Table1 : Parameters for the simulated vortex 3D plain 15 18 10 30 000 3D tip 30 12 10 30 000 Three modes of vector selection were compared: the four or eight closest vectors or a minimum of one vector per quadrant. The interpolated velocity fields are compared using the calculation of the difference of the Euclidian norm between the real and simulated velocity on the complete field. The relative errors on a velocity profile passing by the center of the vortex is determined too and some random velocity vector fields are examined in details to understand the errors on some vectors and the behavior near the vortex center. MG MD INTERPOLATION INTERPOLATION M-1G M-1D Figure 3 : Schematic representation of the steps to estimate the influence of the interpolation on 3D PIV measurements with the backward projection. Results Three aspects are observed closely in the results : - the best point selection according to the interpolation techniques; - the faithful restitution of the instantaneous velocity fields, - the influence of the starting distribution of the vectors on the interpolation techniques. At first, the optimum modes of selections of the points for each interpolation type were given starting from the random fields of vectors and the fields uniformly distributed. The methods splines, in general, require a homogeneous distribution of the vectors without hole of information. The approximation by STS is correctly conditioned when the data are not aligned and that the first three points forms an equilateral triangle. The choice of the four closest points remains the mode of the selection most favourable to this method. The method Bicubic Spline, only tested from a regular grid mesh, takes account of all the points to determine the second derivative employed by the approximation. For the method by weighting or of quadratic minimization, the number of points and their locations strongly influence the accuracy of the method. If the criteria of reproducibility is preferable, the choice of the four or the height closest points is better for technique AGW whereas for the method of least squares the height closest points give the most satisfactory results. If we seek to reduce the average error obtained from 100 velocity fields, the choice of the four closest points is essential in the areas of strong velocity gradients (figure 4). If the center of the swirl is examined, the two methods behave in the same way i.e the height points closest then a vector by quadrant. 1,0 0,8 0,6 0,4 0,2 0,0 -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 R el at iv e er ro r AGWP4ermoyU AGWP4ermaxU AGWP4erminU 4 nearest points R e l a t i v e e r r o -2 0 2 4 6 8 10 12 14 16 1,0 0,8 0,6 0,4 0,2 0,0 -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 AGWP8ermoyU AGWP8ermaxU AGWP8erminU 8 nearest points -2 0 2 4 R el at iv e er ro r MCP4ermoyU MCP4ermaxU MCP4erminU 4 nearest vectors -2 0 2 R el at iv e er ro r 4 6 8 8 10 12 14 16 AGWQ4erminU 1 vector by quadra nt -2 0 2 4 Distance to the origin Distance to the origin 1,0 0,8 0,6 0,4 0,2 0,0 -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 6 AGWQ4ermoyU AGWQ4ermaxU 1,0 0,8 0,6 Rel 0,4 ativ e 0,2 erro 0,0 r -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 10 12 Distance to the origin 14 16 1,0 0,8 0,6 8 nearest points 0,4 0,2 0,0 -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 -2 0 2 MCP8ermoyU MCP8ermaxU MCP8erminU 4 6 8 10 Distance to the origin 6 8 10 12 14 16 Distance to th e origi n 12 14 16 1,0 0,8 0,6 Rel 0,4 ativ e 0,2 err 0,0 or -0,2 -0,4 -0,6 -0,8 -1,0 -1,2 -1,4 -1,6 -1,8 -2,0 MCQ4ermoyU MCQ4ermaxU MCQ4erminU 1 vector by quadrant -2 0 2 4 6 8 10 12 14 16 Distance to the origin Figure 4 : Velocity profiles for the U component and the three modes of vector selections (reference vortex). For the study of the three two-dimensional swirls, we have conserved every mode of selection but we comment only the best mode of points selection for each technique. The norms of velocity amplitude difference show that, from random velocity fields, the method by least squares gives the best results and the more reproductible. In regard to the velocity profiles taken on a diagonal, it seems similar in zones of low gradient since the method AGW better represents the areas of strong velocity gradients. In this place, the minimization by least square tends to smooth the vectors and the velocity field is then underestimated. Near the vortex center, the least square method gives in appearance better results than with the AGW weighting function. The location of the center is correctly positioned. Technique STS does not appear regular enough to be used without a validation by filtering. In general, the results are very accurate but for some points this spline introduces too significant errors (> 200%). Reference vortex Tip vortex Plain vortex Figure 5 : Norm of the velocity amplitude difference for the three 2D vortices. For the study of the three-dimensional vortices, some behavior modifications appeared during vector interpolation from a regular grid onto an unstructured grid mesh. First, because the origin points are better conditioned than those calculated, the methods Spline (Bicubic or STS) give very good results on the values of the velocity difference norm and the relative errors. This is bound, in particular, to the fact that these methods take into account the first or second derivatives and that the latter are correctly estimated on this type of grid. Methods AGW and MC, though, give satisfactory results with nevertheless some differences according to the components (figure 6). The AGW weighting function introduces between 5 to 10% of errors like for the interpolation on the 2D cases. On the other hand, the other techniques seem to be improved. To check that these results are not related to a smoothing during of the passage in the stereoscopic method of backward projection, complementary calculations were carried out from a regular grid onto a unstructured grid mesh. The obtained results confirm the improvement of the accuracy on the vectors interpolated from a regular vector distribution. Referenc e v ortex Norm W Referenc e v ortex N o r m m m / s N or m m m /s 7.5 7.0 6.5 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 6.0 Norm U 5.5 N o r m 5.0 4.5 4.0 3.5 m m / s 3.0 2.5 2.0 1.5 1.0 0.5 AGW P8 BS MC P8 STS P4 N n or m Norm V 8.0 7.5 7.0 6.5 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0.0 M m /s AGW P8 BS MC P8 STS P4 AGW P8 BS 13 12 11 10 9 8 7 6 5 4 3 2 1 0 MC P8 STS P4 Norm U+V+W AGW P8 BS MC P8 STS P4 Figure 6 : Norm of the difference for the 3 components and the amplitude of the velocity from a regular grid mesh to a unstructured grid mesh . Other tests have been made with the bicubic spline interpolation. The introduction of errors (10, 20, 30%) on one or two modules of the velocity vectors for just one of the vectors fields (left or right velocity projection) used for the reconstruction by backward projection, makes it possible to highlight the propagation of this error (figure 7) on the calculation. The velocity errors appear clearly around the place where the vector has been changed and the norm of the relative error reveal some privilegated direction of the error. Conclusion In conclusion, the interpolation techniques are to be employed with prudence. Since a random distribution, the methods involving minimization by least squares and AGW give reliable results respectively for low and strong velocity gradients. For interpolations using vectors distributed regularly on a structured grid mesh, the Spline methods and in second the approximation by least squares seems to be more accurate for the calculation of the third component. The improvement results mainly to the fact that those techniques give better estimations from structured grid mesh and not to the employment of the backward projection However these results on simulated fields are to be tempered on realistic velocity vectors resulting from experiments and sullied with spurious vectors. An other aspect showed in the figure 1 is the scatter plot and the histogram of the displacement of the vector for the component U. The interpolated vectors from a regular grid mesh have a representation modified after the calculation and it is clear that these variations should have some influence for the determination of the 3D vectors. References J.C. Agui, J. Jimenez, 1987 : On the performance of particle tracking, Journal of Fluid Mechanics, vol 185, 447468. D. Calluaud, L. David, 2002 : Backward projection algorithm and stereoscopic particle image velocimetry measurements of the flow around a square section cylinder. 11th International Symposium on Applications of Laser Techniques to Fluid Mechanic, Lisbon. L. David, A. Texier, 1995 : Influence des techniques d’interpolation sur la précision des champs des vitesses instantanées caractérisant un écoulement. 6ième Congrès de Visualisation et de Traitement d’images en mécanique des fluides, St-Etienne (France). K. Imaichi, K. Ohmi. 1983 : Numerical processing of flow visualization pictures. Measurement of two dimensional vortex flow. Journal of Fluid Mechanics, vol 86, 283-311. WH. Press, SA. Teukolsky, WT. Vetterling, BP. Flannery, 1995 : Numerical Recipes in C, Cambridge Press University. L. Paihuas Montès, 1978 : Quelques méthodes numériques pour le calcul des fonctions splines à une ou plusieurs variables. Thèse de Doctorat de l’Institut Polytechnique de Grenoble. O. Robinson, D Rockwell, 1993 : Construction of 3D images of flow structures via particule tracking techniques. Experiments in Fluids 14, 257-270. G.R. Spedding, E.J.M. Rignot, 1993 : Performance analysis and application of grid interpolation techniques for fluid flows. Experiments in Fluids 15, 417-430. Figure 7 : Bicubic Spline Interpolation without and with introduction of magnitude errors in one of the image references, Reconstructed 3D velocity fields for these two interpolations in the object reference.