[petsc-users] Use two KSP solver in the same code.

Matthew Knepley knepley at gmail.com
Mon Nov 7 10:45:38 CST 2011


On Mon, Nov 7, 2011 at 4:39 PM, NAN ZHAO <zhaonanavril at gmail.com> wrote:

> Hi all,
>
> I want to solve a coupled system and prepare to solve the two system in
> certain order in one code. I need to use the KSP solver twice, Does anyone
> know a good example in the example file. Do I need to create two Petsc
> object in a c++ code?
>

If you want to solve the same system twice, call KSPSolve() twice. If you
want to solve two different systems, make
two KSPs. If you absolutely must reuse the allocated space for Krylov
vectors or something like that, call KSPSetOperators()
again and KSPSolve() again.

   Matt


> Thanks,
>
> Nan
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111107/4b5e0f4b/attachment-0001.htm>


More information about the petsc-users mailing list