David Liu <[email protected]> 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).
pgpr19IFe_sdZ.pgp
Description: PGP signature
