[petsc-users] reuse ksp in time marching loop

Barry Smith bsmith at mcs.anl.gov
Tue Jun 10 15:59:29 CDT 2014


  everything except the solve

On Jun 10, 2014, at 3:52 PM, Shriram Srinivasan <shriram at ualberta.ca> wrote:

> Hi all,
> I am implementing a time marching loop (My problem is not amenable  to usage of the TS module) where the coefficient matrix A wont change with time. I was wondering, in the sequence of commands
> 
> KSPCreate(PETSC_COMM_SELF, &ksp); 
> KSPSetOperators(ksp, A,  A, SAME_PRECONDITIONER); 
> KSPGetPC(ksp, &pc);
> PCSetType(pc, PCLU); 
> PCFactorSetMatSolverPackage(pc, MATSOLVERMUMPS);
> KSPSetFromOptions(ksp);
> KSPSolve(ksp, b, x);
> KSPDestroy(&ksp);
> 
> would it be  efficient/possible to move some of them out of the loop.  
> If so, which ones can I move out.
> 
> Thanks,
> Shriram
> 



More information about the petsc-users mailing list