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

Satish Balay balay at mcs.anl.gov
Mon Nov 7 11:32:14 CST 2011


On Mon, 7 Nov 2011, Alexander Grayver wrote:

> On 07.11.2011 17:47, Jed Brown wrote:
> > On Mon, Nov 7, 2011 at 09:39, NAN ZHAO <zhaonanavril at gmail.com
> > <mailto:zhaonanavril at gmail.com>> wrote:
> > 
> >     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?
> > 
> > 
> > Just create two KSP objects, one for each system you want to solve.
> 
> Sorry for disturbing, but I've also got similar question. How can one specify
> individual options through command line for two different KSPs?


Use:

KSPSetOptionsPrefix(ksp1, "solver1_")
KSPSetOptionsPrefix(ksp1, "solver2_")


Now - you can specify stuff like:

-solver1_ksp_type gmres -solver2_ksp_type cg


Satish


More information about the petsc-users mailing list