reducing numerical dissipation in fluid simulationybai30/papers/reducing numerical dissipation...

6
Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia Institute of Technology 1. Introduction Fluid simulation is widely used in different areas to mimic the flow of smoke, water and fire. Navier- Stoke equation is the model to simulate the fluid flow. To solve the Navier-Stoke equation, Stam proposed a stable method consists of four steps: add force and source, advect, diffuse, and project [Stam 99]. However, there is a problem of numerical dissipation in advection step of fluid simulation. And this will cause the phenomenon that the fluid will dampen too fast. Vorticity confinement and BFECC are two ways to handle numerical dissipation problem. As to vorticity confinement method, a vorticity confinement term based on vorticity of velocity field is introduced [Fedkiw et al. 01]. And this method can model the small scale rolling features characteristic of smoke that are absent due to the coarse grid and numerical dissipation. Back and Force Error Compensation and Correction (BFECC) proposed by Kim et al. is another way to reduce dissipation and diffusion encountered in advection step of fluid simulation [Kim et al. 05]. In this paper, we implemented and compared the above two methods to address the numerical dissipation problem in fluid simulation. In section 2, the operation in advection step and the dissipation problem caused by semi-Lagrangian is introduced. In section 3 and 4, we give the detail of vorticity confinement method and BFECC as well as their implementation. The results of fluid simulation with dissipation as well as results using vorticity confinement and BFECC are compared in section 5. 2. Advection Step 2.1 Advection Step in Solving Navier-Stoke Equation Navier-Stoke equation is mostly used in computer graphics to model the flow of fluid. Fluid can be described using velocity field u and pressure field p when the fluid’s density and temperature are nearly constant. The evolution of velocity and pressure is given by Navier-Stokes equations: 0 u , (1) 2 1 ( ) u u u p u f t , (2) where is the kinematic viscosity of the fluid, is density and f is external force. To solve these equations, the first step is adding external force. The second step accounts for the effect of advection. The third step solves for the effect of viscosity and is equivalent to a diffusion equation. Finally, a projection step is introduced to make the resulting field divergence free.

Upload: hathien

Post on 29-Jul-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

Reducing Numerical Dissipation in Fluid Simulation

Yunfei Bai, Greg Turk

Georgia Institute of Technology

1. Introduction Fluid simulation is widely used in different areas to mimic the flow of smoke, water and fire. Navier-

Stoke equation is the model to simulate the fluid flow. To solve the Navier-Stoke equation, Stam

proposed a stable method consists of four steps: add force and source, advect, diffuse, and project

[Stam 99]. However, there is a problem of numerical dissipation in advection step of fluid simulation.

And this will cause the phenomenon that the fluid will dampen too fast.

Vorticity confinement and BFECC are two ways to handle numerical dissipation problem. As to vorticity

confinement method, a vorticity confinement term based on vorticity of velocity field is introduced

[Fedkiw et al. 01]. And this method can model the small scale rolling features characteristic of smoke

that are absent due to the coarse grid and numerical dissipation. Back and Force Error Compensation

and Correction (BFECC) proposed by Kim et al. is another way to reduce dissipation and diffusion

encountered in advection step of fluid simulation [Kim et al. 05].

In this paper, we implemented and compared the above two methods to address the numerical

dissipation problem in fluid simulation. In section 2, the operation in advection step and the dissipation

problem caused by semi-Lagrangian is introduced. In section 3 and 4, we give the detail of vorticity

confinement method and BFECC as well as their implementation. The results of fluid simulation with

dissipation as well as results using vorticity confinement and BFECC are compared in section 5.

2. Advection Step

2.1 Advection Step in Solving Navier-Stoke Equation Navier-Stoke equation is mostly used in computer graphics to model the flow of fluid. Fluid can be

described using velocity field u and pressure field p when the fluid’s density and temperature are

nearly constant. The evolution of velocity and pressure is given by Navier-Stokes equations:

0u , (1)

21( )

uu u p u f

t

, (2)

where is the kinematic viscosity of the fluid, is density and f is external force. To solve these

equations, the first step is adding external force. The second step accounts for the effect of advection.

The third step solves for the effect of viscosity and is equivalent to a diffusion equation. Finally, a

projection step is introduced to make the resulting field divergence free.

Page 2: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

In advection step, we advect a quantity field nq using a given velocity field. In the next time step, we

can get a new quantity field 1nq . This step can be written as

1 ( , , )n nq advect u t q . (3)

We can use PDE to solve advection equation. However, if we use forward Euler to replace time

derivative in advection equation, it is unconditionally unstable. Meanwhile, the spatial discretization will

also bring about trouble in simulation.

2.2 Semi-Lagrangian Algorithm Semi-Lagrangian is a stable way to simulate fluid. To get state of fluid at a specific point in space, we can

just find the particle that ends up at this point and look up its state value. First of all, we need to figure

out where this imaginary particle started from. If Gx defines the grid point we are looking at, Px defines

the position the imaginary particle started from, then we can use one step of forward Euler to estimate

Px which can be written as

