Title: Simulating Smoke and Water in CG
1Simulating Smoke and Water in CG
- Simulating Free-Surface Water Based on the Navier
Stokes Equations
2Last Time
- The Particle Level Set Method for reducing
numerical dissipation - Methods for high resolution level sets.
3Todays Lecture
- The Water Surface
- The Water Solver
- Pressure boundary condition at surface-cells
- Velocity boundary conditions at surface-cells
- Surface tension
- Sources and drains
- The MAC grid
4How to Represent the Water Surface
We represent the water surface by a level set
(signed distance field).
?gt0
?lt0
- All grid cells where ?lt0 are water
- All grid cells where ?gt0 are air
- Air grid cells with fluid cell neighbors are
called surface cells.
5Solver Overview
- Given an initial level set and velocity field
- Extrapolate/extend the velocity across the
interface. - Advect the level set and the particles.
- Apply sources and drains.
- Use the new level set to define the new region of
fluid. - Set boundary conditions for the free-surface,
sources, drains and obstacles. - Apply forces and advect and diffuse fluid.
- Compute pressure and divergence free velocity
field.
6Boundary Condtions for the Water Surface
- We have discussed how to set pressure and
velocities at the boundaries of solid objects.
Here, fluid is not allowed to penetrate the
boundary. - How do we specify pressure and velocity in air
and surface cells? - It is important that the air excerts no stresses
on the water surface, instead it should move
freely.
Let us first recall how to solve for a divergence
free velocity field...
7Computing a Divergence Free Velocity Field III
So we wish to solve the following equation known
as a Poisson equation
where
And where w is known and p is unknown.
Lets first write out the equation
In this case all the quantities we use are
defined at time t.
8Computing a Divergence Free Velocity Field IV
- Next we discretize the equation using finite
differences
9Computing a Divergence Free Velocity Field V
Now let
Multiplying the equation by ?x2 and re-arranging
terms, we get
Again there is a linear relations ship, so we can
solve a linear system Of equations of the form
Where A is a coefficient matrix, x is the
pressure we are solving for, and b Is the known
divergence of the velocity field.
10Pressure Boundary Condition
- In the case of a neighboring air cell we just set
the air pressure to zero - This ensures that fluid can accurately expand and
contract (the pressure gradient is not always
parallel to the surface). - For more advanced surface effects, we can include
surface tension...
pair 0
11Surface Tension
- Smooths out liquid surfaces.
- Breaks up fluid into small droplets.
- Caused by molecular cohesion.
- Modeled using jump condition in the pressure
field ??
Dirichlet Boundary Condition set in air cells
bordering the water.
12Velocity Extrapolation/Extension
- In order to make the surface move freely we must
ensure that all fluid cells are divergence free.
But we need boundary conditions for the velocity
on the surface. - One option is to adjust the velocity in all
surface cells such that all fluid cells become
divergence free and use this as boundary
condition. This is ambiguous. - Instead we apply velocity extrapolation into the
air which in the limit is divergence free.
13Velocity Extrapolation/Extension
- Recall the level set equation for moving a
surface - We can use a similar equation for moving a
property in the normal of the level set surface - Let the velocity field be defined as
then velocity extension is
14Sources and Drains I
- Modeled using CSG operations. Recall that the
signed distance field is negative inside and
positive outside
Union(x,y) min(x,y)
Intersect(x,y) max(x,y)
x-y subtract(x,y) Intersect(x,-y)
15Sources and Drains II
- A source is a collection of grid cells where
there is always fluid - We can model it as a CSG union.
- A drain is a collection of grid cells where there
is never fluid - We can model it as a CSG subtraction.
Velocities can be given to source and drain grid
cells by explicitly specifying non-zero
velocities on the source/drain boundary and e.g.
incorporating it into the poisson equation when
solving for the pressure.
16Solver Overview Revisited
- Given an initial level set and velocity field
- Extrapolate the velocity across the interface.
- Advect the level set and the particles.
- Apply sources and drains.
- Use the new level set to define the new region of
fluid. - Set boundary conditions for the free-surface,
sources, drains and obstacles. - Apply forces and advect and diffuse fluid.
- Compute pressure and divergence free velocity
field.
17The MAC/Staggered Grid
Velocities are stored at cell faces.
18The MAC/Staggered Grid
- Advantages
- Conjugate gradient method converges in fewer
iterations. - The resulting velocity field conserves mass
better. - Central differences can be computed in the
context of adjacent cells.
It is slightly more complicated to implement.
19Recent Work in MultiPhase Fluids
- Considers discontinuities in variables
- Pressure jump (surface tension and bubble shape)
- Density jump (rising bubbles)
- Viscosity jump (bubble shape)
Important for small scale simulations!
20Next Time