Yes, as you describe below. 

> On Jul 30, 2022, at 4:31 PM, Edoardo alinovi <[email protected]> 
> wrote:
> 
> Hello Barry,
> 
>  I assume you are calling KSPSetOperators() before each new KSPSolve() so 
> that it knows to solve a new system?
> 
> Yes, I do.
> 
> This looks like a good trick: 
> KSPSetOperators(ksp,PETSC_NULL_MAT,PETSC_NULL_MAT)
> 
> So you would do: 
> 
> 1) KSPSetOperators(ksp,A,A)
> 
> 2) KSPSolve(myksp, myrhs, mysol)
> 
> 3) KSPSetOperators(ksp,PETSC_NULL_MAT,PETSC_NULL_MAT)
> 
> 4) MatDestroy(A)
> 
> Am I right?
> 
> I'll have a try and I'll try to destroy the ksp of each equation as well. The 
> second is more tedious because I'll have to reconstruct it every time. I'll 
> do some tests to see if that helps. 
> 
> Thanks a lot! 
> 
> 
> 

Reply via email to