Title: Simulating Fluids in CG
1Simulating Fluids in CG
2Last Time
- Introduction to smoke and water simulations in
computer graphics - Brief overview of state-of-the-art
- Brief overview of course
- The project and exam
- Rendering of participating media
- Ray marching
3This Lecture
- The equations of fluids
- Pressure
- Hydrostatic equilibrium
- Differential operators Gradient, divergence
- Incompressible Euler Equations
- Gauss Theorems
4Incompressible Euler Equations
Momentum and continuity equations for ideal
fluids
In this course we assume that the fluid has
constant density equal to one and ignore
viscosity.
5The Chaotic Nature of the Equations
6Incompressibility
- We model smoke (air) and water as incompressible.
Is this a safe assumption? - We cannot model sound waves
- We cannot model shock waves
- Speed must be below speed of sound
- Mathematical tools
- Divergence
- Gauss Theorem
7Incompressibility
n
W
Consider the mass of fluid inside the volume
Mass cannot be created or destroyed, so how can
it change?
8Incompressibility
v
v
n
W
v
Mass flow out of small surface area is given by
Change of mass inside is given by
9Gauss Theorem
- Gauss theorem comes in several variants.
- Here, we use the following
10The Divergence
- The divergence is a vector differential operator,
i.e. it differentiates a vector. Let V be a 3D
vector - The divergence is defined as
- What is the intuitive meaning of divergence?
11Incompressibility
v
v
n
W
v
Change of mass inside is given by
12Incompressibility
Incompressibility means
Since this must be true for any volume
13Incompressible Euler Equations
The continuity equation thus means Conservation
of mass
The velocity field is called divergence-free
14Newtons Second Law
Net force mass x acceleration
- Force and acceleration are vectors
- Given the forces we can integrate to find
velocity and position
15Hydrostatic Equilibrium
V 0
Consider water in equilibrium
(net force)
Which forces are in play?
Answer Gravity and pressure.
16What is Pressure?
- Pressure, p, is force per area.
- Pressure is a contact force (per area).
- Pressure acts orthogonal to any (imaginary)
surface. - Pressure is a compression force (per area)
- Pressure is independent of orientation.
- Pressure is a scalar quantity.
Given a body immersed in a fluid, how do we
determine the force resulting from pressure?
17Force From Pressure
n
W
18Hydrostatic Equilibrium
V 0
W
What does the force balance look like?
19Rewriting Force-Balance to Volume Integral
- Rewriting the first integral to a volume integral
requires - Definition of the gradient
- The Gauss Theorem
20The Gradient
- The gradient of a scalar function (e.g.
density/pressure) is a vector that points in the
direction of maximal change - Is normal to
- iso-surfaces/
- level sets
- We will utilize the gradient a lot of times!
21Gauss Theorem Again
- Gauss theorem comes in several variants.
- Here, we use the following
22Local Hydrostatic Equilibrium
- Because the volume we look at is arbitrary, the
integrand (force-density) must be zero.
23Incompressible Euler Equations
Hydrostatic Equilibrium
What is the connection and intuition?
Intuition R.h.s. are body and contact
force-densities. In which
direction does point?
24Hydrostatic Pressure
p0
e2
W
h
B
p1
25Newtons Second Law
Net force mass x acceleration
We wish to consider Newtons second law in
context of a fluid
How should we apply Newtons second law?
26Lagrangian vs Eulerian Viewpoints
Lagrangian We look at varying points in space
(particles)
Eulerian We look at fixed points in space
Each point has an associated Position, mass,
velocity, acceleration, density
27Newtons Second Law in Stationary Frame
We consider Newtons second law in a stationary
point.
Consider a stationary velocity field (steady
flow)
Does not work!
What is the acceleration
?
0
28Newtons Second Law in Co-Moving Frame
- We consider Newtons second law applied to a
small (material) particle moving along with the
flow
Force per volume
For density equal to 1
We must now make a connection between Newtons
second law in a co-moving (Lagrangian) frame and
our Eulerian frame.
29Newtons Second Law in Co-Moving Frame
We write the acceleration of a material particle
as
The velocity field depends on position and time
The particles flow along curves x(t)
Essentially we wish to sample the velocity of the
co-moving particles at stationary positions in
the domain.
30Newtons Second Law in Co-Moving Frame
31Incompressible Euler Equations
Newtons second law
Incompressible Euler Equations
What is the connection and intuition?
32Whiteboard Exercise
- Lets make sure we understand the components of
the Incompressible Euler Equations!
33Pressure Re-Visited
- Pressure is whatever-it-takes-to-make-the-velocit
y-field-divergence-free. - What does this mean and how do we solve for it in
practice?
34Pressure Re-Visited
A Poisson Equation
35Pressure Re-Visited
Pressure is whatever-it-takes-to-make-the-veloci
ty- field-divergence-free
36Boundary Conditions
- Free-slip (no-stick)
- No-slip (stick)
Static
Moving
With free-slip there are no constraints on
tangential component
37Additional Resources
- Book Mathematical Methods for Physicists
- Web www.mathworld.com and http//en.wikipedia.org
38Next Two Times
- How to solve the Incompressible Euler Equations
numerically - Advection
- Adding forces
- Solving the Poisson equation for pressure