원시데이터 수집 시스템
선정목록으로

Analytic Solution to the Piecewise Linear Interface Construction Problem and Its Application in Curvature Calculation for Volume-of-Fluid Simulation Codes

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. Moritz Lehmann — Biofluid Simulation and Modeling, Theoretische Physik VI, University of Bayreuth, 95448 Bayreuth, Germany
  2. Stephan Gekle — Biofluid Simulation and Modeling, Theoretische Physik VI, University of Bayreuth, 95448 Bayreuth, Germany
DOI
10.3390/computation10020021
저널
Computation
발행년도
2022
발행기관
Multidisciplinary Digital Publishing Institute
피인용수
16
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.3390/computation10020021
토픽
Surface Modification and Superhydrophobicity
OpenAlex ID
W3036320123

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

The plane–cube intersection problem has been discussed in the literature since 1984 and iterative solutions to it have been used as part of piecewise linear interface construction (PLIC) in computational fluid dynamics simulation codes ever since. In many cases, PLIC is the bottleneck of these simulations regarding computing time, so a faster analytic solution to the plane–cube intersection would greatly reduce the computing time for such simulations. We derive an analytic solution for all intersection cases and compare it to the previous solution from Scardovelli and Zaleski (Scardovelli, R.; Zaleski, S. Analytical relations connecting linear interfaces and volume fractions in rectangular grids. J. Comput. Phys.2000, 164, 228–237), which we further improve to include edge cases and micro-optimize to reduce arithmetic operations and branching. We then extend our comparison regarding computing time and accuracy to include two different iterative solutions as well. We find that the best choice depends on the employed hardware platform: on the CPU, Newton–Raphson is fastest with compiler optimization enabled, while analytic solutions perform better than iterative solutions without. On the GPU, the fastest method is our optimized version of the analytic SZ solution. We finally provide details on one of the applications of PLIC—curvature calculation for the Volume-of-Fluid model used for free surface fluid simulations in combination with the lattice Boltzmann method.

본문 39,626자

본문 펼치기
The plane-cube intersection problem has been around in literature since 1984 and iterative solutions to it have been used as part of piecewise linear interface construction (PLIC) in computational fluid dynamics simulation codes ever since. In many cases, PLIC is the bottleneck of these simulations regarding compute time, so a faster, analytic solution to the plane-cube intersection would greatly reduce compute time for such simulations. We derive an analytic solution for all intersection cases and compare it to the one previous solution from Scardovelli and Zaleski (Ruben Scardovelli and Stephane Zaleski. "Analytical relations connecting linear interfaces and volume fractions in rectangular grids". we further improve to include edge cases and micro-optimize to reduce arithmetic operations and branching. We then extend our comparison regarding compute time and accuracy to include two different iterative solutions as well. We find that the best choice depends on the employed hardware platform: on the CPU, Newton-Raphson is fastest with vectorization while analytic solutions perform better without. The reason for this is that vectorization instruction sets do not include trigonometric functions as used in the analytic solutions. On the GPU, the fastest method is our optimized version of the analytic SZ solution. We finally provide details on one of the applications of PLIC -curvature calculation for the Volume-of-Fluid model used for free surface fluid simulations in combination with the lattice Boltzmann method. Introduction Piecewise linear interface construction (PLIC) -first occurring in literature for 2D in 1982 [1] and for 3D in 1984 [2] -refers to the problem of calculating the offset along the given normal vector of a plane intersecting a unit cube for a given truncated volume. There are five possible intersection cases (cf. figure 1), of which the numbers (1), (2) and (5) have been already solved in the original 1984 work by Youngs [2], but the cubic polynomial cases (3) and (4) -resigned as impossible to algebraically invert [3] -in the majority of literature are approximated by a Newton-Raphson iterative solution. Nevertheless, there does exist an analytic solution by Scardovelli and Zaleski (SZ) [4] and a single documented implementation thereof in Fortran [5] which also includes an approximative version termed APPLIC. Introduction Here, we formulate the PLIC problem from the ground up -first in the inverse direction -and derive an alternative analytic solution for all intersection cases by inverting the inverse formulation. We then compare our novel solution with (i) the original SZ solution, (ii) an improved and micro-optimized version of the SZ solution developed in the present work, (iii) an iterative solution using Newton-Raphson and (iv) an iterative solution using nested intervals. Depending on the available microarchitecture (GPU/CPU), vectorization may be available, which strongly favors multiplications and additions while not speeding up trigonometric functions, impacting which of the algorithms is fastest. Introduction Among the applications for PLIC are Volume-of-Fluid simulation codes such as FluidX3D [6,7] and others [8][9][10][11][12][13][14][15][16][17][18], often in conjunction with GPU implementations [6, 1 7, 19-25] of the lattice Boltzmann method [26][27][28], used for simulating free surface fluid flows. In particular, these simulations work on a cubic lattice with every lattice point having a fill level assigned to it and PLIC is used in the process of surface reconstruction during curvature calculation for calculating physical surface tension effects [6,8]. In the final section of this work, we provide a detailed overview on the state-of-the-art curvature calculation procedure using PLIC. Plane-Cube Intersection Inputs to the PLIC algorithm are the truncated volume V 0 ∈ [0, 1] and the (normalized) normal vector of the plane n = (n x , n y , n z ) T , | n| = n 2 Plane-Cube Intersection x + n 2 y + n 2 z = 1. The desired output is the plane offset from the origin (center of the unit cube) along the normal vector d 0 V 0 , (n x , n y , n z ) T → d 0 Plane-Cube Intersection (1) Plane-Cube Intersection ]. The interval is determined by the normal vector orientation: depending on the normal vector, the maximum possible distance from the cube center to be still at least touching the cube in one point varies between 1 2 (normal vector parallel to one of the coordinate system axes) and √ 3 2 (normal vector along the space diagonal). Applying symmetry conditions to reduce problem complexity To reduce the amount of possible cases and to avoid having to consider all possible intersections of the plane and cube edges -following the scheme in [2] and [14] 1 -the normal vector is component-wise mirrored into positive. The mirrored normal vector components are sorted ascending for their magnitude such that 0 ≤ n 1 ≤ n 2 ≤ n 3 ≤ 1. Because n is normalized, the absolute value of its largest component n 3 is always greater than zero. Applying symmetry conditions to reduce problem complexity n 1 := min(|n x |, |n y |, |n z |) ≥ 0 (2) n 3 := max(|n x |, |n y |, |n z |) > 0 (3) n 2 := |n x | + |n y | + |n z | − n 1 − n 3 ≥ 0 (4) Applying symmetry conditions to reduce problem complexity Since the function V 0 (d 0 ) is symmetric around d 0 = 0 and increasing monotonically, the reduced-symmetry-volume V ∈ [0, 1 2 ] is limited to the lower half of the intersection volume V 0 and the upper half is reconstructed from 1 We note that in [14] in equations (21) and (23) respectively the "+" should be a "−" and in equation (24) the ">" should be a "<". symmetry. Applying symmetry conditions to reduce problem complexity This symmetry condition for the case V 0 > 1 2 is now applied to d 0 , and the coordinate origin is shifted from (0, 0, 0) (center of the unit cube) to (− 1 2 , − 1 2 , − 1 2 ) (bottom left corner in the back in fig. 1), resulting in the distance d ∈ [0, n1+n2+n3 2 ] in reduced symmetry space: Applying symmetry conditions to reduce problem complexity With this reduction in symmetry, there are only five different intersection cases remaining (see figure 1). Applying symmetry conditions to reduce problem complexity 2 ( Applying symmetry conditions to reduce problem complexity Figure 1: All possible intersection cases of a plane and a unit cube. The truncated volume of cases (1) to (4) is a tetrahedral pyramid with zero (1), one (2), two (3) or all three (4) corners extending outside of the unit cube being cut-off tetrahedral pyramids themselves. Formulating the inverse PLIC problem In order to derive the analytic PLIC solution, first the inverse problem is formulated in equations -again following the scheme in [2]. In the inverse problem, the intersection volume is calculated from the plane offset and normal vector as inputs. At first, the intersection points s 1 , s 2 and s 3 of the plane with the coordinate system axes (see figure 1) are determined: Formulating the inverse PLIC problem Now one calculates the actual volume in reduced symmetry space. The approach is to calculate the volume of the tetrahedral pyramid formed by the plane and the coordinate system axes and, if necessary, subtract the volumes of zero, one, two or all three corners that extend beyond 1. For case (3), an additional condition is required to mutually exclude case (5), in which the bottom four corners of the cube are located beneath the plane. Formulating the inverse PLIC problem if s 2 ≥ 1 and s 3 ≤ 1 and s 1 (s 2 − 1) ≤ s 2 Formulating the inverse PLIC problem To shorten equation (10), s 1 , s 2 and s 3 are substituted and the expression is simplified, yielding Formulating the inverse PLIC problem which is already quite a bit more friendly and completes the inverse PLIC formulation in conjunction with equations (2) to (4), (7) and (6). The condition for case (5) is the remaining free sector of the possible range of d mutually excluded by the other four cases. Listing 1 shows the fully optimized OpenCL C implementation of the inverse PLIC solution. Formulating the inverse PLIC problem float p l i c _ c u b e _ i n v e r s e ( const float d0 , const float3 n ) { // unit cube -→ plane intersection : plane offset d0 , normal vector n -> volume V0 → in [0 ,1] const float n1 = fmin ( fmin ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; // eliminate → most cases due to symmetry const float n3 = fmax ( fmax ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; const float n2 = fabs ( n . x ) -n1 + fabs ( n . y ) + fabs ( n . z ) -n3 ; const float d = 0.5 f * ( n1 + n2 + n3 ) -fabs ( d0 ) ; // calculate PLIC with reduced → symmetry , shift origin from (0.0 ,0.0 ,0.0) -> (0.5 ,0.5 ,0.5) float V ; // 0.0 <= V <=0.5 if ( fmin ( n1 + n2 , n3 ) <= d && d <= n3 ) { // case (5) V = ( d -0.5 f * ( n1 + n2 ) ) / n3 ; // avoid division by n1 and n2 Formulating the inverse PLIC problem ) -cb ( fdim (d , n3 ) ) ) /(6.0 f * n1 * n2 * n3 ) ; } return copysign (0.5 f -V , d0 ) +0.5 f ; // apply symmetry for V0 >0.5 } Listing 1: Fully optimized OpenCL C implementation of the inverse PLIC solution. To avoid branching between cases (3) and (4), in the implementation the fdimf(x,y):=max(x-y,0) function is used. Case (2) cannot be included with another fdimf(x,y) because in case (2) division by n 1 must be avoided since it could be zero. Inverting the inverse PLIC Formulation analytically Equation (11) is now inverted for each case individually. Cases (1), (2) and (5) are easy, but cases (3) and (4) are non-trivial third order polynomials. Here we make use of the tool Mathematica, which outputs three complex solutions for cases (3) and (4) each (section 9), of which the third solutions respectively are the right ones as their imaginary parts in the desired range are zero after simplification. Luckily, both are of the same overall form (eq. (13)). However, a complex solution is not useful here since the expected result is a real number -a problem known as the casus irreducibilis -and most programming languages cannot deal with complex numbers natively. It would also lead to unwanted computational overhead to carry along the imaginary part during computation, which in the end will be zero anyway. To overcome this, we again make use of Mathematica to simplify the general form of the complex solution (eq. (13)) in order to obtain the real, trigonometric solution, which is then even further simplified using the trigonometric identity √ 3 sin(α)−cos(α) = −2 sin( π 6 −α) such that the number of trigonometric functions (which are computationally expensive compared to simpler operations such as additions or multiplications) is minimized (eq. (12)). Inverting the inverse PLIC Formulation analytically For better readability, a few expressions are pre-defined. Hereby the normalization condition n 2 1 + n 2 2 + n 2 3 = 1 is applied. Inverting the inverse PLIC Formulation analytically t 4 := 9 (n 1 + n 2 + n 3 ) 2 − 18 (19) x 4 := 324 n 1 n 2 n 3 (1 − 2 V ) ≥ 0 (20) Inverting the inverse PLIC Formulation analytically Finally then, the complete analytic solution to the 3D PLIC problem is given by Inverting the inverse PLIC Formulation analytically 4 in conjunction with equations (2) to (4), (5), (8), (12) and (14) to (24). Inverting the inverse PLIC Formulation analytically In equation (25) it is noteworthy that the conditions for the five different cases are determined a posteriori by the result itself. This means that each case has to be evaluated successively and for the resulting value d the respective condition has to be tested. If the condition is true, calculation is stopped and d is returned. If the condition is false, the next case has to be evaluated and so on, until the last case is reached. Inverting the inverse PLIC Formulation analytically The order in which the cases are computed and checked can be optimized to calculate the most difficult and infrequent cases last, when the probability is high that one of the easier and more frequent cases has already been chosen. 'Frequent' here refers to some cases appearing more often than others with randomized V 0 and n as expected in typical PLIC applications. Here also special considerations for edge cases (more on that below) need to be taken into account to avoid possible divisions by zero. With this in mind, the order (5)→(2)→(1)→(3)→(4) is preferred. Inverting the inverse PLIC Formulation analytically Additional speedup can be gained by noting that the implicit condition involving d can be replaced by an explicit condition involving V for cases (1), (2) and (5): Inverting the inverse PLIC Formulation analytically Since V is known, these conditions are checked a priori in order to avoid root function calls if the condition is false. Inverting the inverse PLIC Formulation analytically For even more speedup, all redundant mathematical operations are reduced to a minimum by pre-calculating them to variables (micro-optimization) and condition checks mutually excluded by previous checks are skipped, especially all conditions for the very last case. In the implementation order (5) → (2) → (1) → (3) → (4) the conditions for case (3) simplify to d 3 ≤ n 3 , which will mutually exclusive decide between cases (3) and (4). Since both d 3 and d 4 are very complicated expressions, here no simplified a priori condition is formulated. Inverting the inverse PLIC Formulation analytically In equations (19), (21) and (25), the argument of the square root may be negative before the case condition is tested. In this case -since in the actual code, floatingpoint exception handling is turned off for performance reasons -the resulting NaN of a square root of a negative number would not be captured in the case condition, leading to a wrong result. An additional fdim function call in the square root solves this issue. In the implementation, we artificially exclude the edge case x 4 = 0 in order to instead of atan2(y, x) use the faster atan(y/x), giving the algorithm a 15% speedup. In case branching would be undesirable, bit masking is also an option, but bit masking turned out to be slower even on GPUs. Inverting the inverse PLIC Formulation analytically Two edge cases still need to be taken into careful consideration: n 1 = 0 (2D) and n 3 = 1 (1D). n 1 = 0 restricts n to be in a 2D plane of two coordinate system axes and n 3 = 1 restricts n to be parallel to one of the coordinate system axes. For the (1D) case, n 3 = 1 and the solution is always (5), so n 1 = n 2 = 0 and min(n 1 + n 2 , n 3 ) = 0, simplifying equation (25) without loss of generality to Inverting the inverse PLIC Formulation analytically A clean derivation of the 1D case yields Inverting the inverse PLIC Formulation analytically without any conditions, so it is a necessary requirement that both additional conditions in eq. (27) must be fulfilled automatically. d is in the range 0 ≤ d ≤ n1+n2+n3 2 Inverting the inverse PLIC Formulation analytically , so here in the special case we have 0 ≤ d ≤ Inverting the inverse PLIC Formulation analytically In the (2D) case, n 1 = 0 (n 2 = 0 is excluded here since it is already covered in the (1D) case, so here n 2 > 0). Here only intersection cases (2) or (5) are possible, 0 < n 2 ≤ n 3 ≤ 1 and min(n 1 + n 2 , n 3 ) = n 2 , simplifying eq. (25) without loss of generality to Inverting the inverse PLIC Formulation analytically A clean derivation of the 2D case yields Inverting the inverse PLIC Formulation analytically which has simpler conditions, so again it is a necessary requirement that both additional conditions in eq. (29) must be fulfilled automatically. d is in the range , so here with the special conditions we have 0 ≤ d ≤ 0+n2+n3 2 ≤ n3+n3 2 = n 3 , meaning that both 0 ≤ d and d ≤ n 3 are indeed fulfilled automatically. (29) must be fulfilled automatically. d is in the range In the above chosen (5) → (2) → (1) → (3) → (4) implementation order, the 1D and 2D special cases are already covered in (5) and (2) at the beginning, so they both are excluded in the remaining intersection cases (1), (3) and (4), meaning that there n 1 , n 2 , n 3 > 0 are always given, resulting in x 3 > 0 in equation (14). (29) must be fulfilled automatically. d is in the range Listing 2 shows the fully optimized OpenCL C implementation of the analytic PLIC solution with equation (26). (29) must be fulfilled automatically. d is in the range → * sin (0.5235988 f -0.33333334 f * atan ( sqrt ( y42 ) / x4 ) ) ; // x4 >0 return d4 ; // case (4) } float plic_cube ( const float V0 , const float3 n ) { // unit cube -plane → intersection : volume V0 in [0 ,1] , normal vector n -> plane offset → d0 const float ax = fabs ( n . x ) , ay = fabs ( n . y ) , az = fabs ( n . z ) , V =0.5 f -fabs ( V0 -0.5 f ) → ; // eliminate symmetry cases const float n1 = fmin ( fmin ( ax , ay ) , az ) ; const float n3 = fmax ( fmax ( ax , ay ) , az ) ; const float n2 = ax -n1 + ay + az -n3 ; const float d = p l i c _ c u b e _ r e d u c e d (V , n1 , n2 , n3 ) ; // calculate PLIC with → reduced symmetry return copysign (0.5 f * ( n1 + n2 + n3 ) -d , V0 -0.5 f ) ; // apply symmetry for V0 >0.5 } Listing 2: Fully optimized OpenCL C implementation of our analytic PLIC solution. The analytic SZ solution The analytic PLIC solution by Scardovelli and Zaleski from 2000 [4] has been implemented in Fortran in 2016 by Kawano [5] where it is used as comparison to the approximative APPLIC method. Here we focus on the exact SZ solution. The SZ solution is particularly interesting in that it builds upon the L 1 -normalized plane normal vector instead of the more common L 2 normalization as used in our own solution in section 2.3. We first translate the Fortran implementation to OpenCL C, make it compatible with an L 2 -normalized plane normal vector as input and rescale the result from the original [0, 1] to [− ]. The implementation is provided in listing 3. The analytic SZ solution float plic_cube ( const float V0 , const float3 n ) { // unit cube -plane → intersection : volume V0 in [0 ,1] , normal vector n -> plane offset → d0 const float l = fabs ( n . x ) + fabs ( n . y ) + fabs ( n . z ) ; // length in L1 norm const float ax = fabs ( n . x ) /l , ay = fabs ( n . y ) /l , az = fabs ( n . z ) /l , w =0.5 f -fabs ( V0 → -0.5 f ) ; // eliminate symmetry cases const float vm1 = fmin ( fmin ( ax , ay ) , az ) ; const float vm3 = fmax ( fmax ( ax , ay ) , az ) ; const float vm2 = fdim (1.0 f , vm1 + vm3 ) ; // ensure vm2 >=0 const float vm12 = vm1 + vm2 ; float alpha = 0.0 f ; const float v1 = sq ( vm1 ) /(6.0 f * vm2 * vm3 +1 E -25 f ) ; const float w6 = 6.0 f * vm1 * vm2 * vm3 * w ; The analytic SZ solution 7037037 E -2 f = 1/27 const float sp = sqrt (0.11111111 f * sq ( a2 ) -0.33333334 f * a1 ) ; alpha = 2.0 f * sp * cos (4.1887902 f +0.33333334 f * acos ( q0 / cb ( sp ) ) ) -0.33333334 → f * a2 ; // 4.1887902 f = 4/3 * pi } } return l * copysign (0.5 f -alpha , V0 -0.5 f ) ; // rescale result and apply → symmetry for V0 >0.5 } Listing 3: The Fortran implementation [5] of the analytic SZ PLIC solution [4] translated to OpenCL C without further optimization. The analytic SZ solution When closely studying the implementation in listing 3, we notice that the 1D edge case is poorly handled despite the addition of a tiny constant to the denominator for the calculation of v1. In the edge cases of the normal vector n = (1, 0, 0) T and the volume V 0 ∈ {0, 1}, the algorithm returns -NaN both in our OpenCL and in the original Fortran implementation. By checking cases (5) and (2) first and by avoiding divisions by vm1 and vm2 before the checks for cases (5) and (2) respectively, we improve handling of the 1D edge case. We further apply some micro-optimization to significantly reduce the number of arithmetic operations, resulting in an optimized implementation of the SZ solution shown in listing 4 below. Iterative Solutions For comparison, we also provide iterative solutions using nested intervals in listing 5 and Newton-Raphson in listing 6. d -= f / fs ; } return d ; // case (4) } float plic_cube ( const float V0 , const float3 n ) { const float n1 = fmin ( fmin ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; // eliminate → most cases due to symmetry const float n3 = fmax ( fmax ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; const float n2 = fabs ( n . x ) -n1 + fabs ( n . y ) + fabs ( n . z ) -n3 ; const float V = 0.5 f -fabs ( V0 -0.5 f ) ; const float d = p l i c _ c u b e _ r e d u c e d (V , n1 , n2 , n3 ) ; return copysign (0.5 f * ( n1 + n2 + n3 ) -d , V0 -0.5 f ) ; // apply symmetry for V0 >0.5 } Listing 6: OpenCL C implementation of the iterative Newton-Raphson solution for cases (1), (3) and (4). Calculating case (1) with Newton-Raphson as well instead of the cbrt() function results in a very small, but noticeable improvement in performance when executed on the CPU with AVX2 vectorization. Performance and Accuracy Comparison Apart from floating-point errors, the SZ solution in listing 4 and our own solution in listing 2 produce identical results. For accuracy comparison, we define the error as Performance and Accuracy Comparison with plic cube inverse(d 0 , n i ) referring to the implementation in listing 1 and plic cube(V 0 , n i ) referring to the various PLIC implementations. We define the average error as follows: Performance and Accuracy Comparison The execution time for a 'blank run' Performance and Accuracy Comparison containing the time for memory loads and stores as well as compute time for the inverse PLIC algorithm is measured and later subtracted from the execution times of the different PLIC variants in order to isolate their execution time. The time is also divided by the number of PLIC function evaluations (N L) in order to obtain the time for a single execution. CPU Testing In this test, n i is set to N = 4096 different normal vectors, of which one is (1, 0, 0) T , one is ( 1 When AVX2 vectorization is available, Newton-Raphson is considerably faster than all the other solutions. However we note that our benchmark is a particularly synthetic scenario where vectorization is easily achievable for the compiler: The benchmark just calculates PLIC repeatedly in a loop. With FP32 and AVX2, every eight consecutive iterations are combined into one vectorized iteration, completing in far fewer clock cycles than the eight iterations separately would. In realworld applications, PLIC is not computed repeatedly in multiples of eight, greatly limiting vectorization potential such that the strict criteria for auto-vectorization [29] might not be met. Surprisingly, our analytic solution and the optimized SZ solution are within margin of error regarding compute time. CPU Testing In the edge cases of the normal vector n = (1, 0, 0) T and the volume V 0 ∈ {0, 1}, the SZ solution by Kawano returns -NaN, which propagates through the entire error averaging procedure. For the IEEE-754 FP32 floatingpoint format, the machine epsilon is at = 5.96 · 10 −8 , meaning that for all other PLIC variants the average error E avg is within machine precision. Without compiler optimization (/Od, /Qpar-), the execution time results are very different as shown in table 2. With AVX2 vectorization not available, Newton-Raphson considerably falls behind the analytic solutions. GPU Testing Since in many applications the target platform for the PLIC algorithm is the GPU, we also benchmark the different variants in OpenCL on an Nvidia Titan Xp GPU (3840 CUDA cores at 1582 MHz, driver version 442.59, OpenCL 1.2). The test here differs from the CPU C++ test in that for sufficient saturation of the parallel compute capabilities, the number of random normal vectors is increased to 67108864, of which again one is (1, 0, 0) T , one is ( 1 √ 2 , 1 √ 2 , 0) T , 8388606 are random 2D directions in the x-y-plane and the remaining 58720256 are random 3D directions. For these normal vectors, PLIC is run in parallel and for each of them, the volume V 0 is varied in the interval [0, 1] -edge cases included -in L = 256 equally spaced steps in series. For more accurate results through averaging, this test is run 64 times and the mean execution time is averaged and divided by the number of parallel and serial PLIC computations, resulting in an average compute time of more than three magnitudes shorter than for single-core CPU execution as listed in table 3 below. Even though the tests are designed differently for the CPU and GPU, this comparison is appropriate because in both cases the same algorithms are computed and the hardware is fully saturated. The table also includes the number of arithmetic operations (floating-point, integer and bit operations combined) N a and the number of branching operations N b in PTX assembly [30]. GPUs are especially bad at branching, so a small N b is desired. These operation counts -in analogy to the compute time -refer to the isolated PLIC variants with the background 'blank run' for memory loads and stores as well as the inverse PLIC algorithm subtracted. N a indicates that Newton-Raphson is unrolled by the compiler whereas nested intervals is not. The number of iterations to reach machine precision for nested intervals depends on the initial interval width, which is a function of the normal vector components. For Newton-Raphson, the number of branching operations N b is smallest, resulting in rather good performance. Nevertheless, our optimized implementation of the SZ solution pulls ahead rather significantly and thus is preferred by us. Plane-Sphere Intersection The PLIC problem can be extended to spherical cells with unit volume (see figure 2): Plane-Sphere Intersection The offset along the plane normal vector is the desired result while the truncated volume is given. Since we have a sphere, the normal vector direction of the plane is irrelevant. Plane-Sphere Intersection Calculating the inverse PLIC (getting the volume V 0 from a given offset d 0 ∈ [−r, r]) is straight-forward and covered by the 'spherical cap' equation: Plane-Sphere Intersection Calculating the inverse function of the above equation again is quite difficult due to it being a third order polynomial with three complex solutions, but by using the same trick as in the plane-cube intersection case (equations (12) and (13)), this real expression is obtained: Volume-of-Fluid (VoF) is a model to simulate a sharp, freely moving interface between a fluid and gas phase in a Cartesian lattice [8][9][10][11]. While it can be coupled to any flow solver, here we focus on its usage in conjunction with the Lattice-Boltzmann-method (LBM). The interface is ensured to be exactly one lattice cell thick at any time (illustrated in figure 3). As an indicator for each lattice point type, the fill level ϕ is introduced, whereby for fluid lattice points ϕ = 1, for interface 1 > ϕ > 0 and for gas ϕ = 0: Plane-Sphere Intersection Here ρ is the density provided by the lattice Boltzmann method (LBM) and m is the fluid mass. m is a conserved quantity and cannot be gained or lost, only moved within the simulation box. The key difficulty of modeling a free surface on a discretized lattice is to obtain the surface curvature, which is a necessary ingredient for calculating the surface tension via the Young-Laplace pressure Plane-Sphere Intersection with κ = 1 R denoting the local mean curvature and σ denoting the surface tension parameter of the simulated fluid. The equation is easy in principle, but calculating κ from the discretized interface geometry is not. Specifically, discretized interface here means that only a local 3 3 neighborhood of fill levels ϕ ∈ [0, 1] is known in addition to the point in the center of this neighborhood being an interface lattice point. Plane-Sphere Intersection The most common algorithm in literature [8,11] is the curvature calculation via a least-squares paraboloid fit from a neighborhood of points located on the interface. It assumes the local interface to be a paraboloid, the specifics of which will be given in the following sections. Plane-Sphere Intersection Finding an appropriate set of neighboring points on the interface requires the PLIC solution. Obtaining neighboring interface points: PLIC point neighborhood Piecewise linear interface construction works on a 3 3 neighborhood of an interface lattice point (illustrated in 2D in figure 4a). Within this neighborhood, only interface points other than the center interface pointwhich is always interface -are considered as candidates for the later fitting procedure (figure 4b). The difficult part is to accurately obtain the heights z i of at least five neighboring points located on the true interface (figure 4c). For this, first the normal vector n of the center interface point is calculated via the Parker-Youngs approximation as described in the appendix 10.1 in eq. (54). A new coordinate system is introduced with its first base vector b z defined as this normal vector. Then, the cross product with an arbitrary vector such as r := (0.56270900, 0.32704452, 0.75921047) T Obtaining neighboring interface points: PLIC point neighborhood which is always non-colinear with b z just by random chance is calculated to provide second and third orthonormal vectors Obtaining neighboring interface points: PLIC point neighborhood forming the new coordinate system in which the z-axis is colinear with the surface normal and the center interface point is in the origin. Now the relative positions e i (equal to the D3Q27 LBM streaming directions, eq. (53)) of all neighboring interface lattice points are gathered and transformed into the rotated coordinate system. During this step, the approximate interface position of neighboring interface points (streaming directions, figure 4b) is corrected to the much more accurate interface Obtaining neighboring interface points: PLIC point neighborhood Here i is only the subset of {0, .., 26} for which 0 < ϕ i < 1 is true (interface points). d 0 (V 0 = ϕ i , n) denotes the PLIC function (equation (8)). Note that d 0 (V 0 = ϕ 0 , n) only needs to be calculated once while d 0 (V 0 = ϕ i , n) has to be calculated for each neighboring interface point and that the normal vectors of neighboring interface lattice points are approximated to be equal to the normal vector of the center lattice point. In theory, going with the separately calculated neighbor normal vectors -which would require either an additional data buffer for normal vectors in memory or alternatively a 5 3 neighborhood which would break the multi-GPU capabilities of the code -should be more accurate, but our practical tests indicated no significant difference (see figure 5). Obtaining neighboring interface points: PLIC point neighborhood The set of points p i is then used to fit a local paraboloid. This paraboloid (figure 4e) here lacks a vertical offset parameter as that is handled already by the center point being defined as the origin, reducing computational cost to a LU-decomposition of dimensionality N = 5. The paraboloid has the form z(x, y) = Ax 2 + By 2 + Cxy + Hx + Iy =: x · Q (47) Validating Curvature Calculation To test the accuracy of the presented curvature calculation method, we validate it on spherical drops of different radius R = 1 κ theo . The fill levels ϕ are initialized with the inverse PLIC algorithm. To let the drop relax and the error converge, we simulate up to 50000 LBM time steps with D3Q19 SRT (τ = 1, σ = 0.001). The curvature error is calculated using the L 1 error norm with summation over all interface points: Validating Curvature Calculation We plot the error in figure 5. For low drop radius R < 32, the error of our proposed method (red curve) is around 0.5%. However as R is increased, the error also generally increases as a result of more interface points in the summation and increased likelihood that the deviation in curvature for some points is much larger than average. If we do not make the assumption that the PLIC normal direction of neighbor interface points has to equal the center normal vector (orange curve), then accuracy is slightly improved. However the additional computational complexity may not justify this small improvement in accuracy. Validating Curvature Calculation For comparison, we also plot the curvature approximation method proposed by Donath [16] without and with the proposed π 4 correction factor. As expected, the error is much larger, but this method is also computationally less expensive than ours and certainly has its use-cases as well. . For comparison, we provide the curvature approximation method proposed by Donath [16] in both its variants (green and blue). Application Example: Simulating a terminal Velocity Raindrop Impact The analytic plane-cube intersection solution presented in this work has originally been developed for the VoF-LBM GPU simulation code FluidX3D, where we could observe a significant speedup compared to when an iterative nested-intervals solution is used. To illustrate this particular application of PLIC, we show a simulation of a 5 mm diameter raindrop impact at terminal velocity in figure 6. The parameters for this simulation are Re = 35195, We = 5702, Fr = 41.54, Ca = 0.1620, Bo = 3.3042. The simulation code FluidX3D is documented in great detail in [6]. Conclusions We derived an analytic solution to the PLIC problem and compared it to the existing solution by Scardovelli and Zaleski [4] in two variants: an implementation by Kawano [5] and an improved and micro-optimized version thereof. We furthermore compared these three analytic solutions to two iterative solutions using Newton-Raphson and nested intervals. We provide OpenCL C implementations of all variants as well as the inverse PLIC formulation. We observed that in a synthetic benchmark scenario where AVX2 vectorization is available on the CPU, the Newton-Raphson solution (listing 6) is considerably faster than all other solutions because the analytic solutions require trigonometric functions which cannot be vectorized. Our benchmark calculated PLIC repeatedly in a loop. With FP32 and AVX2, every eight consecutive iterations are combined into one vectorized iteration, completing in far fewer clock cycles than the eight iterations separately would. In real-world applications however, PLIC is not computed repeatedly in multiples of eight, greatly limiting vectorization potential. Without vectorization, on both the CPU and GPU the analytic solutions are faster, with our micro-optimized version of the SZ solution as presented in listing 4 being fastest. For a generic PLIC problem, this is the solution we recommend. In the most common application of PLICcurvature calculation for Volume-of-Fluid LBM, which we presented and also validated on spherical drops -profiling revealed PLIC to be the main bottleneck regarding compute time. Here, our proposed fast PLIC solution led to significant speed up of VoF calculations. We hope that our findings will also make other simulation codes more computationally efficient. 12 (a) t = 0 ms (b) t = 1 ms (c) t = 2 ms (d) t = 3 ms (e) t = 4 ms (f) t = 5 ms Figure 6: A 5 mm diameter raindrop impacting a lake at 9.2 m s mean sea level pressure terminal velocity [31] and 10 • C water temperature simulated with the VoF-LBM GPU simulation code FluidX3D at a lattice resolution of 400 × 400 × 340 with the D3Q19 discretization and the SRT collision operator. The simulation box in SI-units has the dimensions 5.00 cm × 5.00 cm × 4.25 cm and the pool height is 2.00 cm. Compute time for this simulation is less than one minute on a single Nvidia Titan Xp GPU. Visualization is done with a custom GPU implementation of the marching cubes algorithm [32][33][34]. 13 Acknowledgements We gratefully acknowledge computing time provided by the SuperMUC system of the Leibniz Rechenzentrum, Garching. We further acknowledge support through the computational resources provided by the Bavarian Polymer Institute. We acknowledge the NVIDIA Corporation for donating a Titan Xp GPU for our research. Conflicts of interest The authors declare no potential conflicts of interests. Availability of data and material All data is archived and available upon request. Code availability All code beyond what is provided in the listings is archived and available upon request. Authors' contributions Analytic calculations were done by ML (section 2) and SG (section 3). ML did programming and testing. ML wrote the initial draft and created the illustrations. ML and SG did review and editing on the draft. Out [7]= d → -(-6) 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3 , d → 6 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3 , d → (-1) 2/3 6 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3    ϕ 1 + ϕ 7 + ϕ 9 + ϕ 13 + ϕ 15 + ϕ 19 + ϕ 21 + ϕ 23 + ϕ 26 ϕ 3 + ϕ 7 + ϕ 11 + ϕ 14 + ϕ 17 + ϕ 19 + ϕ 21 + ϕ 24 + ϕ 25 ϕ 5 + ϕ 9 + ϕ 11 + ϕ 16 + ϕ 18 + ϕ 19 + ϕ 22 + ϕ 23 + ϕ 25 FullSimplify[ComplexExpand[Re[f]]] mean curvature. The strategy for finding the required fitting parameters is to apply a least-squares fit on a neighborhood of points on the interface. Curvature from Least-Squares Paraboloid Fit The least-squares method [41] is a procedure for fitting an analytic curve -here a Monge patch -to a set of discretized points located nearby the analytic curve. The general idea is to define the total error as a general expression of all fitting parameters and the entire set of discretized points and then find its global minimum by zeroing its gradient. The analytic curve first needs to be written in a dot product form z(x, y) = x · Q (64) with x being defined as the vector of parameters that define the curve and Q = Q(x, y) being an expression of the continuous coordinates x and y. This equation is then discretized to a set of individual data points ( Curvature from Least-Squares Paraboloid Fit with Q i = Q i (x i , y i ) being a vector containing expressions only dependent on a discretized set of points (x i , y i ) whose corresponding z-component z i is located close to the curve. In this notation, the error E between the z-positions of the analytic curve x · Q and a set of z-positions of at least N neighboring interface points z i is defined by summing up the squared differences Curvature from Least-Squares Paraboloid Fit whereby N denotes the dimensionality which is equal to the number of desired fitting parameters. The gradient of the error E is calculated and set to zero, where the error must have a global minimum: Curvature from Least-Squares Paraboloid Fit With some algebra, this equation is then transformed into a linear equation Curvature from Least-Squares Paraboloid Fit which is solved by LU-decomposition and provides the desired solution x that uniquely defines the curve. Note that the matrix M is always symmetrical, meaning that only the upper half and diagonal have to be calculated explicitly and the lower half is copied over. This reduces computational cost significantly due to every matrix element being a sum over an expression depending on all fitted points. In case there are less than N data points available (lattice points next to solid boundaries may have less interface neighbors), the regular fitting will not work. Instead, then the amount of fitting parameters is decreased to match the number of available data points by reducing dimensionality in the LU-decomposition. The ignored fitting parameters will remain zero. Curvature from Least-Squares Paraboloid Fit Finally, from the solution vector x the constants defining the fitted curve are extracted and the curvature is calculated from them using equation (63).

섹션 본문 87문단 · 36,156자

(제목 없음)

1The plane-cube intersection problem has been around in literature since 1984 and iterative solutions to it have been used as part of piecewise linear interface construction (PLIC) in computational fluid dynamics simulation codes ever since. In many cases, PLIC is the bottleneck of these simulations regarding compute time, so a faster, analytic solution to the plane-cube intersection would greatly reduce compute time for such simulations. We derive an analytic solution for all intersection cases and compare it to the one previous solution from Scardovelli and Zaleski (Ruben Scardovelli and Stephane Zaleski. "Analytical relations connecting linear interfaces and volume fractions in rectangular grids". we further improve to include edge cases and micro-optimize to reduce arithmetic operations and branching. We then extend our comparison regarding compute time and accuracy to include two different iterative solutions as well. We find that the best choice depends on the employed hardware platform: on the CPU, Newton-Raphson is fastest with vectorization while analytic solutions perform better without. The reason for this is that vectorization instruction sets do not include trigonometric functions as used in the analytic solutions. On the GPU, the fastest method is our optimized version of the analytic SZ solution. We finally provide details on one of the applications of PLIC -curvature calculation for the Volume-of-Fluid model used for free surface fluid simulations in combination with the lattice Boltzmann method.

Introduction

2Piecewise linear interface construction (PLIC) -first occurring in literature for 2D in 1982 [1] and for 3D in 1984 [2] -refers to the problem of calculating the offset along the given normal vector of a plane intersecting a unit cube for a given truncated volume. There are five possible intersection cases (cf. figure 1), of which the numbers (1), (2) and (5) have been already solved in the original 1984 work by Youngs [2], but the cubic polynomial cases (3) and (4) -resigned as impossible to algebraically invert [3] -in the majority of literature are approximated by a Newton-Raphson iterative solution. Nevertheless, there does exist an analytic solution by Scardovelli and Zaleski (SZ) [4] and a single documented implementation thereof in Fortran [5] which also includes an approximative version termed APPLIC.

3Here, we formulate the PLIC problem from the ground up -first in the inverse direction -and derive an alternative analytic solution for all intersection cases by inverting the inverse formulation. We then compare our novel solution with (i) the original SZ solution, (ii) an improved and micro-optimized version of the SZ solution developed in the present work, (iii) an iterative solution using Newton-Raphson and (iv) an iterative solution using nested intervals. Depending on the available microarchitecture (GPU/CPU), vectorization may be available, which strongly favors multiplications and additions while not speeding up trigonometric functions, impacting which of the algorithms is fastest.

4Among the applications for PLIC are Volume-of-Fluid simulation codes such as FluidX3D [6,7] and others [8][9][10][11][12][13][14][15][16][17][18], often in conjunction with GPU implementations [6, 1 7, 19-25] of the lattice Boltzmann method [26][27][28], used for simulating free surface fluid flows. In particular, these simulations work on a cubic lattice with every lattice point having a fill level assigned to it and PLIC is used in the process of surface reconstruction during curvature calculation for calculating physical surface tension effects [6,8]. In the final section of this work, we provide a detailed overview on the state-of-the-art curvature calculation procedure using PLIC.

Plane-Cube Intersection

5Inputs to the PLIC algorithm are the truncated volume V 0 ∈ [0, 1] and the (normalized) normal vector of the plane n = (n x , n y , n z ) T , | n| = n 2

6x + n 2 y + n 2 z = 1. The desired output is the plane offset from the origin (center of the unit cube) along the normal vector d 0 V 0 , (n x , n y , n z ) T → d 0

7(1)

8]. The interval is determined by the normal vector orientation: depending on the normal vector, the maximum possible distance from the cube center to be still at least touching the cube in one point varies between 1 2 (normal vector parallel to one of the coordinate system axes) and √ 3 2 (normal vector along the space diagonal).

Applying symmetry conditions to reduce problem complexity

9To reduce the amount of possible cases and to avoid having to consider all possible intersections of the plane and cube edges -following the scheme in [2] and [14] 1 -the normal vector is component-wise mirrored into positive. The mirrored normal vector components are sorted ascending for their magnitude such that 0 ≤ n 1 ≤ n 2 ≤ n 3 ≤ 1. Because n is normalized, the absolute value of its largest component n 3 is always greater than zero.

10n 1 := min(|n x |, |n y |, |n z |) ≥ 0 (2) n 3 := max(|n x |, |n y |, |n z |) > 0 (3) n 2 := |n x | + |n y | + |n z | − n 1 − n 3 ≥ 0 (4)

11Since the function V 0 (d 0 ) is symmetric around d 0 = 0 and increasing monotonically, the reduced-symmetry-volume V ∈ [0, 1 2 ] is limited to the lower half of the intersection volume V 0 and the upper half is reconstructed from 1 We note that in [14] in equations (21) and (23) respectively the "+" should be a "−" and in equation (24) the ">" should be a "<". symmetry.

12This symmetry condition for the case V 0 > 1 2 is now applied to d 0 , and the coordinate origin is shifted from (0, 0, 0) (center of the unit cube) to (− 1 2 , − 1 2 , − 1 2 ) (bottom left corner in the back in fig. 1), resulting in the distance d ∈ [0, n1+n2+n3 2 ] in reduced symmetry space:

13With this reduction in symmetry, there are only five different intersection cases remaining (see figure 1).

142 (

15Figure 1: All possible intersection cases of a plane and a unit cube. The truncated volume of cases (1) to (4) is a tetrahedral pyramid with zero (1), one (2), two (3) or all three (4) corners extending outside of the unit cube being cut-off tetrahedral pyramids themselves.

Formulating the inverse PLIC problem

16In order to derive the analytic PLIC solution, first the inverse problem is formulated in equations -again following the scheme in [2]. In the inverse problem, the intersection volume is calculated from the plane offset and normal vector as inputs. At first, the intersection points s 1 , s 2 and s 3 of the plane with the coordinate system axes (see figure 1) are determined:

17Now one calculates the actual volume in reduced symmetry space. The approach is to calculate the volume of the tetrahedral pyramid formed by the plane and the coordinate system axes and, if necessary, subtract the volumes of zero, one, two or all three corners that extend beyond 1. For case (3), an additional condition is required to mutually exclude case (5), in which the bottom four corners of the cube are located beneath the plane.

18if s 2 ≥ 1 and s 3 ≤ 1 and s 1 (s 2 − 1) ≤ s 2

19To shorten equation (10), s 1 , s 2 and s 3 are substituted and the expression is simplified, yielding

20which is already quite a bit more friendly and completes the inverse PLIC formulation in conjunction with equations (2) to (4), (7) and (6). The condition for case (5) is the remaining free sector of the possible range of d mutually excluded by the other four cases. Listing 1 shows the fully optimized OpenCL C implementation of the inverse PLIC solution.

21float p l i c _ c u b e _ i n v e r s e ( const float d0 , const float3 n ) { // unit cube -→ plane intersection : plane offset d0 , normal vector n -> volume V0 → in [0 ,1] const float n1 = fmin ( fmin ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; // eliminate → most cases due to symmetry const float n3 = fmax ( fmax ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; const float n2 = fabs ( n . x ) -n1 + fabs ( n . y ) + fabs ( n . z ) -n3 ; const float d = 0.5 f * ( n1 + n2 + n3 ) -fabs ( d0 ) ; // calculate PLIC with reduced → symmetry , shift origin from (0.0 ,0.0 ,0.0) -> (0.5 ,0.5 ,0.5) float V ; // 0.0 <= V <=0.5 if ( fmin ( n1 + n2 , n3 ) <= d && d <= n3 ) { // case (5) V = ( d -0.5 f * ( n1 + n2 ) ) / n3 ; // avoid division by n1 and n2

22) -cb ( fdim (d , n3 ) ) ) /(6.0 f * n1 * n2 * n3 ) ; } return copysign (0.5 f -V , d0 ) +0.5 f ; // apply symmetry for V0 >0.5 } Listing 1: Fully optimized OpenCL C implementation of the inverse PLIC solution. To avoid branching between cases (3) and (4), in the implementation the fdimf(x,y):=max(x-y,0) function is used. Case (2) cannot be included with another fdimf(x,y) because in case (2) division by n 1 must be avoided since it could be zero.

Inverting the inverse PLIC Formulation analytically

23Equation (11) is now inverted for each case individually. Cases (1), (2) and (5) are easy, but cases (3) and (4) are non-trivial third order polynomials. Here we make use of the tool Mathematica, which outputs three complex solutions for cases (3) and (4) each (section 9), of which the third solutions respectively are the right ones as their imaginary parts in the desired range are zero after simplification. Luckily, both are of the same overall form (eq. (13)). However, a complex solution is not useful here since the expected result is a real number -a problem known as the casus irreducibilis -and most programming languages cannot deal with complex numbers natively. It would also lead to unwanted computational overhead to carry along the imaginary part during computation, which in the end will be zero anyway. To overcome this, we again make use of Mathematica to simplify the general form of the complex solution (eq. (13)) in order to obtain the real, trigonometric solution, which is then even further simplified using the trigonometric identity √ 3 sin(α)−cos(α) = −2 sin( π 6 −α) such that the number of trigonometric functions (which are computationally expensive compared to simpler operations such as additions or multiplications) is minimized (eq. (12)).

24For better readability, a few expressions are pre-defined. Hereby the normalization condition n 2 1 + n 2 2 + n 2 3 = 1 is applied.

25t 4 := 9 (n 1 + n 2 + n 3 ) 2 − 18 (19) x 4 := 324 n 1 n 2 n 3 (1 − 2 V ) ≥ 0 (20)

26Finally then, the complete analytic solution to the 3D PLIC problem is given by

274 in conjunction with equations (2) to (4), (5), (8), (12) and (14) to (24).

28In equation (25) it is noteworthy that the conditions for the five different cases are determined a posteriori by the result itself. This means that each case has to be evaluated successively and for the resulting value d the respective condition has to be tested. If the condition is true, calculation is stopped and d is returned. If the condition is false, the next case has to be evaluated and so on, until the last case is reached.

29The order in which the cases are computed and checked can be optimized to calculate the most difficult and infrequent cases last, when the probability is high that one of the easier and more frequent cases has already been chosen. 'Frequent' here refers to some cases appearing more often than others with randomized V 0 and n as expected in typical PLIC applications. Here also special considerations for edge cases (more on that below) need to be taken into account to avoid possible divisions by zero. With this in mind, the order (5)→(2)→(1)→(3)→(4) is preferred.

30Additional speedup can be gained by noting that the implicit condition involving d can be replaced by an explicit condition involving V for cases (1), (2) and (5):

31Since V is known, these conditions are checked a priori in order to avoid root function calls if the condition is false.

32For even more speedup, all redundant mathematical operations are reduced to a minimum by pre-calculating them to variables (micro-optimization) and condition checks mutually excluded by previous checks are skipped, especially all conditions for the very last case. In the implementation order (5) → (2) → (1) → (3) → (4) the conditions for case (3) simplify to d 3 ≤ n 3 , which will mutually exclusive decide between cases (3) and (4). Since both d 3 and d 4 are very complicated expressions, here no simplified a priori condition is formulated.

33In equations (19), (21) and (25), the argument of the square root may be negative before the case condition is tested. In this case -since in the actual code, floatingpoint exception handling is turned off for performance reasons -the resulting NaN of a square root of a negative number would not be captured in the case condition, leading to a wrong result. An additional fdim function call in the square root solves this issue. In the implementation, we artificially exclude the edge case x 4 = 0 in order to instead of atan2(y, x) use the faster atan(y/x), giving the algorithm a 15% speedup. In case branching would be undesirable, bit masking is also an option, but bit masking turned out to be slower even on GPUs.

34Two edge cases still need to be taken into careful consideration: n 1 = 0 (2D) and n 3 = 1 (1D). n 1 = 0 restricts n to be in a 2D plane of two coordinate system axes and n 3 = 1 restricts n to be parallel to one of the coordinate system axes. For the (1D) case, n 3 = 1 and the solution is always (5), so n 1 = n 2 = 0 and min(n 1 + n 2 , n 3 ) = 0, simplifying equation (25) without loss of generality to

35A clean derivation of the 1D case yields

36without any conditions, so it is a necessary requirement that both additional conditions in eq. (27) must be fulfilled automatically. d is in the range 0 ≤ d ≤ n1+n2+n3 2

37, so here in the special case we have 0 ≤ d ≤

38In the (2D) case, n 1 = 0 (n 2 = 0 is excluded here since it is already covered in the (1D) case, so here n 2 > 0). Here only intersection cases (2) or (5) are possible, 0 < n 2 ≤ n 3 ≤ 1 and min(n 1 + n 2 , n 3 ) = n 2 , simplifying eq. (25) without loss of generality to

39A clean derivation of the 2D case yields

40which has simpler conditions, so again it is a necessary requirement that both additional conditions in eq.

(29) must be fulfilled automatically. d is in the range

41, so here with the special conditions we have 0 ≤ d ≤ 0+n2+n3 2 ≤ n3+n3 2 = n 3 , meaning that both 0 ≤ d and d ≤ n 3 are indeed fulfilled automatically.

42In the above chosen (5) → (2) → (1) → (3) → (4) implementation order, the 1D and 2D special cases are already covered in (5) and (2) at the beginning, so they both are excluded in the remaining intersection cases (1), (3) and (4), meaning that there n 1 , n 2 , n 3 > 0 are always given, resulting in x 3 > 0 in equation (14).

43Listing 2 shows the fully optimized OpenCL C implementation of the analytic PLIC solution with equation (26).

44→ * sin (0.5235988 f -0.33333334 f * atan ( sqrt ( y42 ) / x4 ) ) ; // x4 >0 return d4 ; // case (4) } float plic_cube ( const float V0 , const float3 n ) { // unit cube -plane → intersection : volume V0 in [0 ,1] , normal vector n -> plane offset → d0 const float ax = fabs ( n . x ) , ay = fabs ( n . y ) , az = fabs ( n . z ) , V =0.5 f -fabs ( V0 -0.5 f ) → ; // eliminate symmetry cases const float n1 = fmin ( fmin ( ax , ay ) , az ) ; const float n3 = fmax ( fmax ( ax , ay ) , az ) ; const float n2 = ax -n1 + ay + az -n3 ; const float d = p l i c _ c u b e _ r e d u c e d (V , n1 , n2 , n3 ) ; // calculate PLIC with → reduced symmetry return copysign (0.5 f * ( n1 + n2 + n3 ) -d , V0 -0.5 f ) ; // apply symmetry for V0 >0.5 } Listing 2: Fully optimized OpenCL C implementation of our analytic PLIC solution.

The analytic SZ solution

45The analytic PLIC solution by Scardovelli and Zaleski from 2000 [4] has been implemented in Fortran in 2016 by Kawano [5] where it is used as comparison to the approximative APPLIC method. Here we focus on the exact SZ solution. The SZ solution is particularly interesting in that it builds upon the L 1 -normalized plane normal vector instead of the more common L 2 normalization as used in our own solution in section 2.3. We first translate the Fortran implementation to OpenCL C, make it compatible with an L 2 -normalized plane normal vector as input and rescale the result from the original [0, 1] to [− ]. The implementation is provided in listing 3.

46float plic_cube ( const float V0 , const float3 n ) { // unit cube -plane → intersection : volume V0 in [0 ,1] , normal vector n -> plane offset → d0 const float l = fabs ( n . x ) + fabs ( n . y ) + fabs ( n . z ) ; // length in L1 norm const float ax = fabs ( n . x ) /l , ay = fabs ( n . y ) /l , az = fabs ( n . z ) /l , w =0.5 f -fabs ( V0 → -0.5 f ) ; // eliminate symmetry cases const float vm1 = fmin ( fmin ( ax , ay ) , az ) ; const float vm3 = fmax ( fmax ( ax , ay ) , az ) ; const float vm2 = fdim (1.0 f , vm1 + vm3 ) ; // ensure vm2 >=0 const float vm12 = vm1 + vm2 ; float alpha = 0.0 f ; const float v1 = sq ( vm1 ) /(6.0 f * vm2 * vm3 +1 E -25 f ) ; const float w6 = 6.0 f * vm1 * vm2 * vm3 * w ;

477037037 E -2 f = 1/27 const float sp = sqrt (0.11111111 f * sq ( a2 ) -0.33333334 f * a1 ) ; alpha = 2.0 f * sp * cos (4.1887902 f +0.33333334 f * acos ( q0 / cb ( sp ) ) ) -0.33333334 → f * a2 ; // 4.1887902 f = 4/3 * pi } } return l * copysign (0.5 f -alpha , V0 -0.5 f ) ; // rescale result and apply → symmetry for V0 >0.5 } Listing 3: The Fortran implementation [5] of the analytic SZ PLIC solution [4] translated to OpenCL C without further optimization.

48When closely studying the implementation in listing 3, we notice that the 1D edge case is poorly handled despite the addition of a tiny constant to the denominator for the calculation of v1. In the edge cases of the normal vector n = (1, 0, 0) T and the volume V 0 ∈ {0, 1}, the algorithm returns -NaN both in our OpenCL and in the original Fortran implementation. By checking cases (5) and (2) first and by avoiding divisions by vm1 and vm2 before the checks for cases (5) and (2) respectively, we improve handling of the 1D edge case. We further apply some micro-optimization to significantly reduce the number of arithmetic operations, resulting in an optimized implementation of the SZ solution shown in listing 4 below.

Iterative Solutions

49For comparison, we also provide iterative solutions using nested intervals in listing 5 and Newton-Raphson in listing 6. d -= f / fs ; } return d ; // case (4) } float plic_cube ( const float V0 , const float3 n ) { const float n1 = fmin ( fmin ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; // eliminate → most cases due to symmetry const float n3 = fmax ( fmax ( fabs ( n . x ) , fabs ( n . y ) ) , fabs ( n . z ) ) ; const float n2 = fabs ( n . x ) -n1 + fabs ( n . y ) + fabs ( n . z ) -n3 ; const float V = 0.5 f -fabs ( V0 -0.5 f ) ; const float d = p l i c _ c u b e _ r e d u c e d (V , n1 , n2 , n3 ) ; return copysign (0.5 f * ( n1 + n2 + n3 ) -d , V0 -0.5 f ) ; // apply symmetry for V0 >0.5 } Listing 6: OpenCL C implementation of the iterative Newton-Raphson solution for cases (1), (3) and (4). Calculating case (1) with Newton-Raphson as well instead of the cbrt() function results in a very small, but noticeable improvement in performance when executed on the CPU with AVX2 vectorization.

Performance and Accuracy Comparison

50Apart from floating-point errors, the SZ solution in listing 4 and our own solution in listing 2 produce identical results. For accuracy comparison, we define the error as

51with plic cube inverse(d 0 , n i ) referring to the implementation in listing 1 and plic cube(V 0 , n i ) referring to the various PLIC implementations. We define the average error as follows:

52The execution time for a 'blank run'

53containing the time for memory loads and stores as well as compute time for the inverse PLIC algorithm is measured and later subtracted from the execution times of the different PLIC variants in order to isolate their execution time. The time is also divided by the number of PLIC function evaluations (N L) in order to obtain the time for a single execution.

CPU Testing

54In this test, n i is set to N = 4096 different normal vectors, of which one is (1, 0, 0) T , one is ( 1 When AVX2 vectorization is available, Newton-Raphson is considerably faster than all the other solutions. However we note that our benchmark is a particularly synthetic scenario where vectorization is easily achievable for the compiler: The benchmark just calculates PLIC repeatedly in a loop. With FP32 and AVX2, every eight consecutive iterations are combined into one vectorized iteration, completing in far fewer clock cycles than the eight iterations separately would. In realworld applications, PLIC is not computed repeatedly in multiples of eight, greatly limiting vectorization potential such that the strict criteria for auto-vectorization [29] might not be met. Surprisingly, our analytic solution and the optimized SZ solution are within margin of error regarding compute time.

55In the edge cases of the normal vector n = (1, 0, 0) T and the volume V 0 ∈ {0, 1}, the SZ solution by Kawano returns -NaN, which propagates through the entire error averaging procedure. For the IEEE-754 FP32 floatingpoint format, the machine epsilon is at = 5.96 · 10 −8 , meaning that for all other PLIC variants the average error E avg is within machine precision. Without compiler optimization (/Od, /Qpar-), the execution time results are very different as shown in table 2. With AVX2 vectorization not available, Newton-Raphson considerably falls behind the analytic solutions.

GPU Testing

56Since in many applications the target platform for the PLIC algorithm is the GPU, we also benchmark the different variants in OpenCL on an Nvidia Titan Xp GPU (3840 CUDA cores at 1582 MHz, driver version 442.59, OpenCL 1.2). The test here differs from the CPU C++ test in that for sufficient saturation of the parallel compute capabilities, the number of random normal vectors is increased to 67108864, of which again one is (1, 0, 0) T , one is ( 1 √ 2 , 1 √ 2 , 0) T , 8388606 are random 2D directions in the x-y-plane and the remaining 58720256 are random 3D directions. For these normal vectors, PLIC is run in parallel and for each of them, the volume V 0 is varied in the interval [0, 1] -edge cases included -in L = 256 equally spaced steps in series. For more accurate results through averaging, this test is run 64 times and the mean execution time is averaged and divided by the number of parallel and serial PLIC computations, resulting in an average compute time of more than three magnitudes shorter than for single-core CPU execution as listed in table 3 below. Even though the tests are designed differently for the CPU and GPU, this comparison is appropriate because in both cases the same algorithms are computed and the hardware is fully saturated. The table also includes the number of arithmetic operations (floating-point, integer and bit operations combined) N a and the number of branching operations N b in PTX assembly [30]. GPUs are especially bad at branching, so a small N b is desired. These operation counts -in analogy to the compute time -refer to the isolated PLIC variants with the background 'blank run' for memory loads and stores as well as the inverse PLIC algorithm subtracted. N a indicates that Newton-Raphson is unrolled by the compiler whereas nested intervals is not. The number of iterations to reach machine precision for nested intervals depends on the initial interval width, which is a function of the normal vector components. For Newton-Raphson, the number of branching operations N b is smallest, resulting in rather good performance. Nevertheless, our optimized implementation of the SZ solution pulls ahead rather significantly and thus is preferred by us.

Plane-Sphere Intersection

57The PLIC problem can be extended to spherical cells with unit volume (see figure 2):

58The offset along the plane normal vector is the desired result while the truncated volume is given. Since we have a sphere, the normal vector direction of the plane is irrelevant.

59Calculating the inverse PLIC (getting the volume V 0 from a given offset d 0 ∈ [−r, r]) is straight-forward and covered by the 'spherical cap' equation:

60Calculating the inverse function of the above equation again is quite difficult due to it being a third order polynomial with three complex solutions, but by using the same trick as in the plane-cube intersection case (equations (12) and (13)), this real expression is obtained: Volume-of-Fluid (VoF) is a model to simulate a sharp, freely moving interface between a fluid and gas phase in a Cartesian lattice [8][9][10][11]. While it can be coupled to any flow solver, here we focus on its usage in conjunction with the Lattice-Boltzmann-method (LBM). The interface is ensured to be exactly one lattice cell thick at any time (illustrated in figure 3). As an indicator for each lattice point type, the fill level ϕ is introduced, whereby for fluid lattice points ϕ = 1, for interface 1 > ϕ > 0 and for gas ϕ = 0:

61Here ρ is the density provided by the lattice Boltzmann method (LBM) and m is the fluid mass. m is a conserved quantity and cannot be gained or lost, only moved within the simulation box. The key difficulty of modeling a free surface on a discretized lattice is to obtain the surface curvature, which is a necessary ingredient for calculating the surface tension via the Young-Laplace pressure

62with κ = 1 R denoting the local mean curvature and σ denoting the surface tension parameter of the simulated fluid. The equation is easy in principle, but calculating κ from the discretized interface geometry is not. Specifically, discretized interface here means that only a local 3 3 neighborhood of fill levels ϕ ∈ [0, 1] is known in addition to the point in the center of this neighborhood being an interface lattice point.

63The most common algorithm in literature [8,11] is the curvature calculation via a least-squares paraboloid fit from a neighborhood of points located on the interface. It assumes the local interface to be a paraboloid, the specifics of which will be given in the following sections.

64Finding an appropriate set of neighboring points on the interface requires the PLIC solution.

Obtaining neighboring interface points: PLIC point neighborhood

65Piecewise linear interface construction works on a 3 3 neighborhood of an interface lattice point (illustrated in 2D in figure 4a). Within this neighborhood, only interface points other than the center interface pointwhich is always interface -are considered as candidates for the later fitting procedure (figure 4b). The difficult part is to accurately obtain the heights z i of at least five neighboring points located on the true interface (figure 4c). For this, first the normal vector n of the center interface point is calculated via the Parker-Youngs approximation as described in the appendix 10.1 in eq. (54). A new coordinate system is introduced with its first base vector b z defined as this normal vector. Then, the cross product with an arbitrary vector such as r := (0.56270900, 0.32704452, 0.75921047) T

66which is always non-colinear with b z just by random chance is calculated to provide second and third orthonormal vectors

67forming the new coordinate system in which the z-axis is colinear with the surface normal and the center interface point is in the origin. Now the relative positions e i (equal to the D3Q27 LBM streaming directions, eq. (53)) of all neighboring interface lattice points are gathered and transformed into the rotated coordinate system. During this step, the approximate interface position of neighboring interface points (streaming directions, figure 4b) is corrected to the much more accurate interface

68Here i is only the subset of {0, .., 26} for which 0 < ϕ i < 1 is true (interface points). d 0 (V 0 = ϕ i , n) denotes the PLIC function (equation (8)). Note that d 0 (V 0 = ϕ 0 , n) only needs to be calculated once while d 0 (V 0 = ϕ i , n) has to be calculated for each neighboring interface point and that the normal vectors of neighboring interface lattice points are approximated to be equal to the normal vector of the center lattice point. In theory, going with the separately calculated neighbor normal vectors -which would require either an additional data buffer for normal vectors in memory or alternatively a 5 3 neighborhood which would break the multi-GPU capabilities of the code -should be more accurate, but our practical tests indicated no significant difference (see figure 5).

69The set of points p i is then used to fit a local paraboloid. This paraboloid (figure 4e) here lacks a vertical offset parameter as that is handled already by the center point being defined as the origin, reducing computational cost to a LU-decomposition of dimensionality N = 5. The paraboloid has the form z(x, y) = Ax 2 + By 2 + Cxy + Hx + Iy =: x · Q (47)

Validating Curvature Calculation

70To test the accuracy of the presented curvature calculation method, we validate it on spherical drops of different radius R = 1 κ theo . The fill levels ϕ are initialized with the inverse PLIC algorithm. To let the drop relax and the error converge, we simulate up to 50000 LBM time steps with D3Q19 SRT (τ = 1, σ = 0.001). The curvature error is calculated using the L 1 error norm with summation over all interface points:

71We plot the error in figure 5. For low drop radius R < 32, the error of our proposed method (red curve) is around 0.5%. However as R is increased, the error also generally increases as a result of more interface points in the summation and increased likelihood that the deviation in curvature for some points is much larger than average. If we do not make the assumption that the PLIC normal direction of neighbor interface points has to equal the center normal vector (orange curve), then accuracy is slightly improved. However the additional computational complexity may not justify this small improvement in accuracy.

72For comparison, we also plot the curvature approximation method proposed by Donath [16] without and with the proposed π 4 correction factor. As expected, the error is much larger, but this method is also computationally less expensive than ours and certainly has its use-cases as well. . For comparison, we provide the curvature approximation method proposed by Donath [16] in both its variants (green and blue).

Application Example: Simulating a terminal Velocity Raindrop Impact

73The analytic plane-cube intersection solution presented in this work has originally been developed for the VoF-LBM GPU simulation code FluidX3D, where we could observe a significant speedup compared to when an iterative nested-intervals solution is used. To illustrate this particular application of PLIC, we show a simulation of a 5 mm diameter raindrop impact at terminal velocity in figure 6. The parameters for this simulation are Re = 35195, We = 5702, Fr = 41.54, Ca = 0.1620, Bo = 3.3042. The simulation code FluidX3D is documented in great detail in [6].

Conclusions

74We derived an analytic solution to the PLIC problem and compared it to the existing solution by Scardovelli and Zaleski [4] in two variants: an implementation by Kawano [5] and an improved and micro-optimized version thereof. We furthermore compared these three analytic solutions to two iterative solutions using Newton-Raphson and nested intervals. We provide OpenCL C implementations of all variants as well as the inverse PLIC formulation. We observed that in a synthetic benchmark scenario where AVX2 vectorization is available on the CPU, the Newton-Raphson solution (listing 6) is considerably faster than all other solutions because the analytic solutions require trigonometric functions which cannot be vectorized. Our benchmark calculated PLIC repeatedly in a loop. With FP32 and AVX2, every eight consecutive iterations are combined into one vectorized iteration, completing in far fewer clock cycles than the eight iterations separately would. In real-world applications however, PLIC is not computed repeatedly in multiples of eight, greatly limiting vectorization potential. Without vectorization, on both the CPU and GPU the analytic solutions are faster, with our micro-optimized version of the SZ solution as presented in listing 4 being fastest. For a generic PLIC problem, this is the solution we recommend. In the most common application of PLICcurvature calculation for Volume-of-Fluid LBM, which we presented and also validated on spherical drops -profiling revealed PLIC to be the main bottleneck regarding compute time. Here, our proposed fast PLIC solution led to significant speed up of VoF calculations. We hope that our findings will also make other simulation codes more computationally efficient.

12

75(a) t = 0 ms (b) t = 1 ms (c) t = 2 ms (d) t = 3 ms (e) t = 4 ms (f) t = 5 ms Figure 6: A 5 mm diameter raindrop impacting a lake at 9.2 m s mean sea level pressure terminal velocity [31] and 10 • C water temperature simulated with the VoF-LBM GPU simulation code FluidX3D at a lattice resolution of 400 × 400 × 340 with the D3Q19 discretization and the SRT collision operator. The simulation box in SI-units has the dimensions 5.00 cm × 5.00 cm × 4.25 cm and the pool height is 2.00 cm. Compute time for this simulation is less than one minute on a single Nvidia Titan Xp GPU. Visualization is done with a custom GPU implementation of the marching cubes algorithm [32][33][34]. 13

Acknowledgements

76We gratefully acknowledge computing time provided by the SuperMUC system of the Leibniz Rechenzentrum, Garching. We further acknowledge support through the computational resources provided by the Bavarian Polymer Institute. We acknowledge the NVIDIA Corporation for donating a Titan Xp GPU for our research.

Conflicts of interest

77The authors declare no potential conflicts of interests.

Availability of data and material

78All data is archived and available upon request.

Code availability

79All code beyond what is provided in the listings is archived and available upon request.

Authors' contributions

80Analytic calculations were done by ML (section 2) and SG (section 3). ML did programming and testing. ML wrote the initial draft and created the illustrations. ML and SG did review and editing on the draft. Out [7]= d → -(-6) 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3 , d → 6 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3 , d → (-1) 2/3 6 1/3 V 1/3 n 1 1/3 n 2 1/3 n 3 1/3    ϕ 1 + ϕ 7 + ϕ 9 + ϕ 13 + ϕ 15 + ϕ 19 + ϕ 21 + ϕ 23 + ϕ 26 ϕ 3 + ϕ 7 + ϕ 11 + ϕ 14 + ϕ 17 + ϕ 19 + ϕ 21 + ϕ 24 + ϕ 25 ϕ 5 + ϕ 9 + ϕ 11 + ϕ 16 + ϕ 18 + ϕ 19 + ϕ 22 + ϕ 23 + ϕ 25

FullSimplify[ComplexExpand[Re[f]]]

81mean curvature. The strategy for finding the required fitting parameters is to apply a least-squares fit on a neighborhood of points on the interface.

Curvature from Least-Squares Paraboloid Fit

82The least-squares method [41] is a procedure for fitting an analytic curve -here a Monge patch -to a set of discretized points located nearby the analytic curve. The general idea is to define the total error as a general expression of all fitting parameters and the entire set of discretized points and then find its global minimum by zeroing its gradient. The analytic curve first needs to be written in a dot product form z(x, y) = x · Q (64) with x being defined as the vector of parameters that define the curve and Q = Q(x, y) being an expression of the continuous coordinates x and y. This equation is then discretized to a set of individual data points (

83with Q i = Q i (x i , y i ) being a vector containing expressions only dependent on a discretized set of points (x i , y i ) whose corresponding z-component z i is located close to the curve. In this notation, the error E between the z-positions of the analytic curve x · Q and a set of z-positions of at least N neighboring interface points z i is defined by summing up the squared differences

84whereby N denotes the dimensionality which is equal to the number of desired fitting parameters. The gradient of the error E is calculated and set to zero, where the error must have a global minimum:

85With some algebra, this equation is then transformed into a linear equation

86which is solved by LU-decomposition and provides the desired solution x that uniquely defines the curve. Note that the matrix M is always symmetrical, meaning that only the upper half and diagonal have to be calculated explicitly and the lower half is copied over. This reduces computational cost significantly due to every matrix element being a sum over an expression depending on all fitted points. In case there are less than N data points available (lattice points next to solid boundaries may have less interface neighbors), the regular fitting will not work. Instead, then the amount of fitting parameters is decreased to match the number of available data points by reducing dimensionality in the LU-decomposition. The ignored fitting parameters will remain zero.

87Finally, from the solution vector x the constants defining the fitted curve are extracted and the curvature is calculated from them using equation (63).

참고문헌 42건

  1. Elementary Differential Geometry Springer undergraduate mathematics series · 2001 10.1007/978-1-4471-3696-5
  2. The mathematical theory of non-uniform gases : an account of the kinetic theory of viscosity, thermal conduction, and diffusion in gases University Press eBooks · University Press · 1970
  3. A VOF-based method for the simulation of thermocapillary flow Bulletin of the American Physical Society · Cambridge University Press · 2010
  4. Visualization and Analysis‐Oriented Reconstruction of Material Interfaces Computer Graphics Forum · Wiley · 2010 10.1111/j.1467-8659.2009.01671.x
  5. Analytical Relations Connecting Linear Interfaces and Volume Fractions in Rectangular Grids Journal of Computational Physics · Elsevier BV · 2000 10.1006/jcph.2000.6567
  6. Modern Differential Geometry of Curves and Surfaces with Mathematica 2006
  7. On enhanced non-linear free surface flow simulations with a hybrid LBM–VOF model Computers & Mathematics with Applications · Elsevier BV · 2012 10.1016/j.camwa.2012.05.012
  8. An improved three-dimensional model for interface pressure calculations in free-surface flows International journal of computational fluid dynamics · Taylor & Francis · 2007 10.1080/10618560701440915
  9. Ejecting performance simulation of an innovative piezoelectric actuated lubrication generator for space mechanisms International Journal of Mechanical Sciences · Elsevier BV · 2011 10.1016/j.ijmecsci.2011.07.009
  10. Optimized implementation of the Lattice Boltzmann Method on a graphics processing unit towards real-time fluid simulation Computers & Mathematics with Applications · Elsevier BV · 2013 10.1016/j.camwa.2013.10.002
  11. Lattice Boltzmann Model for Free Surface Flow for Modeling Foaming Journal of Statistical Physics · Springer Science+Business Media · 2005 10.1007/s10955-005-8879-8
  12. Free-Surface Lattice-Boltzmann Simulation on Many-Core Architectures Procedia Computer Science · Elsevier BV · 2011 10.1016/j.procs.2011.04.104
  13. An accurate adaptive solver for surface-tension-driven interfacial flows Journal of Computational Physics · Elsevier BV · 2009 10.1016/j.jcp.2009.04.042
  14. Numerical simulation of film boiling on a sphere with a volume of fluid interface tracking method International Journal of Heat and Mass Transfer · Elsevier BV · 2007 10.1016/j.ijheatmasstransfer.2007.07.037
  15. Free surface lattice Boltzmann with enhanced bubble model Computers & Mathematics with Applications · Elsevier BV · 2013 10.1016/j.camwa.2013.06.007
  16. Comparison of different propagation steps for lattice Boltzmann methods Computers & Mathematics with Applications · Elsevier BV · 2012 10.1016/j.camwa.2012.05.002
  17. LBM based flow simulation using GPU computing processor Computers & Mathematics with Applications · Elsevier BV · 2009 10.1016/j.camwa.2009.08.052
  18. A new approach to the lattice Boltzmann method for graphics processing units Computers & Mathematics with Applications · Elsevier BV · 2010 10.1016/j.camwa.2010.01.054
  19. Bubble creation and multi-fluids interaction 2009 10.1109/cadcg.2009.5246926
  20. Verification of surface tension in the parallel free surface lattice Boltzmann method in waLBerla Computers & Fluids · Elsevier BV · 2011 10.1016/j.compfluid.2010.12.027
  21. Focal surfaces of discrete geometry Symposium on Geometry Processing · 2007 10.5555/1281991.1281994
  22. Lattice Boltzmann‐based single‐phase method for free surface tracking of droplet motions International Journal for Numerical Methods in Fluids · Wiley · 2006 10.1002/fld.1282
  23. Memory transfer optimization for a lattice Boltzmann solver on Kepler architecture nVidia GPUs Computer Physics Communications · Elsevier BV · 2014 10.1016/j.cpc.2014.06.003
  24. Effects of Altitude on Maximum Raindrop Size and Fall Velocity as Limited by Collisional Breakup Journal of the Atmospheric Sciences · American Meteorological Society · 2012 10.1175/jas-d-12-0100.1
  25. Marching cubes: A high resolution 3D surface construction algorithm 1987 10.1145/37401.37422
  26. A simple volume-of-fluid reconstruction method for three-dimensional two-phase flows Computers & Fluids · Elsevier BV · 2016 10.1016/j.compfluid.2016.05.014
  27. Curvature estimation from a volume-of-fluid indicator function for the simulation of surface tension and wetting with a free-surface lattice Boltzmann method Physical review. E · American Physical Society · 2016 10.1103/physreve.93.043302
  28. The Lattice Boltzmann Method: Principles and Practice 2017 10.1007/978-3-319-44649-3
  29. Accuracy and Numerical Stabilty Analysis of Lattice Boltzmann Method with Multiple Relaxation Time for Incompressible Flows Journal of Physics Conference Series · IOP Publishing · 2017 10.1088/1742-6596/877/1/012035
  30. GPU Data Access on Complex Geometries for D3Q19 Lattice Boltzmann Method 2022 IEEE International Parallel and Distributed Processing Symposium (IPDPS) · 2018 10.1109/ipdps.2018.00092
  31. A LATTICE BOLTZMANN APPROACH FOR THREE-DIMENSIONAL TSUNAMI SIMULATION BASED ON THE PLIC-VOF METHOD Coastal Engineering Proceedings · Coastal Engineering Research Council · 2018 10.9753/icce.v36.papers.90
  32. Time-Dependent Multi-Material Flow with Large Fluid Distortion 1982
  33. Hardware-effiziente, hochparallele Implementierungen von Lattice-Boltzmann-Verfahren für komplexe Geometrien 2016
  34. NPLIC: A Machine Learning Approach to Piecewise Linear Interface Construction arXiv (Cornell University) · Cornell University · 2020 10.1016/j.compfluid.2021.104950
  35. High Performance Free Surface LBM on GPUs 2021 10.15495/epub_ubt_00005400
  36. MPI-based multi-GPU extension of the Lattice Boltzmann Method 2019 10.15495/epub_ubt_00005689
  37. Tracing the horizontal transport of microplastics on rough surfaces Microplastics and Nanoplastics · Springer Nature · 2021 10.1186/s43591-021-00010-2
  38. Modeling of solitary wave interaction with emerged porous breakwater using PLIC-VOF method Ocean Engineering · Elsevier BV · 2021 10.1016/j.oceaneng.2021.110041
  39. Ejection of marine microplastics by raindrops: a computational and experimental study Microplastics and Nanoplastics · Springer Nature · 2021 10.1186/s43591-021-00018-8
  40. Marching cubes: A high resolution 3D surface construction algorithm ACM SIGGRAPH Computer Graphics · ACM SIGGRAPH · 1987 10.1145/37402.37422
  41. The Lattice Boltzmann Method Graduate texts in physics · Springer Nature · 2016 10.1007/978-3-319-44649-3
  42. Elementary Differential Geometry Springer undergraduate mathematics series · 2010 10.1007/978-1-84882-891-9