Graphics Reference
In-Depth Information
In the thermal expansion problem, fundamentally we do want the fluid
to expand as it heats up and contract as it cools off. In other words, where
the change in temperature DT/Dt is non-zero, we don't want a divergence-
free velocity field. Let's derive exactly what we want.
Consider a region of fluid Ω, currently with volume V = Ω 1. After
atimestepofΔ t with velocities u , suppose it changes volume to V V .
Meanwhile, suppose the average density in the region changes from ρ to
ρ ρ . Conservation of mass requires ρV =( ρ ρ )( V V )which,
after neglecting the quadratic term, gives
Δ ρ
ρ
Δ V =
V.
(5.4)
Using the divergence theorem, the change in volume is approximately
Δ V =
Ω
Δ tu
·
n
=
Ω
Δ t
∇·
u.
Considering an infinitesimally small region, and dividing both sides of (5.4)
by V Δ t ,weget
1
Δ t
Δ ρ
ρ
∇·
u =
.
This is the divergence we want to enforce in the pressure projection step,
where we evaluate the change in density at grid cell centers due to changes
in temperature and smoke concentration. For example, if the temperature
increases, leading to a decrease in density, we need positive divergence to
enact that thermal expansion.
This is still a little sloppy—in addition to the approximations made for
the change in mass, there is a lag between the change in density in one
time step and the resulting motion of fluid in the divergent velocity field
in the next time step—and we certainly can't hope to exactly conserve
mass. However, it does expose a more general divergence control in the
simulation. Define a control field d ( x ) at the grid cell centers equal to the
desired rate of fractional volume change Δ V/V Δ t throughout the volume
of the fluid: we then solve for pressure to enforce that divergence. For the
classic voxelized pressure solve, this is as simple as adding d to the fluid
cells in the right-hand side of the linear system. For the more accurate
variational pressure solve, we include an additional volume-changing work
Search WWH ::




Custom Search