Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d8c498f
ASMStarPC: group patches by mesh coloring
pbrubeck Feb 25, 2026
e612089
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Feb 28, 2026
de229fd
fix
pbrubeck Feb 28, 2026
f2211a8
netgen fixes
pbrubeck Mar 6, 2026
b710d29
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Mar 6, 2026
5349a7c
Adaptive ASM
pbrubeck Mar 9, 2026
1def505
Let PETSc shift the coloring
pbrubeck Mar 10, 2026
b176a19
Set to zero
pbrubeck Mar 10, 2026
46d53f2
clean up
pbrubeck Mar 11, 2026
ee490f9
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Mar 16, 2026
8e8d5da
Coloring for extruded patches
pbrubeck Mar 16, 2026
e917d46
use_coloring
pbrubeck Mar 16, 2026
e2a19f4
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Mar 25, 2026
9d3bb76
tests
pbrubeck Mar 25, 2026
fc1584c
merge conflict
pbrubeck Apr 6, 2026
e537b6b
remove adaptive code
pbrubeck Apr 6, 2026
d61752a
lint
pbrubeck Apr 6, 2026
65f0a93
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Apr 10, 2026
5c3fb85
docstring
pbrubeck Apr 10, 2026
49351ba
docstring
pbrubeck Apr 10, 2026
e7a77a4
Merge branch 'pbrubeck/patch-coloring' of github.com:firedrakeproject…
pbrubeck Apr 14, 2026
878f879
delete point_subset add vanka tests
pbrubeck Apr 14, 2026
8b79108
Add extruded test
pbrubeck Apr 14, 2026
f6768ca
docstring
pbrubeck Apr 14, 2026
8eb4526
getDefaultSection() -> getLocalSection()
pbrubeck Apr 14, 2026
96200cd
docs
pbrubeck Apr 14, 2026
e7cfaf3
assert equality
pbrubeck Apr 14, 2026
f6688bd
Apply suggestion from @pbrubeck
pbrubeck Apr 14, 2026
7cec601
Apply suggestions from code review
pbrubeck Apr 14, 2026
5daf8bf
fix natural ordering
pbrubeck Apr 14, 2026
562bde4
Apply suggestions from code review
pbrubeck Apr 15, 2026
f176254
Apply suggestion from @pbrubeck
pbrubeck Apr 15, 2026
dd17270
Fix adjacency for Vanka
pbrubeck Apr 15, 2026
55a014f
Use distance=3 for Vanka
pbrubeck Apr 15, 2026
ef51ab3
set default coloring_type
pbrubeck Apr 15, 2026
6f9e3dc
add nullspace to test
pbrubeck Apr 15, 2026
d338147
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Apr 16, 2026
e5daec6
Coloring demos
pbrubeck Apr 16, 2026
02d497e
Update firedrake/preconditioners/asm.py
pbrubeck Apr 16, 2026
622cf70
Update demos/fast_diagonalisation/fast_diagonalisation_poisson.py.rst
pbrubeck Apr 16, 2026
624efb8
Update demos/fast_diagonalisation/fast_diagonalisation_poisson.py.rst
pbrubeck Apr 16, 2026
bf32bab
Update firedrake/preconditioners/asm.py
pbrubeck Apr 16, 2026
c058272
Apply suggestions from code review
pbrubeck Apr 17, 2026
0a032e1
Apply suggestions from code review
pbrubeck Apr 17, 2026
db08935
whitespace
pbrubeck Apr 17, 2026
bcd5544
Merge branch 'main' into pbrubeck/patch-coloring
pbrubeck Apr 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions demos/fast_diagonalisation/fast_diagonalisation_poisson.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ using a sparse direct LU factorization. ::
.. note::
On this Cartesian mesh, the sparse operator constructed by :class:`~.FDMPC`
corresponds to the original operator. This is no longer the case with non-Cartesian
meshes or more general PDEs, as the FDM basis will fail to diagonalise the
problem. For such cases, :class:`~.FDMPC` will produce a sparse
meshes or more general PDEs, as the FDM basis only diagonalises very specific
problems. For such cases, :class:`~.FDMPC` will produce a sparse
approximation of the original operator.

Moving on to a more complicated solver, we'll employ a two-level solver with
the lowest-order coarse space via :class:`~.P1PC`. As the fine level
relaxation we define an additive Schwarz method on vertex-star patches
implemented via :class:`~.ASMExtrudedStarPC` as we have an extruded mesh::
implemented via :class:`~.ASMExtrudedStarPC` as we have an extruded mesh.
In addition we specify `"use_coloring"` to group non-overlapping subsets of
patches into sparse block-diagonal matrices via a mesh coloring, which reduces
the overhead of calling many KSP solves for each patch.::

asm_params = {
"pc_type": "python",
Expand All @@ -114,7 +117,8 @@ implemented via :class:`~.ASMExtrudedStarPC` as we have an extruded mesh::
"ksp_type": "chebyshev",
"pc_type": "python",
"pc_python_type": "firedrake.ASMExtrudedStarPC",
"sub_sub_pc_type": "lu",
"pc_star_use_coloring": True,
Comment thread
pbrubeck marked this conversation as resolved.
"pc_star_sub_sub_pc_type": "lu",
},
}

Expand Down
26 changes: 19 additions & 7 deletions demos/patch/poisson_mg_patches.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,27 @@ in dense format. ::
:class:`~.ASMStarPC`, on the other hand, does no re-discretization, but extracts the
submatrices for each patch from the already-assembled global stiffness matrix.

The `"tinyasm"` backend uses LAPACK to invert all the patch operators, which is ideal
for low-order discretizations ::

The tinyasm backend uses LAPACK to invert all the patch operators. If this option
is not specified, PETSc's ASM framework will set up a small KSP for each patch.
tinyasm_relax = mg_params({
"pc_type": "python",
"pc_python_type": "firedrake.ASMStarPC",
"pc_star_backend": "tinyasm"})

If the backend option is not specified, PETSc's ASM framework will set up a KSP for each patch.
This can be useful when the patches become larger and one wants to use a sparse
direct solver or a Krylov iteration on each one. ::
direct solver or a Krylov iteration on each one.

Moreover, the option `"use_coloring"` applies a mesh coloring to combine
subsets of non-overlapping patches into sparse block-diagonal matrices. This
results in a mathematically equivalent preconditioner, while reducing the
overhead costs of calling the sparse factorization library many times. ::

asm_relax = mg_params({
color_relax = mg_params({
"pc_type": "python",
"pc_python_type": "firedrake.ASMStarPC",
"pc_star_backend": "tinyasm"})
"pc_star_use_coloring": True})

Now, for each parameter choice, we report the iteration count for the Poisson problem
over a range of polynomial degrees. We see that the Jacobi relaxation leads to growth
Expand All @@ -134,7 +145,8 @@ latter options do the same operations, just via different code paths. ::

names = {"Jacobi": jacobi_relax,
"Patch": patch_relax,
"ASM Star": asm_relax}
"Tiny ASM": tinyasm_relax,
"Color ASM": color_relax}

for name, method in names.items():
print(name)
Expand All @@ -158,7 +170,7 @@ For Jacobi, we expect output such as
7 19
======== ================

While for either :class:`~.PatchPC` or :class:`~.ASMStarPC`, we expect
While for either :class:`~.PatchPC` or :class:`~.ASMStarPC` (with dense inversion or with coloring + sparse factorization), we expect

======== ================
Degree Iterations
Expand Down
Loading
Loading