Skip to content

Commit

Permalink
Merge pull request #448 from sblauth/fix/petsc_destroy
Browse files Browse the repository at this point in the history
Add destroy method and garbage cleanup for snes interface
  • Loading branch information
sblauth authored Jul 4, 2024
2 parents 9b47aa9 + 4febda3 commit 333b1a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cashocs/nonlinear_solvers/snes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ def solve(self) -> fenics.Function:
if converged_reason < 0:
raise _exceptions.PETScSNESError(converged_reason)

if hasattr(PETSc, "garbage_cleanup"):
snes.destroy()
PETSc.garbage_cleanup(comm=self.comm)
PETSc.garbage_cleanup()

return self.u


Expand Down

0 comments on commit 333b1a7

Please sign in to comment.