Definition 4.1. Viscosity sub/super/solution for the non-local eikonal equation)
3. Navier-Stokes equations on octrees
The motion of fluids is described by the incompressible Navier-Stokes equations for the conservation of momentum and mass:
ut+uã ∇u = −∇p+f, (3.1)
∇ ãu = 0, (3.2)
whereu= (u, v, w) is the velocity field,faccounts for the external forces and where the spatially constant density of the mixture has been absorbed in the pressurep.
Viscous effects are ignored.
A projection method [4] (see also [3]) is used to solve equations 3.1 and 3.2:
First an intermediate velocityu∗ is computed over a time step t, ignoring the pressure term
u∗−u
t +uã ∇u = f. (3.3)
This step, accounting for the convection and the external forces, is followed by a projection step to account for incompressibility and boils down to solving the Poisson equation
∇2p= 1
t∇ ãu∗. (3.4)
Finally, the pressure correction is added to define the new velocity fieldu:
u=u∗−∆t∇p. (3.5)
The reader is referred to [15] and the references therein for details in the simulations of free surface flows.
3.1. Finding the intermediate velocity
The intermediate velocity u∗ is found by solving equation 3.3 using a first-order accurate semi-Lagrangian method. In the case of nonuniform grids, the standard high-order accurate upwind methods (see, e.g., [9, 20, 13]) traditionally used in the case of uniform grids are not well suited due to their stringent time step restrictions and the complexity of their implementations. On the other hand, semi-Lagrangian methods (see, e.g., [21]) are unconditionally stable and are straightforward to implement.
3.2. The divergence operator
Equation 3.4 is solved by first evaluating the right-hand side at every grid point in the domain. Then, a linear system for the pressure is constructed and inverted.
Consider the discretization of equation 3.4 for a large cell with dimensionsx,y andzneighboring small cells as depicted in Figure 1 (left). Since the discretiza- tion is closely related to the second vector form of Green’s theorem that relates a volume integral to a surface integral, we first rescale equation 3.4 by the volume of the large cell to obtain
Vcellt∇2p= Vcell∇ ãu∗. (3.6)
202 F. Gibou, C. Min and H. Ceniceros
∆y
x
∆
p p
p p
1 10
6 pa p^x 2
py px
Cell 1 Cell 2 Cell 10
Cell 6
Figure 2. Discretization of the pressure gradient. The pressure values p1, p2, p6, and p10 are defined at the center of the cells. pa represents a weighted average pressure value. py defines the y component of the pressure gradient between Cell 1 and Cell 10 defined by standard central differencing. ˆpxrepresents the discretization of thexcomponent of the pressure gradient between Cell 1 and Cell 2, whereas px is a O(x) perturbation of ˆpx.
The right-hand side of equation 3.6 now represents the quantity of mass flowing in and out of the large cell within a time stept in m3s−1. This can be further rewritten as
Vcell∇ ã(u∗− t∇p) = 0. (3.7) This equation implies that the term∇pis most naturally evaluated at the same location asu∗, namely at the cell faces, and that there is a direct correspondence between the components of the vectors ∇p and u∗. That is, there is a direct correspondence between px and u, py and v, pz and w, which live on the right and left faces, top and bottom faces, front and back faces, respectively. Moreover, substituting equation 3.5 into equation 3.7 implies Vcell∇ ãu= 0 or∇ ãu= 0 as desired.
Invoking the second vector form of Green’s theorem, one can write Vcell∇ ãu∗=
faces
(u∗faceãn) Aface, (3.8)
where nis the outward unit normal of the large cell and where Aface represents the area of a cell face. In the case of Figure 1 (left), the discretization of the x component∂u∗/∂xof the divergence reads
xyz∂u∗
∂x =u∗2A2+u∗3A3+u∗4A4+u∗5A5−u∗1A1, (3.9)
Figure 3. High-resolution simulation illustrating the motion of a solid object through shallow water (left), the subsequent flow that reflects off the wall (center), and the eventual cresting and overturning of waves generated by this process (right). Reprinted from [15]
where theminus sign in front ofu∗1A1accounts for the fact that the unit normal points to the left. In this example, the discretization of∂u∗/∂xamounts to
∂u∗
∂x = 1 x
u∗2+u∗3+u∗4+u∗5
4 −u∗1
. (3.10)
They andz directions are treated similarly.
3.3. Defining the pressure derivative to obtain a symmetric linear system Once, the divergence is computed at the grid node, equation 3.4 is used to construct a linear system of equations for the pressure. Invoking again the second vector form of Green’s theorem, one can write
Vcell∇ ã(t∇p) =
faces
((t∇p)faceãn) Aface. (3.11) Therefore, once the pressure gradient is computed at every face, we can carry out the computation in a similar manner as for the divergence of the velocity described above.
In Gibouet al.[6], we showed thatO(x) perturbations in the location of the solution sampling still yield consistent approximations. This was then exploited in [15] to define∇pin order to construct a symmetric linear system. We simply define
px=p2−p1 ,
wherecan be defined as=x, which is the size of the large cell or=12x, which is the size of the small cell, or as the Euclidean distance between the loca- tions ofp1andp2or as the distance along thexdirection between the locations of p1 and p2 etc. In fact, in light of Theorem 4.1, we understand that there is some leeway in defining. Numerical tests against analytical solutions equation were presented in [15] to demonstrate that this scheme is convergent.
204 F. Gibou, C. Min and H. Ceniceros
Figure 4. High-resolution simulation of the formation of a milk crown illustrating the capability of emulating surface tension. Reprinted from [15].