Simplified Diagonal-based Incomplete LU (DILU) Preconditioner in OpenFOAM
The DILU (Diagonal-based Incomplete LU) preconditioner in OpenFOAM is a simplified variant of the incomplete LU factorization preconditioner that’s computationally efficient while maintaining reasonable effectiveness for solving linear systems.
Mathematical Formulation
For a matrix A, the DILU preconditioner approximates the LU decomposition as:
M = (D + L_A) D⁻¹ (D + U_A)
Where:
D
is the diagonal matrix constructed during the factorizationL_A
is the strictly lower triangular part of AU_A
is the strictly upper triangular part of A
Key Implementation Details in OpenFOAM
-
Diagonal Calculation:
The diagonal entries Dᵢᵢ are computed to satisfy:Dᵢᵢ = Aᵢᵢ - Σ_{j<i} (L_Aᵢⱼ/Dⱼⱼ) U_Aⱼᵢ
This is computed in a single pass through the matrix.
-
Forward and Backward Substitution:
The preconditioning operation M⁻¹r involves:- Forward substitution: (D + L_A)y = r
- Diagonal scaling: z = D⁻¹y
- Backward substitution: (D + U_A)x = z
-
Matrix Storage:
OpenFOAM uses its compressed sparse row (CSR) format to store only the non-zero elements, making the operations memory efficient. -
Simplifications:
- No fill-in is allowed (compared to ILU(k))
- The diagonal is modified to ensure M is as close to A as possible while maintaining the triangular structure
Algorithm Pseudocode
// Preconditioner setup
for i = 1 to n:
D[i] = A[i,i]
for all j < i where A[i,j] ≠ 0:
for all k < j where A[j,k] ≠ 0:
if A[i,k] ≠ 0:
D[i] -= A[i,j] * (1/D[j]) * A[j,k] * A[k,i]
D[i] = 1/D[i] // Store inverse for efficiency
// Preconditioner application (solve Mx = r)
// Forward substitution (L)y = r
for i = 1 to n:
y[i] = r[i]
for all j < i where A[i,j] ≠ 0:
y[i] -= A[i,j] * y[j]
y[i] *= D[i] // Using precomputed inverse
// Backward substitution (U)x = y
for i = n downto 1:
x[i] = y[i]
for all j > i where A[i,j] ≠ 0:
x[i] -= A[i,j] * x[j]
Practical Considerations in OpenFOAM
-
The DILU preconditioner is particularly effective for symmetric matrices but can be used with asymmetric ones as well.
-
It’s often used with the GAMG (Geometric Agglomerated Multi-Grid) solver or as a preconditioner for Krylov subspace methods like BiCGStab.
-
The computational cost is O(nnz) where nnz is the number of non-zeros, making it suitable for large sparse systems.
-
Compared to full ILU, DILU has lower memory requirements and faster setup time, at the cost of somewhat reduced effectiveness as a preconditioner.
The DILU implementation in OpenFOAM is optimized for the matrix structures typically encountered in CFD simulations, particularly those arising from finite volume discretizations.