<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  Yes, as you describe below. <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 30, 2022, at 4:31 PM, Edoardo alinovi <<a href="mailto:edoardo.alinovi@gmail.com" class="">edoardo.alinovi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello Barry,<div class=""><br class=""></div><div class=""><i class=""><b class=""> I assume you are calling KSPSetOperators() before each new KSPSolve() so that it knows to solve a new system?</b></i><br class=""></div><div class=""><i class=""><b class=""><br class=""></b></i></div><div class="">Yes, I do.</div><div class=""><br class=""></div><div class="">This looks like a good trick: KSPSetOperators(ksp,PETSC_NULL_MAT,PETSC_NULL_MAT)</div><div class=""><br class=""></div><div class="">So you would do: </div><div class=""><br class=""></div><div class="">1) KSPSetOperators(ksp,A,A)<br class=""></div><div class=""><br class=""></div><div class="">2) KSPSolve(myksp, myrhs, mysol)<br class=""></div><div class=""><br class=""></div><div class="">3) KSPSetOperators(ksp,PETSC_NULL_MAT,PETSC_NULL_MAT)<br class=""></div><div class=""><br class=""></div><div class="">4) MatDestroy(A)</div><div class=""><br class=""></div><div class="">Am I right?</div><div class=""><br class=""></div><div class="">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. </div><div class=""><br class=""></div><div class="">Thanks a lot! </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>