Social Media

A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation

A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation
of 11
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
  EUROGRAPHICS 2015 / O. Sorkine-Hornung and M. Wimmer(This is an author copy, the definite version is available at and Volume 34  ( 2015 ),  Number 2 A Cut-Cell Geometric Multigrid Poisson Solver for FluidSimulation Daniel Weber  1 , Johannes Mueller-Roemer  †  1 , André Stork  1 and Dieter Fellner 1 , 2 1 TU Darmstadt & Fraunhofer IGD, Germany 2 Institut für ComputerGraphik & WissensVisualisierung, TU Graz, Austria Figure 1: Three frames from a simulation of smoke flowing past a sphere on a 256 × 512 × 256 grid. Abstract We present a novel multigrid scheme based on a cut-cell formulation on regular staggered grids which generatescompatible systems of linear equations on all levels of the multigrid hierarchy. This geometrically motivated  formulation is derived from a finite volume approach and exhibits an improved rate of convergence compared to previous methods. Existing fluid solvers with voxelized domains can directly benefit from this approach by onlymodifying the representation of the non-fluid domain. The necessary building blocks are fully parallelizable and can therefore benefit from multi- and many-core architectures. Categories and Subject Descriptors  (according to ACMCCS) : I.3.5 [Computer Graphics]: Computational Geome-try and Object Modeling—Physically based modeling I.3.7[Computer Graphics]: Three-Dimensional Graphics and Re-alism —Animation 1. Introduction Efficient simulation of fluids remains a challenging prob-lem in the field of computer graphics. In order to repro-duce small and large scale phenomena, a large number of degrees of freedom is required. We target applications that † the two primary authors contributed equally to this work use structured, orthogonal and equidistant staggered grids,first introduced to the computer graphics community by Fos-ter and Metaxas [FM96], with semi-Langrangian advection(see [Sta99]). At the core of this well-known and widespreadmethod the pressure projection step requires the solutionof a large system of linear equations. This is computa-tionally intensive and typically takes most of each simula-tion step’s duration. Many authors (see, e.g., [Bri08]) usean incomplete Cholesky preconditioned conjugate gradient(ICCG) method, which is ill-suited for parallel implemen-tations as back substitution is difficult to parallelize. Morerecent works use multigrid methods for pressure projectionas a preconditioner [MST10], using a variational discretiza-tion [CM11a, CM11b] or using an adaptive finite element submitted to EUROGRAPHICS 2015.  2  D. Weber et al. / A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation discretization for very large simulations [FWD14].We construct a geometric multigrid scheme based onthe cut-cell method proposed by Ng et al. [NMG09] thatproduces consistent mesh hierarchies, simple coarseningschemes and symmetric matrices on every level. This in turnleads to improved convergence for Neumann boundary con-ditions. Additionally, we address how to handle Dirichletboundary conditions in a cut-cell finite volume approach,which are only first order accurate but maintain symmetry intheresultinglinearsystem.Cellsoncoarserlevelsarenotdu-plicated to maintain memory alignment especially for GPUimplementations. Our method can either be used as a stan-dalone multigrid solver or embedded in a conjugate gradientalgorithm as a preconditioner.Existing fluid solvers based on voxelized regular grids candirectly benefit by slightly modifying the solid-fluid bound-ary representation. In comparison to state-of-the-art algo-rithms, our method results in a speed-up of up to 3 ×  fora 256 3 grid. In addition, we show a GPU implementation of our multigrid solver which allows for fluid simulations up tofour million degrees of freedom at interactive rates, i.e., withsimulation times below 100 ms on current hardware. 2. Related WorkFluid simulation  In the last years a vast number of papersin the area of fluid simulation for computer graphics havebeen published. Our focus lies on Eulerian, grid-based ap-proaches that use semi-Langrangian advection which wasintroduced in the pioneering work of Stam [Sta99]. In gen-eral, the challenges using a grid-based approach are numer-ical viscosity due to semi-Langrangian advection and highcomputational effort for computing the pressure correctionwhen using large grids. Furthermore, large time steps po-tentially smear out small scale vortices and resolving non-aligned solid geometry on a regular grid is difficult. Multigrid approaches  The solution of the linear systemsfor enforcing incompressibility remains the main bottleneckin fluid simulation, especially for highly detailed simula-tions on large grids. Multigrid methods theoretically providethe best performance for a large number of degrees of free-dom (see [TS01]). However, the construction of highly effi-cient multigrid schemes is challenging and optimal conver-gence rates are difficult to achieve. Various methods havebeen proposed. Aftosmis et al. [ABA00] presented a mul-tilevel method for embedded boundaries. If a cell is sepa-rated by the embedding geometry it is duplicated to maintainthe topological connectivity. In the work of Johansen andColella [JC98] and Schwartz et al [SBCL06] a finite volume discretization to solve embedded Dirichlet boundary condi-tions on two- and three-dimensional, regular grids has beenproposed. They solve the corresponding linear system witha multigrid approach. However the proposed discretizationgenerates non-symmetric systems, which are more difficultto solve. A similar method has been developed by Wan andLiu [WdL04], who proposed numerical multigrid scheme tosolve irregular boundary conditions represented by a levelset. However, they only handle Dirichlet boundary condi-tions. Hellrung et al. [HJWST12] addressed the problemof non-symmetric matrices by proposing an alternative dis-cretization and obtain a symmetric system instead. They fur-thermore extended the approach to three dimensions, addi-tionally handle Neumann boundary conditions and solve thelinear system with a multigrid approach. However, the exis-tence of embedded Neumann boundary conditions results ina more complex stencil requiring special handling, explicitmatrix storage and specialized restriction and prolongationoperators. Our discretization and multigrid approach is morespecialized to easily handle and efficiently compute scenar-ios with Neumann boundaries. We are also able to handleDirichlet conditions and the resulting matrices can be storedimplicitly by fluid faces resulting in a reduced memory con-sumption.Furthermore,thecoarsematricesdonotneedtobestored explicitly and the computation of their representationas well as the restriction and prolongation operators is fastand easy to implement. This allows for an efficient updateof the matrix hierarchies, which is needed for free surfacesimulation, where the system matrix changes in every timestep.In the context of fluid simulation for computer graphicsMcAdams et al. [MST10] presented a multigrid method em-bedded in a CG solver for solving Poisson equations forthe pressure correction. They use a single multigrid V-cyclefor preconditioning, as their multigrid method does not con-verge on its own. Chentanez and Müller [CM11a] analyzedMcAdams’ approach and stated that the divergence is due tonot using a solid fraction method, as it leads to incompati-ble discretizations at different levels of the mesh hierarchy.They extend the approach and propose a multigrid solver forcollocated discretizations (i.e., pressure and velocity sam-ples are stored at cell centers) based on the variational ap-proach described by Batty et al. [BBB07]. In Chentanez andMüller [CM11b] they propose a similar multigrid methodbut on a variational staggered grid discretization.Ferstl. et al. [FWD14] introduced a method for liquid sim-ulation using a finite element discretization on adpative reg-ular grids. They use an octree to discretize the space accu-rately at liquid-air boundaries and provide coarse grid cellsin regions, which are covered entirely by fluid. To resolvethe liquid-air boundary a specialized marching cubes algo-rithm is applied to create tetrahedral elements for partiallyfilled cells. On coarser levels cells and vertices are locallyduplicated for topologically separated domains to improveconvergence. Setaluri et al. [SABS14] present a specializedsparse grid data structure by means of pyramids of uniformgrids, where cells are marked as active or inactive for adap-tive refinement. A multigrid preconditioned conjugate gra-dient algorithm is used to solve the linear equations for thepressure correction. submitted to EUROGRAPHICS 2015.   D. Weber et al. / A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation  3 Modeling irregular boundaries  Many authors address theissue of solid geometry that is not aligned with cell bor-ders, i.e., irregular boundaries. To model sub-cell featuresadaptive grids such as octrees (see Losasso et al. [LGF04])or adaptive conforming tetrahedral meshes near the bound-ary (see Feldmann et al. [FOK05]) were proposed. In thework of Chentanez et al. [CFL ∗ 07] a tetrahedral mesh de-fined on a lattice was used. Near solid walls the elementsare transformed to better conform with the boundary. Battyet al. [BXH10] built upon this approach but use fixed tetra-hedral meshes near the boundaries and propose tetrahedralcut-cells to more accurately resolve the fluid. Lentine etal. [LZF10] used a coarse grid projection to accelerate thepressure correction by solving smaller linear systems whileretaining a high resolution grid for advection.A variational approach for handling irregular boundarieshas been presented by Batty et al. [BBB07]. In that approachvolume fractions between adjacent cells are computed torepresent a fractional coverage of solid and fluid to improvethe voxelized pressure solve. Ng et al. [NMG09] have shownthat this type of discretization induces significant errors inthe  L 1  and  L ∞  norms of the resulting divergence-free fieldof velocity near the boundaries. They propose an alternativerepresentation that uses the fractional coverage of solid andfluid at cell interfaces to cope with irregular domains. Thisdiscretization serves as a basis of our multigrid approach.For fluid simulation with irregular boundaries there is aneed to recompute the border between fluid and air. There-fore, several sub grid modeling approaches were designed.Gibou et al. [GFCK02] presented a discretization of irreg-ular domains based on finite differences to obtain symmet-ric matrices. Enright et al. [ENGF03] introduced the ghostfluid method based on a finite difference scheme, proposingto model Dirichlet boundary conditions at the fluid interfaceby modifying the right hand side virtually moving degrees of freedom torwards the interface. In the case of finite volumesa similar approach results in non-symmetric matrices. Alternative approaches  Instead of using very large grids toreproduce small scale phenomena, alternative methods suchas vorticity confinement (see Fedkiw et al. [FSJ01]) or vor-tex particles (see Selle et al. [SRF05]) have been presented.Pfaff et al. [PTSG09] proposed to inject the precomputedeffects of artificial boundary layers into the simulation toachieve sub-grid motion. Later they used triangular meshesto model the interface between distinct phases [PTG12]. Onthis representation turbulent behavior is directly synthesizedby applying vortex sheet dynamics. Zhu et al. [ZLC ∗ 13] in-troduced a new grid structure with bigger cells that surrounda fine uniform grid to create larger far-fields.For liquid simulation Wojtan et al. [WTGT09] introducedmesh-based surface tracking for a more detailed representa-tion of the interface. Da et al. [DBG14] employ mesh-basedsurface tracking for multiple materials. They present opera-tions to obtain watertight and intersection-free meshes whenmaterial interfaces collide, which is important to accuratelyrepresent and simulate the interfaces. Edwards and and Brid-son [EB14] combine the discontinous Galerkin method andsurface meshes for fluid simulation. With a high polynomialdegree they can use a very low number of cellsMany of the aforementioned approaches make use of aregular grid discretization. The popular staggered grid dis-cretization was introduced by Harlow and Welch [HW65]and is numerically advantageous compared to a collocateddiscretization. In collocated discretizations both the velocityand pressure samples are stored in the cell center, whereasin staggered grids the normal components of the velocity arestored at cell faces. 3. Discretization To simulate incompressible fluids with constant density  ρ it is necessary to compute a divergence-free velocity field u . The incompressibility constraint can be enforced with apressure projection step by determining a pressure field  p which satisfies the Poisson equation ∇·∇  p  =  ρ∆ t  ∇· u ,  (1)on a domain  Ω  subject to boundary conditions on  ∂Ω ,where  ∆ t   is the time step. We discretize the boundaryvalue problem on a structured, orthogonal and equidis-tant staggered MAC grid (as introduced by Harlow andWelch [HW65] and popularized in computer animation byFoster and Metaxas [FM96]), where the pressure variablesare located at the cell centers and the normal components of the velocities are located at the interfaces between adjacentcells. This setting is depicted in Fig. 2 and is described indetail in the textbook of Bridson [Bri08].For irregular domains a simple approach is to use a vox-elized domain, i.e., to mark each cell either as interior, solidor air to model the fluid, walls or free surfaces. A finite dif-ference discretization of Eq. (1) then yields a system of lin-ear equations  Lx  =  b , where the sparse matrix  L  consistsof seven entries per row due to the regular mesh topology(five per row in 2D). The entries in this matrix depend onthe state of the adjacent cells. A matrix-free approach can beused (see, e.g., [MST10]), as the sparse matrix-vector multi-plication and other operations can be deduced from the localconfiguration (the state of the neighboring cells).We use an alternative discretization of the Poisson equa-tion by applying a finite volume scheme similar to Ng etal. [NMG09]. We transform Eq. (1) into the weak form by integrating both sides and applying the divergence theorem.For the left hand side ˚  C  ijk  ∩ Ω ∇·∇  p d V   = ‹  ∂ ( C  ijk  ∩ Ω ) n ·∇  p d  A  (2)is obtained, where  C  ijk   is a voxel grid cell. d V   and d  A  areinfinitesimal volume and area elements, respectively. Simi- submitted to EUROGRAPHICS 2015.  4  D. Weber et al. / A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation larly, ρ∆ t  ˚  C  ijk  ∩ Ω ∇· u d V   =  ρ∆ t  ‹  ∂ ( C  ijk  ∩ Ω ) n · u d  A  (3)is obtained for the right hand side.By introducing cell and face averages (denoted by anoverline) Eqns. (2) and (3) can be written as discrete sums V  ijk  ∇·∇  p  = ∑  f   A  f  n  f  ·∇  p  (4)and ρ∆ t V  ijk  ∇· u  =  ρ∆ t  ∑  f   A  f  n  f  · u ,  (5)where  f   are the faces,  V  ijk   is the volume of cell  C  ijk   and  A  f  is the area of face  f  .For regular faces which are part of the cell surface  ∂ C  ijk  but not part of the domain boundary  ∂Ω  ( ∂Ω  includes freesurfaces) the gradient term  n  f  ·∇  p  can be approximated bya finite difference n  f  ·∇  p ≈  p F  −  p ijk  ∆  x  ,  (6)as the cell centers are on a regular, orthogonal grid andaligned with the face normals.  ∆  x  is the cell spacing and  p F  is the pressure value of the cell on the opposing side of   f  .The  n  f  · u  term in Eq. (5) corresponds to the velocity value ± u  f   stored on the cell face (the sign depends on the refer-ence normal and the face normal).For a regular cell lying completely inside the domain thisresults in the volume-scaled discretization of Eq. (1) ∆  x  . . . −  p i − 1  jk   + 6  p ijk  −  p i + 1  jk   . . .   = − ρ∆ t  ∆  x 2  u i +  12  jk  − u i − 12  jk   + . . .  , (7)as all face areas  A  f   equal  ∆  x 2 (both sides are negated to cre-ate a positive definite system of linear equations). For suchcells the discretization differs from the commonly used finitedifference discretization only by a scale factor of  V  ijk   = ∆  x 3 .For cell faces partially cut by the irregular domain boundary  A  f   varies between 0 and  ∆  x 2 . As the main diagonal equalsthe negated sum of the off-diagonal elements and the faceareas are equal for all adjacent cells, the resulting matrix re-mains positive definite and diagonally dominant in all cases.For Neumann boundary conditions (e.g., walls, fixed ve-locity inlets) the pressure gradient along the face normal isdefined as ∂  p ∂ n  f  =  a .  (8)Therefore, the corresponding term  A  f  n  f  ·∇  p  =  A  f  a  (9)can be moved to the right hand side and does not affect theresulting matrix.Unlike McAdams et al. [MST10] who use the commonapproach where Dirichtlet boundaries (e.g., free surfaces,fixed pressure inlets) are enforced at ghost cells which liebeyond the actual boundary instead of at the boundary andNg et al. [NMG09] who do not consider free surfaces at all,we apply Dirichlet boundary conditions at the correspond-ing geometric boundary. Chentanez and Mueller [CM11b]achieve this using the ghost cell method by extrapolating anegative pressure outside of the domain, ensuring that  p  =  0at the boundary. We use a finite difference approximation  A  f  n  f  ·∇  p ≈ 2  A  f  b −  p ijk  ∆  x  (10)for grid-aligned boundaries, where  b  is the boundary pres-sure, as the distance to the cell boundary is  ∆  x 2  , which isequivalent to applying the ghost fluid method proposed byEnright et al. [ENGF03]. The known component 2  A  f b ∆  x ismoved to the right hand side and 2  A  f  1 ∆  x  is added to the maindiagonal of the discretized matrix.For non-aligned Dirichlet boundaries ∇  p  is approximatedas ∇  p ≈ sgn ( n ) 2 b −  p ijk  ∆  x  ,  (11)where n isthenormaloftheboundarywhere ∇  p isevaluatedand sgn is the component-wise sign function, i.e., the grid-aligned value with the same sign of the normal as the currentcomponent is used. Then ‹  ∂ ( C  ijk  ∩ Ω ) n ·∇  p d  A ≈ 2 b −  p ijk  ∆  x  ∑ k  ∈  x ,  y ,  z ‹  ∂ ( C  ijk  ∩ Ω ) | n k  | d  A  = 2 b −  p ijk  ∆  x  ∑ k  ∈  x ,  y ,  z ‹  ∂ ( C  ijk  ∩ Ω ) | cos β k  | d  A  = 2  A  projd  b −  p ijk  ∆  x  , (12)where  β k   is the angle between the normal and the unit vec-tor  e k   along axis  k   and  A  projd   is the unsigned, projected areaof the Dirichlet boundary within the cell. This discretiza-tion is consistent with the restriction and prolongation oper-atorschoseninthemultigridalgorithmandyieldsbettercon-vergence than always moving the Dirichlet boundary to theclosest cell boundary on all levels. Effectively, non-alignedboundariesareapproximatedasalignedboundarieswithpar-tial coverage of cells faces. submitted to EUROGRAPHICS 2015.   D. Weber et al. / A Cut-Cell Geometric Multigrid Poisson Solver for Fluid Simulation  5  p ij u i − 12  j  u i +  12  j u ij − 12 u ij +  12  A  projd  , ij  A i − 12  j  A i +  12  j  A ij − 12  A ij +  12 Figure 2: Two-dimensional staggered grid and storage loca-tions of discretized areas. The dashed lines represent areasinside obstacles and the green line corresponds to the do-main boundary  ∂Ω .Combining all of the above, the matrix is constructed as L r  ijk  , r  i ± 1  jk   =  −  A i ± 12  jk  ∆  x L r  ijk  , r  ij ± 1 k   =  −  A ij ± 12  k  ∆  x L r  ijk  , r  ijk  ± 1  =  −  A ijk  ± 12 ∆  x L r  ijk  , r  ijk   =  ∑ o ∈± 12  A i + ojk  ∆  x  + ∑ o ∈± 12  A ij + ok  ∆  x  + ∑ o ∈± 12  A ijk  + o ∆  x  + 2  A  projd  ∆  x (13)and the right hand side as b r  ijk   =  − ρ∆ t    A i +  12  jk  u i +  12  jk  −  A i − 12  jk  u i − 12  jk  +  A ij +  12 k  u ij +  12 k  −  A ij − 12 k  u ij − 12 k  +  A ijk  +  12 u ijk  +  12 −  A ijk  − 12 u ijk  − 12 +  A d  n d  · u d   +  A n a + 2  A  projd b ∆  x , (14)where  r  ijk   is the row or column corresponding to C  ijk   and  A n is the total Neumann surface area. The Dirichlet divergenceterm  A d  n d  · u d   is either approximated using an extrapolatedvelocity or computed in the same fashion as the other diver-gence terms for grid-aligned boundaries.This alternative discretization can be interpreted as fol-lows: The areas  A  f   between the faces implicitly model theboundaries of the fluid. The values  A  f   ∈ [ 0 , ∆  x 2 ]  representthe fraction of area over which fluid can be exchanged be-tween adjacent cells (see Fig. 2 for a two-dimensional ex-ample). The resulting discretization yields cut cells, wherethe finite volume approach takes care of the irregular cells atboundaries. This allows us to resolve the boundary of the ge-ometry more accurately, especially when multiple grid reso-lutions are used to represent the same simulation domain. Inthat case, a better match of the corresponding geometry rep-resentations on each level is achieved than with the standardapproach, where the domain boundary must align with thecell boundaries. Especially on coarse levels, this cut-cell dis- def   mgvcycle ( x 0 , b 0 ) : for  l  in  [ 0 . . .  L ) : x l  : =  smooth ( L l , x l , b l ) r l  : =  b l − L l x l b l + 1  : =  I l + 1 l  r l ;  x l + 1  : =  0x  L  : =  L − 1  L  b  L for  l  in  (  L . . . 0 ] : x l  : =  x l  + I ll + 1 x l + 1 x l  : =  smooth ( L l , x l , b l ) return x 0 Listing 1: Multigrid V-cyclecretization is essential for obtaining the high rate of conver-gence of our multigrid solver, as it makes the discretizationequivalentto deriving itfromthe usedrestrictionandprolon-gationoperatorsviathe Galerkincoarsegridmethod[TS01].However, additional expensive sparse matrix-matrix prod-ucts are not required with our approach.This makes it easier to update the discretization if, for ex-ample, obstacle geometry changes. Note that Eqns. (13) and(14) can be used both with cut cells or a voxelized domain(with  A  f   ∈{ 0 , ∆  x 2 } ) on the fine simulation grid. The restric-tion operators presented in Section 4 automatically converta voxelized domain into a cut cell representation on coarserlevels. 4. Multigrid solver The non-recursive multigrid V-cycle given in Listing 1 con-sists of five basic operations: restriction ( I  H h  ), prolongation( I h H  ), sparse matrix-vector multiplication ( L l x l ), smoothingand the exact solution on the lowest level ( L − 1  L  x  L ). Wechoose level 0 to be the fine grid and  L  to be the coarsestgrid.The natural restriction operator  I  H h  resulting from the fi-nite volume discretization x  H  IJK   =  ∑ i ∈ [ 2  I  , 2  I  + 1 ]  j ∈ [ 2  J  , 2  J  + 1 ] k  ∈ [ 2 K  , 2 K  + 1 ] x hijk   (15)is a simple sum over 4 or 8 cells in 2D and 3D, respectively,asshowninFig.3,sincethesummationovermultiplecellsisthe discrete equivalent to an integral over multiple cells. Theprolongation operator  I h H   is chosen to be the transpose of therestriction operator in matrix representation  I h H   = ( I  H h  ) T  , i.e.,the coarse grid result is simply repeated for the correspond-ing fine grid cells.In fact, these restriction and prolongation operators arenot only simpler to implement than the cell-centered trilin-ear interpolation used by McAdams et al. [MST10], but also submitted to EUROGRAPHICS 2015.
Similar documents
View more...
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks