[petsc-users] MatStructure flag in KSPSetOperators

Jed Brown jedbrown at mcs.anl.gov
Wed Feb 22 09:25:13 CST 2012


On Wed, Feb 22, 2012 at 08:52, Kuhlemann, Verena <vkuhlem at emory.edu> wrote:

> I am not sure that I understand the MatStructure flag in the call of
> KSPSetOperators
> correctly.
>
>  If I use KSPSetOperators(ksp, A, P, DIFFERENT_NONZERO_PATTERN) and then
> solve two linear systems with the same matrix operators but different rhs
> is
> the preconditioner reassembled in every solve. I.e., if I call
> KSPSolve(ksp,b1,x1);
> KSPSolve(ksp,b2,x2);
>

If you don't put anything between these calls, the preconditioner will be
reused.


>
>  And if I use KSPSetOperators(ksp, A, P, SAME_PRECONDITIONER) the
> preconditioner is
> only setup one time and reused later.
>
>  Or is the flag only important if I change the matrix operators in
> between.
>

You only need to call KSPSetOperators() when the matrix changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120222/0e900680/attachment-0001.htm>


More information about the petsc-users mailing list