From 21e289b61ecb44f8838d3a9cd38bfb446efbdbad Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Fri, 25 Apr 2025 11:03:09 +0100 Subject: [PATCH] BDDC: Fix block sizes --- firedrake/preconditioners/fdm.py | 5 +++-- tests/firedrake/regression/test_bddc.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/firedrake/preconditioners/fdm.py b/firedrake/preconditioners/fdm.py index 4e28f73a19..84ceae7360 100644 --- a/firedrake/preconditioners/fdm.py +++ b/firedrake/preconditioners/fdm.py @@ -777,10 +777,11 @@ def setup_block(self, Vrow, Vcol): P.setISAllowRepeated(self.allow_repeated) P.setLGMap(rmap, cmap) if on_diag and ptype == "is" and self.allow_repeated: - bsize = Vrow.finat_element.space_dimension() * Vrow.value_size + bsize = Vrow.finat_element.space_dimension() * Vrow.block_size local_mat = P.getISLocalMat() nblocks = local_mat.getSize()[0] // bsize - local_mat.setVariableBlockSizes([bsize] * nblocks) + sizes = numpy.full((nblocks,), bsize, dtype=PETSc.IntType) + local_mat.setVariableBlockSizes(sizes) P.setPreallocationNNZ((dnz, onz)) if not (ptype.endswith("sbaij") or ptype == "is"): diff --git a/tests/firedrake/regression/test_bddc.py b/tests/firedrake/regression/test_bddc.py index f1f1630e2d..ff82094ba9 100644 --- a/tests/firedrake/regression/test_bddc.py +++ b/tests/firedrake/regression/test_bddc.py @@ -111,8 +111,8 @@ def solve_riesz_map(mesh, family, degree, bcs, condense): @pytest.fixture(params=(2, 3), ids=("square", "cube")) def mesh(request): - nx = 4 dim = request.param + nx = 4 msh = UnitSquareMesh(nx, nx, quadrilateral=True) if dim == 3: msh = ExtrudedMesh(msh, nx) @@ -126,5 +126,5 @@ def mesh(request): def test_bddc_fdm(mesh, family, degree, condense): bcs = True tdim = mesh.topological_dimension() - expected = 6 if tdim == 2 else 11 + expected = 7 if tdim == 2 else 11 assert solve_riesz_map(mesh, family, degree, bcs, condense) <= expected