A fast algorithm for free-surface particles detection in ...

18 downloads 1706 Views 12MB Size Report
is quite difficult to implement, especially in its extension to ... inside and outside the fluid domain. .... Top: free-surface detection of an elliptic fluid domain. Bottom: ...
A fast algorithm for free-surface particles detection in 2D and 3D SPH methods Marrone S., Colagrossi A.

Le Touz´e D.

Graziani G.

INSEAN, The Italian Ship Model Basin Rome, Italy [email protected]

Fluid Mechanics Laboratory Ecole Centrale Nantes/CNRS Nantes, France [email protected]

Department of Mechanics and Aeronautics University La Sapienza Rome, Italy [email protected]

Abstract—The present paper aims at proposing a fast algorithm permitting to detect the free-surface in particle simulations, and next to define a level-set function on a cartesian grid. The latter allows for analyzing in detail the free surface shape of three-dimensional simulations as well as internal features of the flow, by using standard visualization tools. The algorithms proposed for detecting the free-surface particles are described in both two and three dimensions, and are validated on simple and complex flow simulations. Then, the derivation of the level-set function is detailed and the usefulness of the proposed method to post-process and analyze complex flows are illustrated on realistic 2D and 3D examples.

I. I NTRODUCTION In recent years the SPH method has been successfully applied to problems involving free-surface flows with fragmentation. In order to analyze flows with complex free surface patterns (fragmentations, air entrapment, etc.) and to face a larger range of problems it is useful to know which particles belong to the free surface. The detection of the free surface, indeed, allows giving suitable boundary conditions along it (surface tension, isothermal condition, etc) and, consequently, to deal with different physical phenomena and flow behaviors. Dilts [1] developed an algorithm for the free-surface tracking that can detect free-surface particles in a robust and reliable way and is applicable to any meshless method. However it is quite difficult to implement, especially in its extension to three-dimensional simulations [2]. In this work a novel algorithm for the free-surface detection is presented. Such a scheme, based on the properties of the SPH kernel, is easy to implement both in two and three dimensions, and computationally cheap (CPU time required is an order of magnitude lower than particle interaction calculation). The accuracy of the method is comparable to the method proposed by Dilts; it is possible, indeed, to catch small cavities of radius up to h (h being the smoothing length) and fluid elements with dimension even smaller than h (like jets and drops). Thanks to these valuable features the proposed algorithm can be used at each time-step of the simulations, without an appreciable increase of the CPU-time, and allows enforcing specific boundary conditions along the free surface.

Moreover, the free-surface detection permits to strongly improve the post-processing phase, particularly of threedimensional simulations with complex flow features. In fact, if one uses merely a SPH output, flow analysis is problematic since data are known on scattered points, and it is difficult to obtain contour plots, slices and iso-surfaces. Such an analysis could be performed in a straightforward way if data were interpolated on a regular grid. This operation can be carried out with a Moving-Least Square (MLS) interpolator that can exactly interpolate a linear field on a regular grid from scattered points. However, in the presence of a free surface, it is a bit more complicated since the interpolation will lead to extrapolated values on nodes out of the fluid domain, at least as far as a distance O(h) from the free surface. In such cases, if particles of the free surface are known, it is possible to define a distance function among the grid nodes from the free surface and, in this way, to distinguish between nodes inside and outside the fluid domain. Such an interpolation of field values on a regular grid can be also useful to introduce a “remeshing” technique. In fact, a noisy particle distribution associated with the fluid evolution leads to large inaccuracies [4]. This problem can be overcome by a periodic resetting of the particle positions onto a regularized set of nodes. In the present paper the algorithm for free-surface detection is described and validated in sections 2 and 3, for both twoand three-dimensional cases. To assess the accuracy of the algorithm the validation has first been performed using simple geometries, and then on complex flow cases. Finally, in section 4, the procedure for the interpolation on a regular grid is described and post-processing results are shown to illustrate the proposed algorithm capabilities. II. 2D

ALGORITHM

