Graphics Reference
In-Depth Information
that we want to appear viscous and sticky), we can indeed take the shortcut
of just using the solid's velocity instead.
3.3 Time Step Size
A primary concern for any numerical method is whether it is stable: will it
blow up? Happily the semi-Lagrangian approach above is
unconditionally
stable
: nomatterhowbigΔ
t
is, we can never blow up. It's easy to see why:
wherever the particle starting point ends up, we interpolate from old values
of
q
to get the new values for
q
. Linear/bilinear/trilinear interpolation
always produces values that lie between the values we're interpolating from:
we can't create larger or smaller values of
q
than were already present in the
previous time step. So
q
stays bounded. This is really very attractive: we
can select the time step based purely on the accuracy versus speed trade-off
curve. If we want to run at real-time rates regardless of the accuracy of
the simulation, we can pick Δ
t
equal to the frame duration for example.
In practice, the method can produce some strange results if we are
too aggressive with the time step size. It has been suggested [Foster and
Fedkiw 01] that an appropriate strategy is to limit Δ
t
so that the furthest
a particle trajectory is traced is five grid cell widths:
5Δ
x
u
max
,
Δ
t
≤
(3.2)
where
u
max
is an estimate of the maximum velocity in the fluid. This could
be as simple as the maximum velocity currently stored on the grid. A more
robust estimate takes into account velocities that might be induced due to
acceleration
g
from gravity (or other body forces like buoyancy) over the
time step. In that case,
u
n
u
max
=max(
|
|
)+Δ
t
|
g
|
.
Unfortunately this estimate depends on Δ
t
(which we're trying to find),
but if we replace Δ
t
with the upper bound from inequality (3.2) we get
)+
5Δ
x
u
n
u
max
=max(
|
|
u
max
|
g
|
.
Solving for
u
max
and taking a simple upper bound gives
)+
5Δ
xg.
u
n
u
max
=max(
|
|