( )P G Gx x tu x . (4)

If Px is not on the grid, we can use interpolation method to get state at Px using nearby grid points.

2.3 Dissipation Problem As for interpolation of each time, a weighted average of state values of previous step is used to get new

state value. This averaging operation tends to smooth out sharp features. And it will cause fluid without

viscosity looks like has viscosity. This is called the numerical dissipation problem. Since this dissipation

problem is caused by interpolation, a sharper interpolation can be used such as Catmull-Rom

interpolation [Fedkiw et al. 01].

3. Vorticity Confinement

3.1 Algorithm For smoke which contains large spatial deviations in velocity field, there should be a significant amount

of rotational and turbulent structure on a variety scales. However, the numerical dissipation will

dampen this detail scales. Therefore, the main idea of vorticity confinement is to add this details back to

cancel out dissipation. To figure out where the detail feature of incompressible flow comes from, the

vorticity of velocity field can be utilized, since provides the small scale structure. The paddle force

can be added to enforce each piece of vorticity. And this paddle force can be calculated as

( )conff h N , (5)

where is used to control the small scale detail added back into the flow, h is the scale of the grid, N

is the normalized vorticity location vectors calculated as

Page 3: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

N

(6)

(7)

3.2 Implementation According to the vorticity confinement algorithm, the first step is to calculate vorticity of velocity field.

The bottom left image of Figure1 shows the result of the vorticity. The red and green color means that

the direction of vorticity is opposite. The confinement force will be added to the fluid at the position

that the vorticity is intense as shown in the bottom right image of Figure1.

Figure1:Vorticity Confinement. Top left is the density field of the fluid. Top right is the velocity field of the

fluid. Bottom left is the vorticity of the velocity field. Bottom right is the confinement force.

4. BFECC

4.1 Algorithm BFECC can be applied to various advections. If is used to denote quantity field to be advected, L

denotes the first order semi-Lagrangian integration step, then we have

Page 4: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

1 ( , )n nL u . (8)

The procedure of BFECC can be written as

1 1( , ( ))

2

n n nL u , (9)

( , ( , ))nL u L u . (10)

The forward and backward step will return a value . The difference between n and is employed

to cancel out the error in semi-Lagrangian step.

4.2 Implementation BFECC can be divided into four steps as:

( , , , )nL u v , (11)

( , , , )L u v , (12)

ˆ ( ) / 2n n , (13)

1ˆ( , , , )nL u v , (14)

where u , v stands for horizontal and vertical velocity respectively. In the advection step, can stand

for density field as well as horizontal and vertical velocity field. To prevent velocities from being mixed in

fluids with different density, BFECC needs to be turned off near the fluid interface. And BFECC is also

turned off near the boundary. The results of BFECC with and without turning off at boundary are shown

in Figure2.

Figure2:BFECC. Left image is simulation of smoke using BFECC, and BFECC is turned off at the boundary.

Middle image is simulation of smoke using BFECC, but without turning off BFECC at boundary. Right

image is simulation of smoke without using BFECC in advection.

Page 5: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

5. Results In this section, we compare the simulation results of smoke using stable fluid method proposed by Stam

with the results using vorticity confinement as well as the results using BFECC. We set the initial density

field and velocity field to be consistent. And the simulation results in different stages are shown in

Figure3.

Figure3. Results of smoke simulation. The images in the first row are results of stable fluid. The images in

the second row are results of vorticity confinement. The images in the third row are results of BFECC.

Page 6: Reducing Numerical Dissipation in Fluid Simulationybai30/papers/Reducing Numerical Dissipation in... · Reducing Numerical Dissipation in Fluid Simulation Yunfei Bai, Greg Turk Georgia

6. Discussion From the results in Figure3, we can see that the fluid's density dampen fast due to numerical dissipation.

The vorticity confinement and BFECC can both reducing this dissipation. Especially, vorticity

confinement can keep the small scale detail of the fluid well. However, if in vorticity confinement is

set to be too large, the fluid will not be stable again as shown in Figure4.

Figure4. Vorticity confinement using large .

There are also other ways to handle numerical dissipation. For example, using Catmull-Rom

interpolation in the semi-Lagrangian method for advection boosts the accuracy to second order and

significantly reduces the numerical dissipation [Fedkiw et al. 01].

Reference [Fedkiw et al. 01] R. Fedkiw, J. Stam, and H. W. Jensen. "Visual Simulation of Smoke." In SIGGRAPH '01:

Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, pp. 15-22.

New York: ACM, 2001.

[Kim et al. 05] B. Kim, Y. Liu, I. Llamas, and J. Rossignac. "FlowFixer: Using BFECC for Fluid Simulation."

Proceedings of the Eurographics Workshop on Natural Phenomena, 2005.

[Stam 99] J. Stam. "Stable Fluids." In SIGGRAPH 99 Conference Proceedings, Annual Conference Series, pp.

121-128. New York: ACM, 1999.

[Stam 03] J. Stam. "Real-Time Fluid Dynamics for Games." Proceedings of the Game Developer

Conference, March 2003.