Graphics Reference
In-Depth Information
Assuming ( i
1 ,j )and( i, j
1) are fluid cells, this would reduce the
equation to the following:
p i,j + ρ Δ x
u solid
Δ t u i +1 / 2 ,j
4 p i,j
0
p i− 1 ,j
p i,j− 1
Δ t
ρ
Δ x 2
u i +1 / 2 ,j
,
u i− 1 / 2 ,j
Δ x
+ v i,j +1 / 2
v i,j− 1 / 2
Δ x
=
3 p i,j
=
Δ t
ρ
p i− 1 ,j
p i,j− 1
Δ x 2
u i +1 / 2 ,j
+ u i +1 / 2 ,j
.
u i− 1 / 2 ,j
Δ x
+ v i,j +1 / 2
v i,j− 1 / 2
Δ x
u solid
Δ x
We can observe a few things about this example that hold in general and
how this will let us implement it in code. First, for the air cell bound-
ary condition, we simply just delete mention of that p from the equation.
Second, for the solid cell boundary condition, we delete mention of that p
but also reduce the coecient in front of p i,j , which is normally four, by
one—in other words, the coecient in front of p i,j is equal to the number of
non-solid grid cell neighbors (this is the same in three dimensions). Third,
scale = 1 / dx;
loop over i,j,k where cell(i,j,k)==FLUID:
if cell(i-1,j,k)==SOLID:
rhs(i,j,k) -= scale * (u(i,j,k) - usolid(i,j,k));
if cell(i+1,j,k)==SOLID:
rhs(i,j,k) += scale * (u(i+1,j,k) - usolid(i+1,j,k));
if cell(i,j-1,k)==SOLID:
rhs(i,j,k) -= scale * (v(i,j,k) - vsolid(i,j,k));
if cell(i,j+1,k)==SOLID:
rhs(i,j,k) += scale * (v(i,j+1,k) - vsolid(i,j+1,k));
if cell(i,j,k-1)==SOLID:
rhs(i,j,k) -= scale * (w(i,j,k) - wsolid(i,j,k));
if cell(i,j,k+1)==SOLID:
rhs(i,j,k) += scale * (w(i,j,k+1) - wsolid(i,j,k+1));
Figure 4.3.
Modifying the right-hand side to account for solid velocities.
Search WWH ::




Custom Search