Graphics Reference
In-Depth Information
high frequency (sharp), it turns out IC is only effective at removing the
high-frequency components of error. On the other hand, MIC is forced to
match the action of
A
on the lowest frequency mode of all, the constant,
and thus is more effective at all frequencies.
6
In practice, you can squeeze out even better performance by taking a
weighted average between the regular incomplete Cholesky formula and the
modified one, typically weighting with 0.97 or more (getting closer to 1 for
larger grids). See Figure 4.6 for pseudocode to implement this in three
dimensions. We actually compute and store the
reciprocals
of the diagonal
entries of
E
in a grid variable called
precon
, to avoid divides when applying
the preconditioner.
The pseudocode in Figure 4.6 additionally has a built-in safety tol-
erance. In some situations, such as a single-cell-wide line of fluid cells
surrounded by solids, IC(0) and MIC(0) become exact—except that
A
is singular in this case: the exact Cholesky factorization doesn't exist.
•
(First solve
Lq
=
r
)
•
For
i=1
to
nx
,
j=1
to
ny
,
k=1
to
nz
:
•
If cell (
i, j, k
) is fluid:
•
Set
t
=
r
i,j,k
−
Aplusi
i−
1
,j,k
∗
precon
i−
1
,j,k
∗
q
i−
1
,j,k
−
Aplusj
i,j−
1
,k
∗
precon
i,j−
1
,k
∗
q
i,j−
1
,k
−
Aplusk
i,j,k−
1
∗
precon
i,j,k−
1
∗
q
i,j,k−
1
•
q
i,j,k
=
t
∗
precon
i,j,k
(Next solve
L
T
z
=
q
)
•
•
For
i=nx
down to
1
,
j=ny
down to
1
,
k=nz
down to
1
:
•
If cell (
i, j, k
) is fluid:
•
Set
t
=
q
i,j,k
−
Aplusi
i,j,k
∗
precon
i,j,k
∗
z
i
+1
,j,k
−
Aplusj
i,j,k
∗
precon
i,j,k
∗
z
i,j
+1
,k
−
Aplusk
i,j,k
∗
precon
i,j,k
∗
z
i,j,k
+1
•
z
i,j,k
=
t
∗
precon
i,j,k
Figure 4.7.
Applying the MIC(0) preconditioner in three dimensions (
z
=
Mr
).
6
Continuing this train of thought, looking for methods that work well on all frequency
components of the error can lead to multigrid that explicitly solves the equations at
multiple resolutions.