A. Algorithm details The algorithm is composed of two steps: in the first one the properties of the renormalization matrix, defined by Randles and Libersky [6], are used to find particles next to the free surface. This first step strongly decreases the number of particles that will be processed in the second step. In the second step the algorithm, by means of geometric properties,

4th international SPHERIC workshop

Nantes, France, May, 27-29 2009

detects particles that actually belong to the free surface and their local normals. In order to validate it, the algorithm was applied to simple geometric cases and to a dam break case (see e.g. [1]) of very complex free surface behavior displayed in figure 1. In this figure the rectangles plotted delimit the zones which are enlarged in figure 2 to highlight the flow complexity there, and which are the most challenging for the detection algorithm. The method used to carry the first step of the algorithm was proposed by Doring [7]; it exploits eigenvalues of the renormalization matrix [6] defined as: −1 X (1) ∇Wj (xi ) ⊗ (xj − xi ) dVj B(xi ) =

belonging to the last subset are characterized by intermediate values of λ. We have that N = E ∪ I ∪ B. The free surface particles subset F is thus composed of all the particles of subset E and a part of the particles of subset B.

λ I B E

0.75 0.20

j

y/H

|u|/(gH)

½

t(g/H) = 6.001

½

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

1.5

λ

1

I B E

0.5

0 0

1

2

y/H

3

|u|/(gH)

½

t(g/H) = 9.413

4

5

x/H

0.75 0.20

2h

½

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

1.5

1

0.5

0

0

1

2

y/H

3

|u|/(gH)

½

t(g/H) = 10.275

4

5

x/H

½

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

1.5

Fig. 2. Values of the minimum eigenvalue λ of the renormalization matrix B. Red particles belong to subset E; green particles belong to subset I; blue particles belong to subset B.

1

0.5

0 0

1

2

3

4

5

x/H

Fig. 1. Different time instants of an impact flow after a dam-break simulation, see e.g. [1]. The red rectangles delimit the zones enlarged in figure 2.

Doring showed that if the value of the minimum eigenvalue λ of the renormalization matrix is greater than a proper threshold the particle does not belong to the free surface. Let us define N as the set of all the fluid particles and F ⊂ N as the subset of particles belonging to the free surface. Then, computing λ for each particle, it is possible to further define three complementary subsets: E composed by particles belonging to thin jets and drops, characterized by low values of λ; I composed by interior particles far from the free surface, characterized by high values of λ; and B composed by particles which are close to the free surface or are in regions of the domain where particles are not uniformly spread. Particles

Several tests have been performed to set the proper thresholds for λ with the renormalized gaussian kernel shape used in the present work, see [1]. Being i the particle under examination, the values found are the following:  λ ≤ 0.20  i ∈ E ⇐⇒ i ∈ B ⇐⇒ 0.20 < λ ≤ 0.75 (2)  i ∈ I ⇐⇒ 0.75 < λ

These results are valid for a kernel support radius equal to 3h and an average number of neighbors equal to 50 in two dimensions. In this way the first step of the algorithm computes the minimum eigenvalue for each particle and gives a first rough detection of the free surface. This operation has a very low computational cost especially if the renormalization matrix is already computed in the SPH scheme, as e.g. in the formulation proposed in [6]. In figures 2 one can observe the result of this first detection. Particles next to the free surface and near cavities are correctly detected but it is also the case of some particles of internal fluid regions characterized by much

4th international SPHERIC workshop

particle disorder. Conversely, particles which belong to drops and thin jets are easily captured by the lower threshold and directly identified as free-surface particles (red ones). In the second step of the algorithm a more precise and reliable control is performed on particles belonging to B in order to complete the free surface detection. The proposed method is based on the fact that inside the fluid domain the sum of the kernel gradient over neighbors is very close to 0. When a particle, instead, is near the free surface, such sum is a good approximation of the local normal to the free surface, see [6]. Since the accuracy of the evaluation of this vector depends on particle disorder, it is possible to get a more accurate evaluation by using again the renormalization matrix: X ν(xi ) ∇Wj (xi ) dVj ; n(xi ) = ν(xi ) = −B(xi ) |ν(x i )| j (3) Once the vector n is known, it is possible to define a region of the domain like the one sketched in figure 3. The algorithm then checks whether or not at least one neighbor particle lies in this region, hereinafter referred to as scan region. If no neighbor is found inside it, the candidate particle belongs to the free surface.

