Skip to content

DomainDecomposition.coarsen, refine fix, ghost-sync fixes in axpy and essential BCs - #91

Merged
spossann merged 3 commits into
devel-tinyfrom
ddm-coarsen
Oct 3, 2026
Merged

spossann merged 3 commits into
devel-tinyfrom
ddm-coarsen

Conversation

@spossann

@spossann spossann commented Oct 3, 2026

Copy link
Copy Markdown
Member

Needed for geometric multigrid in struphy (paired struphy PR: struphy-hub/struphy#91), plus two ghost-region bug fixes found while testing it under MPI.

Changes

  • DomainDecomposition.coarsen(factors) (new). Builds the decomposition of a coarsened grid that is aligned with self: every process owns exactly the coarse cells covering its fine cells. It shares the process topology and communicators, so it is not collective. Raises ValueError if starts/ends are not divisible by the factor.

  • DomainDecomposition.refine fixed.

    • It re-ran compute_dims/Create_cart on the old ncells without mpi_dims_mask, so it could pick a different process grid. It also called Create_cart again, which every rank has to join.
    • It computed local_ncells from the old starts/ends.

    Both methods now use one helper, _with_element_partition, which validates the partition.

  • apply_essential_bc_stencil now sets ghost_regions_in_sync = False on vectors. Boundary coefficients may be ghost entries of neighbouring processes. Those kept stale values while still being marked in sync, so the next matrix-vector product used outdated data.

  • StencilVectorSpace.axpy (behind mul_iadd) updated the sync flag of the input x instead of the output y. y += a*x therefore stayed marked in sync when x was not.

  • Version bumped to 0.3.0.

Tests

  • New: ddm/tests/test_coarsen.py (serial + mpi), api/tests/test_essential_bc_ghosts.py (serial + mpi), linalg/tests/test_axpy_ghost_sync.py.
  • Both bug-fix tests fail without the fix.
  • linalg serial tests: 7544 passed. fem MPI tests on 4 ranks: 144 passed.
  • test_cart_3d.py, test_block.py and test_toarray.py fail to collect locally because the parallel marker is not registered. That was already the case on devel-tiny.

🤖 Generated with Claude Code

spossann and others added 3 commits October 3, 2026 17:29
coarsen(factors) builds an aligned coarse decomposition sharing the
process topology of self (needed for geometric multigrid). refine() now
shares the topology too instead of re-running compute_dims/Create_cart
on the old ncells without mpi_dims_mask, and computes local_ncells from
the new starts/ends. Bump version to 0.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Zeroing boundary coefficients left ghost copies on neighbouring processes
stale while ghost_regions_in_sync stayed True, so a following StencilMatrix
or derivative dot used outdated values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
y += a*x left y marked in sync when x was not (stale ghost data in y)
and wrongly changed the flag of the input x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spossann

spossann commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

Paired struphy PR: struphy-hub/struphy#91 (the struphy CI runs against this branch via the submodule pointer).

@spossann
spossann merged commit a991b71 into devel-tiny Oct 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant