The LU preconditioner provides several options. The first, given by
the
command
ierr = PCLUSetUseInPlace(PC pc);causes the factorization to be performed in-place and hence destroys the original matrix. The options database variant of this command is -pc_lu_in_place. Another direct preconditioner option is selecting the ordering of equations with the command
-mat_order <ordering>The possible orderings are
The sparse LU factorization provided in PETSc does not perform pivoting for numerical stability (since they are designed to preserve nonzero structure), thus occasionally a LU factorization will fail with a zero pivot when, in fact, the matrix is non-singular. The option -pc_lu_nonzeros_along_diagonal <tol> will often help eliminate the zero pivot, by preprocessing the the column ordering to remove small values from the diagonal. Here, tol is an optional tolerance to decide if a value is nonzero; by default it is 1.e-10.
In addition, Section Sparse Matrix Factorization provides information on preallocation of memory for anticipated fill during factorization. Such tuning can significantly enhance performance, since it eliminates the considerable overhead for dynamic memory allocation.