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#
Sparsity of a cell operator on |
|
Per cell the cells an operator of the derivative aux couples it to, the sparsity
|
|
Distance-2 colouring of the stencil pairs |
|
GMRES preconditioned by a smoothed-aggregation AMG hierarchy of the cell-block-scaled
matrix; the hierarchy in |
API#
- zoomy_core.symsolver.numpy_backend.assembly.cell_pattern(n, nc, nbrs, n_rows=None)#
Sparsity of a cell operator on
k = n / nccell-major unknowns: each couples to those of the cells in its LSQ stencil.Returns
rows, colsin CSR order and a colour per column such that columns sharing a row differ.
- zoomy_core.symsolver.numpy_backend.assembly.operator_neighbors(topo, mesh_np)#
Per cell the cells an operator of the derivative aux couples it to, the sparsity
cell_patternassembles: the samples of its LSQ fit, i.e. the topology’s stencil (topo.lsq_neighbors, which wraps a periodic seam; the mesh’slsq_neighborsends there) and the cell behind each boundary-face sample’s ghost (boundary_face_cells: the inner cell, or the partner across a periodic seam). With the mesh’s stencil alone the assembled matrix lacked the cross-seam entries: the AMG solve of a periodic pressure system converged to the wrong matrix (true relative residual 0.78 on a periodic VAM(3) channel). Rows padded with -1.
- 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
cacheis lagged: rebuilt everyls['amg_rebuild']solves, or once the iterations exceedls['amg_growth']times those after the last rebuild.Args
vals,rows,cols: the(n, n)matrix in COO form,k x kblocks per cellls:tol,restart,maxiter,amg_rebuild,amg_growthcache: a dict kept between the solves of one operator
Returns
the solution,
rhs’s dtypeReferences
Saad, Schultz 1986, https://doi.org/10.1137/0907058
Bell, Olson, Schroder 2022, https://doi.org/10.21105/joss.04142