[petsc-users] reusing LU factorization?

Jed Brown jed at jedbrown.org
Wed Jan 29 16:40:05 CST 2014


David Liu <daveliu at mit.edu> writes:

> One thing I'm very confused about though: as I mentioned in the first post,
> I am solving the matrix multiple times and changing the elements, but not
> the nonzero structure in between solves. We've established that the
> numerical LU is done on the first solve only. Also, I forgot to mention
> that I am *not* calling KSPSetOperator before the subsequent solves, which
> is why the subsequent solves are so fast.

You are solving with the old preconditioner.  You should make this
explicit by calling KSPSetOperators with SAME_PRECONDITIONER.  Make sure
to use a Krylov method and check the norms so that you actually solve
the problem you intend to (given that you're using an old preconditioner).

> According to section 4.2 of the manual, this is actually not allowed if I
> change anything about the matrix (which I am doing since I didn't know
> about this). Then why are my solves still getting the correct results that
> I am expecting?

You are using GMRES.  The direct solve with the old matrix is used as a
preconditioner and seems to converge fairly well on the second solve (it
looks like it takes 5 iterations).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140129/ff7d1c1c/attachment.pgp>


More information about the petsc-users mailing list