[petsc-users] Multiple KSP Solver

Barry Smith bsmith at mcs.anl.gov
Thu Jun 6 15:08:13 CDT 2013


  Just call KSPSolve() with each right hand side. You don't need to do anything else. If you change the matrix then you need to call KSPSetOperators() with the updated matrix.

   Barry

On Jun 6, 2013, at 3:02 PM, Anthony Vergottis <a.vergottis at gmail.com> wrote:

> Dear All,
> 
> This message is related to the multiple use of a single KSP solver context.
> 
> My question is: If I set up a KSP solver is it possible to use it as many times as I require?
> 
> What I mean: If I create a KSP solver called solver and associate with it the required Matrix i.e. the A matrix of the system and the right had side vector b. I then solve the system calling  KSPSolve(solver,b,Solution); for example.
> 
> Say now I want to re-use the same context solver but I supply a different right had side vector b and again call the same command
> KSPSolve(solver,b,Solution);, is this sufficient to perform the new solve correctly and get a new solution vector x? Will it reuse the before specified matrix A in the system (and the same solver eg. GMRES and preconditioner)? or do I need to recreate a new solver each time? is there any specific behaviour of Petsc I need to be aware off?
> 
> Solution algorithm is an iterative one and I require to solve 5 different equations at different time-step, the only thing that changes from each time step is the right had side vector of the system. So the matrix A for all the equations are the same at each time step.
> 
> I hope I explained this good enough. Sorry if this is a trivial questions.
> 
> Thanks in advance.
> 
> Regards,
> Anthony
> 



More information about the petsc-users mailing list