Skip to content

Commit de74328

Browse files
committed
Fix FacetSplit.update
1 parent 88e019a commit de74328

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

firedrake/preconditioners/facet_split.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ def initialize(self, pc):
8888
self.set_nullspaces(pc)
8989
self.work_vecs = self.mixed_opmat.createVecs()
9090
elif self.subset:
91+
self.P = PETSc.Mat()
9192
global_indices = V.dof_dset.lgmap.apply(self.subset.indices)
9293
self._global_iperm = PETSc.IS().createGeneral(global_indices, comm=pc.comm)
93-
self._permute_op = partial(PETSc.Mat().createSubMatrixVirtual, P, self._global_iperm, self._global_iperm)
94+
self._permute_op = partial(self.P.createSubMatrixVirtual, P, self._global_iperm, self._global_iperm)
9495
self.mixed_opmat = self._permute_op()
9596
self.set_nullspaces(pc)
9697
self.work_vecs = self.mixed_opmat.createVecs()
@@ -143,11 +144,10 @@ def _restrict_nullspace(nsp):
143144

144145
def update(self, pc):
145146
if hasattr(self, "_permute_op"):
146-
for mat in self.pc.getOperators():
147-
mat.destroy()
148147
P = self._permute_op()
149148
self.pc.setOperators(A=P, P=P)
150-
self.mixed_opmat = P
149+
with dmhooks.add_hooks(self.pc.getDM(), self, appctx=self._ctx_ref, save=True):
150+
self.pc.setFromOptions()
151151
elif hasattr(self, "P"):
152152
self._assemble_mixed_op(tensor=self.P)
153153

0 commit comments

Comments
 (0)