Graphics Reference
In-Depth Information
2.3 Time Steps
Determining a good time-step size is the first step of the algorithm. Our
first concern is that we don't want to go past the duration of the current
animation frame: if we pick a candidate Δ t but find t n t>t frame ,then
we should clamp it to Δ t = t frame
t n and set a flag that alerts us to the
fact we've hit the end of the frame. (Note that checking if t n +1 = t frame
is a bad idea, since inexact floating-point arithmetic may mean t n +1 isn't
exactly equal to t frame even when calculated this way!) At the end of each
frame we'll presumably do something special like save the state of the fluid
animation to disk, or render it on the screen.
Subject to that clamping, we want to then select a Δ t that satisfies
any requirements made by the separate steps of the simulation: advection,
body forces, etc. We'll discuss these in the chapters that follow. Selecting
the minimum of these suggested time steps is generally safe.
However, in some situations we may have a performance requirement
that won't let us take lots of small time steps every frame. If we only
have time for, say, three time steps per frame, we had better make sure
Δ t is at least a third of the frame time. This might be larger than the
suggested time-step sizes from each step, so we will make sure that all the
methodsweusecantoleratetheuseoflarger-than-desired time steps—they
should generate plausible results in this case, even if they're quantitatively
inaccurate.
2.4 Grids
In this numerical section, so far we have only talked about discretizing in
time, not in space. While we will go into more detail about this in the
subsequent chapters, we'll introduce the basic grid structure here.
In the early days of computational fluid dynamics, Harlow and Welch
introduced the marker-and-cell (MAC) method [Harlow and Welch 65]
method for solving incompressible flow problems. One of the fundamental
innovations of this paper was a new grid structure that (as we will see later)
makes for a very effective algorithm.
The so-called MAC grid is a staggered grid, i.e., a grid where the dif-
ferent variables are stored at different locations. Let's look at it in two
dimensions first, illustrated in Figure 2.1. The pressure in grid cell ( i, j )
is sampled at the center of the cell, indicated by p i,j . The velocity is split
into its two Cartesian components. The horizontal u -component is sampled
Search WWH ::




Custom Search