Game Development Reference
In-Depth Information
So, apart from gravity, we only consider the pressure force term. To evalu-
ate parameters that influence the pressure force term, a simplification of Equa-
tion (6.6)—the pressure equation—is presented in Equation (6.8).
showing the definition of f i
, we instead choose to show a i
, since fluid behav-
ior is equal if particles have the same acceleration. We also make the simplifying
assumption that the fluid is homogeneous, so m i = m j = m for any two particles
i and j :
a i
j =1
( p i + p j )
2
1
ρ i
m
ρ j
=
W ( x i
x j ,h )
j =1 m ( p i + p j )
=
2 ρ i ρ j
W ( x i x j ,h )
j =1
k
2 ( ρ j
+ ρ i )
W ( x i
x j ,h )
=
j =1
(( mW l ( h )) 1 +( mW l ( h )) 1 )
km
2
=
W ( x i
x j ,h )
j =1
2 (( W l ( h )) 1 +( W l ( h )) 1 )
k
=
W ( x i
x j ,h ) ,
(6.8)
where W l ( h )= l =1 W ( x i
x l ,h ).
From Equation (6.8) it follows that the acceleration of a fluid particle is de-
termined by the pressure constant k and the number of fluid particles—the latter
being represented by the summations in the equation. The mass m of a particle
turns out to have no influence on the acceleration, so it can be disregarded. The
smoothing kernel radius h seems to be of influence, since it determines the eval-
uation of the various forms of W . However, Section 6.9 shows that scaling h and
all fluid particle positions by a factor s also scales all fluid-particle accelerations
a i
by a factor s —provided that k scales by a factor s 2 . Therefore, the scale of
our fluid simulation has no influence on the fluid behavior relative to the scaling
factor. Of course, this assumes that the external forces and collision geometry are
scaled by s as well. As a result, we keep the smoothing kernel radius fixed and
express the pressure constant as a relative pressure constant k r =
k
h 2
and gravity
as the relative gravity g r = h .
To test the stability of an SPH simulation, we measure the average relative
velocity v r = h of a set of fluid particles over a time period of one second,
which will be the measure of stability. We consequently change the time step
t , the number of particles n , gravity g r , and the pressure constant k r .Thetest
case resembles a nonviscous fluid falling into a glass, where stability is measured
after the fluid has had time to move into a resting state. The results are shown in
Tab l e 6 . 1 .
As can be observed from Table 6.1, increasing the time step or k r decreases
stability. Increasing the number of fluid particles—translating into more layers
of particles on top of each other—decreases stability as well, as the maximum
pressure constant for a situation with 8 , 000 particles is much lower than it is in
the case of 4 , 000 particles. Choosing a smaller value for g r does not seem to