Nantes, France, May, 27-29 2009

N o particles ε

10 2.16

20 40 1.23 0.68 TABLE I

80 0.34

120 0.23

200 0.13

AVERAGE RELATIVE ANGLE ERROR BETWEEN THE ANALYTICALLY COMPUTED NORMALS AND THE ONE EVALUATED BY FORMULA 3. N o PARTICLES DENOTES THE NUMBER OF PARTICLES WHICH FORM THE SEMIMAJOR AXIS )

a diameter less than 2h, so that particles inside it are deeply interacting and it is not a true cavity. Therefore we are tracking through this process the free surface of cavities of diameter greater than 2h. One can note that for some particle distributions, e.g. for thin jets, the sum of the kernel gradient can go to zero, giving wrong values for vector n. However, in this circumstance the eigenvalue λ will be very low and the particle will hence have already been detected as a free-surface particle in the first step of the algorithm. This first step has thus two functions: it is an efficient selection allowing to quickly perform the second step, and a tool to detect particles belonging to jets and drops which could hardly be detected by the second step of the algorithm. B. Validation

In the top part of figure 4 the algorithm is validated on the case of an elliptic fluid domain, of 0.661 eccentricity. Since the evaluation of the free-surface normals is critical for the algorithm effectiveness, the ones calculated by the algorithm are compared to the analytical ones. This comparison is reported in table II-B in terms of average relative angle error. In the bottom part of figure 4 an elliptic cavity of minor axis equal to 2h was introduced in the ellipse. This cavity has thus the minimum dimension which the algorithm is able to detect. After this simple test, the algorithm is further assessed Fig. 3. Sketch of the regions used in the algorithm. on the complex flow situations presented in figure 2. The This control is carried out by the algorithm in the following free-surface particles detected by the algorithm are plotted in way. We denote by i ∈ B the particle that is under examination pink in figure 5. Despite the geometrical complexity of these and by j ∈ N the neighbor of i which is included in a 3h radius configurations, the proposed method is able to provide a very distance. We define also the point T at distance h from i in good qualitative estimation of the particles which form the the normal direction and the unit vector τ perpendicular to n. boundary. One can in particular observe that approximately The conditions to assess whether particle i belongs to the free circular cavities of diameter little greater than 2h are well detected. surface or not are therefore:  i h √ Even though the algorithm requires a cycle on the neighbors  /F   ∀j ∈ N h |xji | ≥ 2h, |xjT | ≤ h ⇒ i ∈ for each particle involved in the second step, it has still a very i √ ∀j ∈ N |xji | < 2h, |n · xjT | + |τ · xjT | ≤ h ⇒ i ∈ / F low computational cost. Actually, all but a few percents of the    particles are filtered out in the first step. otherwise i∈F The CPU time cost of the algorithm is lower than 5% of (4) where notation Aij = Ai − Aj is used. If the first condition the total cost of a standard SPH calculation, assuming that the is true it means that the neighbor under examination is in the neighbor list has already been stored before the free-surface dark grey region in figure 3 while, if the second condition is detection. It is the computation of the renormalization matrix true, it means that the neighbor is in the pearl grey region. which takes the most part of the CPU time required by the algorithm (about 90%). Hence, if the renormalization matrix The two regions together form the scan region. If any neighbor is located in the scan region it means that is already evaluated in the numerical scheme, see e.g. [8] and there is no cavity in the normal direction, or that this cavity has [6], the CPU time increase due to the free-surface detection

4th international SPHERIC workshop

Nantes, France, May, 27-29 2009

I B E F

λ 0.75 0.20

2h

λ Fig. 4. Top: free-surface detection of an elliptic fluid domain. Bottom: freesurface detection in an elliptic cavity of minor axis equal to 2h. Red particles are those detected by the proposed free-surface algorithm.

