Graphics Reference
In-Depth Information
The end effect in the matrix is to increase the diagonal. At this point you
should probably get worried about the case where φ i,j,k =0orisvery
close to zero—we are dividing by this quantity! To limit the possibility of
numerical diculties we can clamp the coecient in the pressure update
( φ i +1 ,j,k
φ i,j,k ) i,j,k to some maximum value, say 10 3 .
A closely related solution, more in line with the volume fraction ap-
proach we've already used extensively, is to instead modify the fluid density
ρ i +1 / 2 ,j,k to account for the fractions of the u -cell occupied by water versus
air. Compute ρ i +1 / 2 ,j,k as the average fluid density in the u -cell, ignoring
solids. The ghost fluid method above is in fact equivalent to using ρ air =0
and estimating the volume fraction from just φ i,j,k and φ i +1 ,j,k .Wecan
instead use the true non-zero density of air and better volume estimates,
in the same manner we calculate volume fractions for handling solid wall
boundary conditions. For example, we can 2
×
2
×
2supersample φ ,and
1
in each subcell (of side length
2 Δ x ) with an interpolated φ value at its
center, estimate the fraction occupied by water as
2 clamp [ 1 , 1] 4 φ
.
1
2
1
volume fraction
Δ x
and finally average the appropriate subcell fractions to get the volume
fractions for each u -, v -and w -cell. Once we have reasonable average
densities, we can set p = 0 in the grid cells that have no water at all—or,
optionally, leave them in. If we do leave them in, we'll have a harder linear
system to solve as we are actually solving for pressure in the air as well as
the water, but we'll also get zero divergence throughout the grid and not
just in the water. This means, for example, that bubbles will behave much
more sensibly, approximately conserving their volume.
For all of these solutions it should be emphasized that we need to ex-
trapolate the water-air φ into the solid walls. If instead φ were always
positive in the solid then both of these approaches erroneously treat the
solid wall as if it were a free surface, with ugly consequences.
6.4.1 Volume Control
Between iterative solves for pressure, truncation error in level set repre-
sentations and errors in advection, it is not surprising that a typical water
simulation doesn't exactly conserve the volume of water it begins with.
Typically the errors are biased to steadily lose volume. Kim et al. [Kim
et al. 07] demonstrate a simple correctiontothisdriftbyenforcinganon-
zero divergence control in the pressure projection step, similar to the cor-
rection for conservation of mass discussed in the previous chapter.
Search WWH ::




Custom Search