Title: Water
1Water
- Computational Fluid Dynamics
- Volumes
- Lagrangian vs. Eulerian modelling
- Navier-Stokes equations
- Solving Navier-Stokes
- Papers only
Foster and Fedkiw, 2001
2Computational Fluid Dynamics
- CFD
- Describes the characteristics of fluids in a
volume - Animation vs. CFD
- CFD Initial conditions, let it run
- Animation Looks real and we have control
- CFD correctness
- Animation efficiency
3Describing volumes
- We need to describe the volume and whats in it
- Volumes are typically described using regular
voxels (3D cells) (128 x 128 x 128 is common) - Boolean for each voxel
Foster and Metaxas, 2000
4Describing whats in the volume
- How do we describe water?
- Ideas?
5Two approaches
- Derives from Computational Fluid Dynamics
- Lagrangian models
- What happens at points in space
- Eulerian models
- Where does stuff go
6Lagrangian Models
- Break space into volumes
- Describe what is in each volume
- Example Incompressibility
- What goes in must match what goes out
7Eulerian Models
- We track motion of actual things over time
- Particles are usually used to represent water
- Example Incompressibility
- Particles must adhere to some packing rule
8Navier-Stokes equation
- Describes the motion of incompressible fluids
- Water, oil, mud, etc.
9Divergence
- u is the liquid velocity field
- Operator is called the divergence operator.
- Divergence of a vector field F, denoted div(F) or
as above is a scalar field - When equal to zero (zero vector), we have a
divergenceless field
10Gradient vs. Divergence
- I hate operator overloading
11Divergenceless field
- Implies incompressiblity
- Mass is conserved
- What goes out a point equals what goes in
- Note This is inside the water, not what
happens when air mixes in
12More equation parts
Gravity and force
viscous drag
convection
pressure
pressure
velocity
viscosity
density
13Problems with Navier-Stokes
- Acceleration is associated with moving elements,
so Eulerian models make sense - Pressure and boundary conditions are at
locations, so Lagrangian models make sense - Some methods use semi-Lagrangian models
14Foster and Fedkiw method
- 1. Model environment as a voxel grid
- 2. Model liquid volume using particles and
implicit surface - 3. Update velocity field by solving
Navier-Stokes using finite differences and a
semi-Lagrangian method - 4. Apply velocity constraints from moving
objects - 5. Enforce incompressibility
- 6. Update the liquid volume using new velocity
field
15The volume representation
- Each cell has
- Flag for filled or available for water
- Pressure variable at center (optional)
- Velocity vectors on 3 sides
- Shared with adjacent cell
16Particles
- Water is represented by particles
- Introduced from source or initially placed
- Motion for particle is determined by tri-linear
interpolation
17Isocontour
- Imagine each particle with a sphere around it
Isocontour
18Practical system issues
- The isocontour is all we need for creating the
image - High particle densities are needed to make good
isocontours, but create lots of complexity - Create initial isocontour at high density, then
use lower density motion fields to deform the
isocontour - Other option dynamically create/destroy
particles
19Solving Navier-Stokes
- Step 1 Choose a time step
- Good rule of thumb Nothing can jump over any
cells - ???
20Solving
- Step 2 Solve for the velocity
- This is so much fun
- Let w0(x) be a solution at location x at time t1
- Well move to a solution at time t2 using four
steps
21Getting to w1 Add force
22Getting to w2Add convection
- At each time step, all particles are moved by the
velocity of the fluid - The particle at location x was at location
p(x,t-Dt) before - Let w2(x)w1(p(x,t-Dt))
- All that is required is a way to track particles
and some linear interpolation.
23Getting to w3Viscosity
24Finite differences
- How do we get from or to code
on arrays? - Finite differences
25Solving for viscosity
This is a standard problem formulation called the
Poisson Problem and can be solved using numerous
solving packages like FISHPAK.
26From FISHPAK
C Subroutine POIS3D solves the linear system of
equations C C C1(X(I-1,J,K)-2.X(I,J,K)X(I1,J
,K)) C C2(X(I,J-1,K)-2.X(I,J,K)X(I,J1,K))
C A(K)X(I,J,K-1)B(K)X(I,J,K)C(K)X(I,J,K1)
F(I,J,K) C
27Getting to w4Incompressiblity
- Our solution will have a divergence part and a
divergence-free part. We need to solve for the
divergence part and subtract it out.
28Estimating the divergence of the velocity field
29Cont
Again, we have a Poisson Problem.
30What about pressure?
- Issues of incompressibility
- Stam claims that pressure drops out in his
solution. This would be a consequence of the way
he deals with incompressibility.
31Boundary conditions
- What about where we run out of space?
- Set velocity to zero? (paper says this)
- Or what other option?