2h

I B E F

0.75 0.20

is absolutely negligible. As well, if the algorithm is used only for visualization or analysis purposes, it has to be applied only periodically (typically every 100 time steps), and its cost becomes again negligible. III. 3D

ALGORITHM

A. Algorithm details The extension of the algorithm to the third dimension is rather straightforward and easy to implement. The algorithm has still the same structure as the two-dimensional one: it is composed of a first step where particles far from the free surface are filtered out, and of a second step to refine the detection to the only particles belonging to the free surface. In the first step the minimum eigenvalue λ of the renormalization matrix is again needed for each particle. Again, two thresholds are used which are the same as in two dimensions. These thresholds are valid for the renormalized gaussian kernel with support radius equal to 3h and average number of neighbors equal to 266. While the first step is formally unchanged in the extension to three dimensions, the second step is slightly modified. The vector n is still evaluated with equation 3 but the conditions which define the region to scan become:

Fig. 5. Results after the application of the free-surface detection algorithm: free-surface particles are displayed in pink with their normals; in the bottom part small cavities of 2h diameter are shown.

B. Validation

In the three-dimensional case it is crucial to test the algorithm on simple geometries to check its accuracy before applying it to complex problems. Indeed, unlike in 2D cases, in 3D problems even a qualitative evaluation of which particles belong to the free surface could be quite difficult. In particular cavities and jets are generally blurred since particles are spread in the space in a disordered way. A way to overcome this problem is to test the algorithm on a particle distribution with a free surface a priori known. Two tests were performed in this way. In the first one particles are arranged to form a sphere with a spherical cavity inside, as sketched in left panel of figure 6. In order to have a regular distribution particles are positioned on concentric spheres with radius increasing by dx, where dx is cubic root of the  √   particle volume. On each sphere, particles are equispaced with / F∀j ∈ N |xji | ≥ 2h,|xjT | ≤ h i ⇒ i ∈   ∀j h∈ N a distance approximatively equal to dx. The cavity inside √ n·x |xji | < 2h, arccos |xjiji| ≤ π4 ⇒ i∈ /F the sphere has a diameter equal to 4dx ≃ 3h. This figure   is actually a bit greater than 2h which is the limit size otherwise i∈F (5) for detecting a cavity. However, choosing a smaller cavity Therefore, in an intuitive way, the triangular region in figure radius was not possible in practice. Indeed, this would have 3 becomes a cone in three dimensions, while the semicircle resulted in having two few particles distributed on the cavity surface, resulting on a bad approximation of their volumes, becomes a hemisphere.

4th international SPHERIC workshop

Nantes, France, May, 27-29 2009

and consequently an inappropriate test of the algorithm. The particle distribution is shown in the right panel of figure 6. In such a view it is not possible to detect the cavity inside the sphere. Similar difficulty are commonly found in 3D complex flow situations, see section IV.

10dx

In order to assess the capability of the algorithm to capture cavities of dimension equal to 2h, a more complex test was performed. As displayed in the left panel of figure 8, a toroidal cavity was created inside the sphere. The torus inner diameter is 2h and the torus ring diameter is 14dx. Again, when showing the whole particle set, it is not possible to distinguish the toroidal cavity inside the sphere (see right panel of 8). The free-surface particles detected by the algorithm are shown in figure 9. Also in this case free-surface particles and normals are correctly evaluated.

1.5

3h Z

x= 4d

1

1

0.5

1

X

0.5

1.5

Y

Fig. 6. Left panel: sketch of the tested geometry. Right panel: corresponding set of particles.

The result given by the algorithm is presented in figure 7. The two free surfaces detected (the ones from the inner and outer spheres) are shown separately to better evidence the normals. It can be seen that free-surface particles and normals are correctly evaluated both in the cavity and along the external surface.

Fig. 8. Left panel: sketch of the second tested geometry. Right panel: corresponding set of particles.

4dx

1.5

1.5

2h Z

1

Z

1 0.5

