zoomy_core.symsolver.numpy_backend.assembly

zoomy_core.symsolver.numpy_backend.assembly#

Assembly of a cell operator by colouring and the host AMG solve, shared by the numpy and JAX runtimes (pure numpy / scipy / pyamg).

References

  • Griewank, Walther 2008, https://doi.org/10.1137/1.9780898717761

  • Bell, Olson, Schroder 2022, https://doi.org/10.21105/joss.04142

Module Contents#

Functions#

cell_pattern

Sparsity of a cell operator on k = n / nc cell-major unknowns: each couples to those of the cells in its LSQ stencil.

cell_colors

Distance-2 colouring of the stencil pairs (c, d) by speculative parallel greedy (a clash with a heavier random-weight neighbour retries).

host_amg_solve

GMRES preconditioned by a smoothed-aggregation AMG hierarchy of the cell-block-scaled matrix; the hierarchy in cache is lagged: rebuilt every ls['amg_rebuild'] solves, or once the iterations exceed ls['amg_growth'] times those after the last rebuild.

API#

zoomy_core.symsolver.numpy_backend.assembly.cell_pattern(n, nc, nbrs, n_rows=None)#

Sparsity of a cell operator on k = n / nc cell-major unknowns: each couples to those of the cells in its LSQ stencil.

Returns

rows, cols in CSR order and a colour per column such that columns sharing a row differ.

zoomy_core.symsolver.numpy_backend.assembly.cell_colors(c, d, nc, seed=0)#

Distance-2 colouring of the stencil pairs (c, d) by speculative parallel greedy (a clash with a heavier random-weight neighbour retries).

zoomy_core.symsolver.numpy_backend.assembly.host_amg_solve(vals, rhs, rows, cols, n, k, ls, pyamg, cache, transpose=False)#

GMRES preconditioned by a smoothed-aggregation AMG hierarchy of the cell-block-scaled matrix; the hierarchy in cache is lagged: rebuilt every ls['amg_rebuild'] solves, or once the iterations exceed ls['amg_growth'] times those after the last rebuild.

Args

  • vals, rows, cols: the (n, n) matrix in COO form, k x k blocks per cell

  • ls: tol, restart, maxiter, amg_rebuild, amg_growth

  • cache: a dict kept between the solves of one operator

Returns

the solution, rhs’s dtype

References

  • Saad, Schultz 1986, https://doi.org/10.1137/0907058

  • Bell, Olson, Schroder 2022, https://doi.org/10.21105/joss.04142