Fluid dynamics
Fluid dynamics Math background Physics Simulation Related - - PowerPoint PPT Presentation
Fluid dynamics Math background Physics Simulation Related - - PowerPoint PPT Presentation
Fluid dynamics Math background Physics Simulation Related phenomena Frontiers in graphics Rigid fluids Fields Domain R 2 Scalar field f : R Vector field f : R 2 Types of
- Math background
- Physics
- Simulation
- Related phenomena
- Frontiers in graphics
- Rigid fluids
- Domain
- Scalar field
- Vector field
Fields
Ω ⊆ R2 f : Ω → R f : Ω → R2
Types of derivatives
- Derivatives measure how something changes
due to its parameters
- Temporal derivatives
- Spatial derivatives
- gradient operator
- divergence operator
- Laplacian operator
∂f ∂t
∇f = ∂f ∂x, ∂f ∂y T ∇ · f = ∂f x ∂x + ∂f y ∂y ∇2f = ∇ · (∇f) = ∂2f ∂x + ∂2f ∂y
- Math background
- Physics
- Simulation
- Related phenomena
- Frontiers in graphics
- Rigid fluids
Representation
Domain Ω Density ρ : Ω → [0, 1] Velocity u : Ω → R3
“Coffee cup” equation
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f ∇ · u = 0
Navier-Stokes
u: velocity p: pressure s: kinematic viscosity f: body force ρ: fluid density
Momentum equation Incompressibility condition
Momentum equation
- Each particle represents a little blob of fluid
with mass m, a volume V, and a velocity u
- The acceleration of the particle
- The Newton’s law
a ≡ Du Dt mDu Dt = F
Forces acting on fluids
- Gravity: mg
- Pressure: -∇p
- Imbalance of higher pressure
- Viscosity: µ∇·∇u
- Force that makes particle moves at average
speed
- dynamic viscosity coefficient: µ
Momentum equation
ρDu Dt = ρg − ∇p + µ∇ · ∇u mDu Dt = mg − V ∇p + V µ∇ · ∇u Du Dt + 1 ρ∇p = g + s∇ · ∇u
The movement of a blob of fluid Divide by volume Rearrange equation giving Navier-Stoke
Lagrangian v.s. Eulerian
- Lagrangian point of view describes motion as
points travel around space over time
- Eulerian point of view describes motion as the
change of velocity field in a stationary domain
- Lagrangian approach is conceptually easier, but
Eulerian approach makes the spatial gradient easier to compute/approximate
Material derivative
Dq Dt = ∂q ∂t + u ∂q ∂x + v ∂q ∂y + w ∂q ∂z = ∂q ∂t + ∇q · u = Dq Dt d dtq(t, x) = ∂q ∂t + ∇q · dx dt
Advection
- Advection describe how quantity, q, moves
with the velocity field u
- Density
- Velocity
Du Dt = ∂u ∂t + u · ∇u Dρ Dt = ∂ρ ∂t + u · ∇ρ
Advection
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Advection
∇ · u = 0
Projection Diffusion Body force
Du Dt + 1 ρ∇p = g + s∇ · ∇u
momentum equation
Density advection
∂ρ ∂t = −(u · ∇)ρ
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Velocity advection
s.t. ∇ · u = 0
Projection
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Advection
∇ · u = 0
Projection Diffusion Body force
∇ · u > 0? ∇ · u < 0?
Divergence free
∇ ∙ u = 0
Divergence free
∇ ∙ u ≠ 0
Projection
s.t. ∇ · u = 0
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Diffusion
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Advection
∇ · u = 0
Projection Diffusion Body force
High viscosity fluids
Dropping viscosity
- Viscosity plays a minor role in most fluids
- Numeric methods introduce errors which can
be physically reinterpreted as viscosity
- Fluid with no viscosity is called “inviscid”
Body force
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Advection
∇ · u = 0
Projection Diffusion Body force
External forces
- Gravity
- Heat
- Surface tension
- User-specified forces (stirring coffee)
Boundary conditions
- Solid walls
- The fluid cannot go in and out of it
- Control the normal velocity
- Free surfaces
- Air can be represented as a region where
the pressure is zero
- Do not control the velocity at the surface
Solid boundary
- Velocity at the boundary
- No-slip condition:
- Pressure at the boundary
- Make the fluid incompressible AND enforce the
solid boundary condition
u · ˆ n = usolid · ˆ n u = usolid
Physics recap
- Physical quantity represented as fields
- Navier-Stokes PDE describes the dynamics
- Math background
- Physics
- Simulation
- Related phenomena
- Frontiers in graphics
- Rigid fluids
- What is the representation for fluids?
- represent velocity and pressure
- What is the equation of motion for fluids?
- approximate Navier-Stokes in a discrete
domain
- compute Navier-Stokes efficiently
Challenges
Grid structure
pi,j
pi−1,j
pi+1,j pi,j+1 pi,j−1 vi,j+1/2 vi,j−1/2 ui−1/2,j ui+1/2,j
Explicit integration
- Solving for the differential equation explicitly,
namely
- You get this...
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f ut+1 = ut + h ˙ u(t)
Explicit integration
Stable fluids
Invented by Jos Stam Simple, fast, and unconditionally stable
Splitting methods
- Suppose we had a system
- We define simulation function Sf
- Then we could define
∂x ∂t = f(x) = g(x) + h(x) Sf(x, ∆t) : x(t) → x(t) + ∆tf(x) Sf(x, ∆t) : x(t + ∆t) = Sg(x, ∆t) ◦ Sh(x, ∆t)
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Splitting methods
w0(x) w1(x) w2(x) w3(x) w4(x) add force Advect Diffuse Project w0 = u(x, t) u(x, t+Δt) = w4
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Splitting methods
w0(x) w1(x) w2(x) w3(x) w4(x) add force Advect Diffuse Project w0 = u(x, t) u(x, t+Δt) = w4
Body forces
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Splitting methods
w0(x) w1(x) w2(x) w3(x) w4(x) add force Advect Diffuse Project w0 = u(x, t) u(x, t+Δt) = w4
Advection
Numerical dissipation
- Semi-Lagrangian advection tend to smooth out
sharp features by averaging the velocity field
- The numerical errors result in a different
advection equation solved by semi-Largrangian
- Smooth out small vortices in inviscid fluids
∂q ∂t + u ∂q ∂x = u∆x ∂2q ∂x2
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Splitting methods
w0(x) w1(x) w2(x) w3(x) w4(x) add force Advect Diffuse Project w0 = u(x, t) u(x, t+Δt) = w4
Diffusion
- Solve for the effect of viscosity
- Use an implicit method for stable result
∂w2 ∂t = ν∇2w2 (I − ν∆t∇2)w3(x) = w2(x)
∂u ∂t = −(u · ∇)u − 1 ρ∇p + s∇2u + f
Splitting methods
w0(x) w1(x) w2(x) w3(x) w4(x) add force Advect Diffuse Project w0 = u(x, t) u(x, t+Δt) = w4
Projection
P( )
Projection
- Projection step subtracts off the pressure from
the intermediate velocity field w3
- project(Δt, u) must satisfies two conditions:
- divergence free:
- boundary velocity:
∇ · ut+1 = 0 ut+1 · ˆ n = usolid · ˆ n w4 = w3 − ∆t1 ρ∇p
Boundary conditions
- Dirichlet boundary condition for free surfaces
- Neumann boundary condition for solid walls
pi+1,j pi,j ui+1/2,j
pi+1,j = pi,j + ρ∆x ∆t (ui+1/2,j − usolid) ut+1
i+1/2,j = ui+1/2,j − ∆t1ρ pi+1,j − pi,j ∆x ut+1
i+1/2,j = usolidsince
Divergence-free condition
pi,j
pi−1,j
pi+1,j pi,j+1 pi,j−1
vi,j+1/2 vi,j−1/2 ui−1/2,j ui+1/2,j
ut+1
i+1/2,j − ut+1 i−1/2,j∆x + vt+1
i,j+1/2 − vt+1 i,j−1/2∆x = 0 ui+1/2,j − ∆t1 ρ pi+1,j − pi,j ∆x
replace ut+1
i+1/2,j (and other terms)with result in a discrete Poisson equation
∆t ρ 4pi,j − pi+1,j − pi,j+1 − pi−1,j − pi,j−1 ∆x2- = −
The pressure equations
- If grid cell (i, j + 1) is in air
and (i+1, j) is a solid
- replace pi,j+1 with zero
- replace pi+1,j with the value
from Neumann condition
pi,j
pi−1,j
pi+1,j pi,j+1 pi,j−1
vi,j+1/2 vi,j−1/2 ui−1/2,j ui+1/2,j
∆t ρ 4pi,j − pi+1,j − pi,j+1 − pi−1,j − pi,j−1 ∆x2- = −
- pi,j + ρ∆x
Solve a linear system
- Ap = b
- Construct matrix A:
- diagonal entry: # of non-solid neighbors
- off-diagonal: 0 if the neighbor is non-fluid
cell and -1 if the neighbor is fluid cell
- A is symmetric positive definite
- Use preconditioned conjugate gradient