0.5 1.5

1.5

Y

1

1

Y

1

1.5

X 0.5

1

0.5

0.5

X

25dx

10dx 1.5

1.5

Z

1

Z

1 0.5

0.5 1.5

1.5

Y

1.5

1

1

Y

1

X 0.5

1

0.5

0.5

X

Fig. 7. Top: detected free-surface particles and normals on the spherical cavity boundary. Bottom: detected free-surface particles and normals on the outer sphere.

Fig. 9. Top: detected free-surface particles and normals on the toroidal cavity boundary. Bottom: detected free-surface particles and normals on the outer sphere.

4th international SPHERIC workshop

IV. I NTERPOLATION OF

PARTICLES DATA ONTO A

REGULAR GRID

The interpolation of particle data onto a regular grid can be useful both for “remeshing” the particles during the simulation, and for easing analysis of the flow features through adequate post-processing. In order to perform this procedure it is necessary to locate the free-surface across the grid. In other words, one needs to separate nodes inside the fluid domain from nodes outside. This can be done from the knowledge of the free-surface particle subset F. Let us consider a regular cartesian grid of spatial resolution dx, and which comprises all the computational domain. For each node N close to free surface particles of subset F, the nearest free-surface particle FN is detected and the scalar quantity dN FN is evaluated through: (6) dN FN = (xN − xFN ) · nFN

Nantes, France, May, 27-29 2009

φ -1.00

-0.50

0.00

0.50

1.00

φ=-(dx/2)/2h

For each node it is now possible to define a scalar function φ(xN ):  −1 dN FN ≤ −2h    −2h < dN FN < 2h −dN FN /2h (7) φ(xN )    +1 dN FN ≥ 2h

This function is positive inside the fluid, negative outside it and equal to 0 along the free-surface where dN FN = 0. More precisely, considering that the actual free surface can be assumed to be positioned at an average distance dx/2 from particles belonging to F. Under this condition the value of φ on the free-surface has to be φ = −dx/4h and not zero anymore. At computational level, the procedure to evaluate φ can be made in a fast manner. At each node we first identify the particles present within a 2h-distance. We denote N2h this subset of particles, thanks to which we can evaluate the function φ(xN ) as: −1 +1 dN FN /2h −|xN − xFN |/2h

=∅ 6= ∅, N2h ∩ F = ∅ 6= ∅, N2h ∩ F 6= ∅, λFN ≥ 0.1 6= ∅, N2h ∩ F = 6 ∅, λFN < 0.1 (8) where λFN is the minimum eigenvalue of the renormalization matrix (see eq. 1) for the particle FN . For λFN < 0.1 the nearest free-surface particle for the node xN is a solitary particle. In such a case the vector nFN is null (see eq. 3) and consequently the scalar product dN FN (see 6) is meaningless. Therefore, the latter is directly substituted with the distance |xN − xFN |. Further, to regularize the function φ a gaussian filter on the nodes is performed once φ is evaluated by equation (8) on the whole mesh. In figure 10 the contour plots of function φ for the two time instants of figure 2 are shown. The free surface is represented by the red dash-dotted line which corresponds to the contour level φ = dx/4h, in close agreement with the free-surface particle positions if they were shifted by dx/2. N2h N2h N2h N2h

Fig. 10. Contour plot of function φ for the particle distribution shown in figure 2. Free-surface particles (black dots) and free-surface contour level (red dash-dotted curve).

In 3D simulations the interpolation on a regular mesh clearly brings higher benefits. Indeed, the visualization and the flow analysis of a 3D SPH simulation is generally quite difficult. This is highlighted in figure 11 where a spherical fluid domain with three concentric toroidal cavities and a small spherical cavity of 3h diameter is considered. Even though only the free-surface particles are shown (left panel) it is obvious how difficult it is to recognize the geometry of the fluid domain. On the right side of the same figure the iso-surface φ = −dx/4h representing the free surfaces conversely gives a clear representation of the fluid domain, thanks to transparency features which are a standard visualization tool on a regular mesh. To illustrate the method capabilities on an actual complex 3D situation, we show some interpolation results of an impact

