Graphics Reference
In-Depth Information
the regular PDE-form of the incompressibility projection:
Δ
t
ρ
∇
∇·
p
=
∇·
u,
inside Ω;
p
=0
,
on
F
;
(4.15)
Δ
t
ρ
∇
p
·
n
=
u
·
n
−
u
solid
·
n,
on
S.
This is true even if the density of the fluid varies throughout the domain.
For a derivation, see Appendix B. The most important thing about this
equivalence is that the solid wall boundary condition doesn't explicitly
appear in the minimization form: this will let us capture it in the dis-
cretization with ease.
4.5.3 The Discrete Minimization
Our approach is to discretize the change in kinetic energy Δ
KE
, based on
the usual MAC grid velocity field and discrete pressure update, and then
solve for the discrete pressure that minimizes the discrete energy.
We'll begin with the internal kinetic energy of the fluid. Writing it out
in components we have
KE
=
Ω
2
ρ
u
2
+
v
2
+
w
2
1
=
Ω
2
ρu
2
+
Ω
2
ρv
2
+
Ω
1
1
1
2
ρw
2
.
We will approximate each of these three integrals separately; let's focus on
the first, involving
u
2
. We'll break it up into a sum over cells centered on
each of the
u
samples, which as you recall are stored at staggered locations
(
i
+1
/
2
,j,k
). Note that these are offset from the usual grid cells centered on
(
i, j, k
), so we will call them
u
-cells. Finally, we need the volume
V
i
+1
/
2
,j,k
of the fluid contained in each
u
-cell and the average fluid density
ρ
i
+1
/
2
,j,k
in
the
u
-cell (we'll discuss how to find this average for the variable density case
later; for now you can just treat it as a constant
ρ
). Our final approximation
of the
u
2
integral is
1
2
ρu
2
1
2
ρ
i
+1
/
2
,j,k
V
i
+1
/
2
,j,k
u
2
≈
i
+1
/
2
,j,k
.
Ω
i,j,k