Skip to content

Commit bde359d

Browse files
committed
Fix Q1
1 parent c715954 commit bde359d

File tree

1 file changed

+5
-5
lines changed
  • firedrake/preconditioners

1 file changed

+5
-5
lines changed

firedrake/preconditioners/fdm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ def allocate_matrix(self, Amat, V, J, bcs, fcp, pmat_type, use_static_condensati
218218
Vfacet = None
219219
Vbig = V
220220
ebig = V.ufl_element()
221-
_, fdofs = split_dofs(V.finat_element)
221+
idofs, fdofs = split_dofs(V.finat_element)
222222
elif len(ifacet) == 1:
223223
Vfacet = V[ifacet[0]]
224224
ebig, = set(unrestrict_element(Vsub.ufl_element()) for Vsub in V)
225225
Vbig = FunctionSpace(V.mesh(), ebig)
226-
if len(V) > 1:
227-
dims = [Vsub.finat_element.space_dimension() for Vsub in V]
228-
assert sum(dims) == Vbig.finat_element.space_dimension()
226+
space_dim = Vbig.finat_element.space_dimension()
227+
assert space_dim == sum(Vsub.finat_element.space_dimension() for Vsub in V)
229228
fdofs = restricted_dofs(Vfacet.finat_element, Vbig.finat_element)
229+
idofs = numpy.setdiff1d(numpy.arange(space_dim, dtype=fdofs.dtype), fdofs)
230230
else:
231231
raise ValueError("Expecting at most one FunctionSpace restricted onto facets.")
232232
self.embedding_element = ebig
@@ -245,7 +245,7 @@ def allocate_matrix(self, Amat, V, J, bcs, fcp, pmat_type, use_static_condensati
245245

246246
# Dictionary with kernel to compute the Schur complement
247247
self.schur_kernel = {}
248-
if V == Vbig and Vbig.finat_element.formdegree == 0:
248+
if V == Vbig and Vbig.finat_element.formdegree == 0 and len(idofs) > 0 and pmat_type.endswith("aij"):
249249
# If we are in H(grad), we just pad with zeros on the statically-condensed pattern
250250
self.schur_kernel[V] = SchurComplementPattern
251251
elif Vfacet and use_static_condensation:

0 commit comments

Comments
 (0)