4th international SPHERIC workshop

Nantes, France, May, 27-29 2009

Fig. 11. Spherical fluid domain with three toroidal cavities and a spherical cavity of 3h diameter. Top: free-surface particles. Bottom: iso-surface φ = dx/4h.

flow (1st SPHERIC benchmark). In figure 12 the whole particle distribution and the detected free-surface particles are shown at some time instant after the impact. In these plots few flow features can be analyzed. A better representation of the free surface is given by the iso-contour φ = dx/4h in figure 13. In particular, the pressure distribution during the impact is evidenced through contours interpolated on a vertical plane inside the domain. Finally, the last plots of figure 13 show how it is possible to analyze flow internal details through the reconstruction of the free surface as an iso-surface. In particular, entrapped bubbles and a large tube cavity due to a strong wave breaking are clearly identifiable. V. C ONCLUSION In the present paper an efficient algorithm has been proposed. It is composed of three stages. The first stage consists in detecting the particles composing the free-surface of 2D and 3D simulations. From this information, it is possible to define a level-set function throughout the domain in a second stage. Eventually, this function can be used to interpolate flow quantities on a cartesian grid, which makes possible the visualization and analysis of flow features using standard visualization tools. The three stages have been carefully validated on test cases of increasing complexity, up to real 3D impact flow. On these test cases it has been shown how the method permits to get into flow details such that thin jets, drops, entrapped air structures, etc. as well as to recover contour slices, iso-surfaces, etc. in an efficient way. ACKNOWLEDGMENTS This work was partially supported by Programma Ricerche INSEAN 2007- 2009 and Programma di Ricerca sulla Si-

Fig. 12. 3D impact against a tall structure after a dam-break. Top: whole particle distribution over the fluid domain; the colors represent the pressure. Bottom: free-surface particles detected by the algorithm at same time instant.

curezza funded by Ministero Infrastrutture e Trasporti. R EFERENCES [1] C OLAGROSSI , A., & L ANDRINI , M. 2003 Numerical simulation of interfacial flows by Smoothed Particle Hydrodynamics. J. Comp. Phys.. 191, 448-475. [2] D ILTS , G.A. 2000 Moving least-squares particle hydrodynamics II: conservation and boundaries Int. J. Numer. Meth. Engng 48, 1503-1524. [3] A AMER , H. & D ILTS , G.A. 2007 Three-dimensional boundary detection for particle methods J. Comp. Phys. 226, 1710-1730. [4] H IEBER , S.E. & K OUMOUTSAKOS , P. 2008 An immersed boundary method for smoothed particle hydrodynamics of self-propelled swimmers J. Comp. Phys. 227, 8636-8654. [5] B ELYTSCHKO T., K RONGAUZ Y., D OLBOW J. & G ERLACH C. 1998 On the completeness of the meshfree particle methods Int. J. Numer. Mech. Engng 43, 785-819. [6] R ANDLES , P.W. & L IBERSKY, L.D. 1996 Smoothed Particle Hydrodynamics: Some recent improvements and applications Comput. Methods Appl. Mech. Engng. 139, 375-408. [7] D ORING , M. 2005 Dveloppement d’une mthode SPH pour les applications surface libre en hydrodynamique PhD Thesis, Ecole Centrale Nantes [8] B ONET, J. & L OK , T.-S.L. 1999 Variational and momentum preservation aspects of Smooth Particle Hydrodynamic formulations Comput. Methods Appl. Mech. Engrg. 180, 97-115.

4th international SPHERIC workshop

Nantes, France, May, 27-29 2009

Fig. 13. 3D Flow impact against a tall structure after a dam-break. Top: two views of the free-surface represented by iso-surface φ = dx/4h. Middle: free-surface iso-surface and pressure contours interpolated on a vertical plane at two different time instants. Bottom: two views of the free-surface iso-surface at a later stage of the flow evolution; on the right plot a detail of the cavity generated in front of the column is given (seen from below).

Suggest Documents