[petsc-users] repeatedly direct solving a matrix that changes?

David Liu xdavidliu at gmail.com
Sat Oct 10 14:37:27 CDT 2015


I have a matrix A that I am trying to solve (currently using Mumps).
Between solves, I'm changing some of the elements of A, but not changing
the nonzero pattern.

In the past, with Petsc 3.4 and below, I was able to pass options like
fiddling around with this (I don't recall exactly how), as well as
re-calling KSPSetOperators between solves (iirc), I was able to switch at
will between one of two things:

1) re-doing the LU factorization at each solve, so that the iterative part
of the KSPSolve takes only one iteration to converge (because the
"preconditioner" is just the inverse matrix) (I believe that's what it's
doing, sorry if I am butchering the nomenclature)

2) doing the LU factorization on the first solve only, so that for the
subsequent solves, the LU factorized matrix from the FIRST solve is used,
so now the iterative part takes more than 1 iteration to converge.

I don't recall exactly the exact steps I took to switch between 1) and 2);
it had something to do with the very last option passed to KSPSetOperators.
All I know is that option 2) actually worked fine for me because my A
matrix was only changing slightly between solves.

However, now I updated to 3.5, and it looks like that very last option to
KSPSetOperators has been removed, as recorded in the following commit on

Now it looks like my code is exclusively doing 2) (if I am not mistaken),
even though I am currently repeatedly calling KSPSetOperators between
solves. How do I get my code to do 1)?

David Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151010/2c5521da/attachment.html>

More information about the petsc-users mailing list