[petsc-users] On MatDestroy() in Fortran

Barry Smith bsmith at petsc.dev
Sat Jul 30 15:59:46 CDT 2022


  Yes, as you describe below. 

> On Jul 30, 2022, at 4:31 PM, Edoardo alinovi <edoardo.alinovi at gmail.com> 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! 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220730/4b4ba7e6/attachment.html>


More information about the petsc-users mailing list