Conversation
Member
Author
|
Hi @mateomarin97 - we have done some house cleaning recently on Github and had to move to a new base branch In case you still have local code on the old branch that you do not want to lose, you can |
The old MultiGridSolver (eval-string operators, serial-only transfer operators, 2D coarsening) and the research script feec/tests/test_multigrid.py are replaced by a new implementation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Allows building a coarse Derham whose MPI decomposition is aligned with a finer one (DomainDecomposition.coarsen), as needed for geometric multigrid. Bumps feectools to the ddm-coarsen branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feectools sets DomainDecomposition.comm to None under MockMPI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MultiGridHierarchy coarsens a Derham in all directions where possible (semi-coarsening otherwise), with MPI decompositions aligned to the finest level. SplineProlongation is the exact embedding of nested spline spaces (1D matrices by collocation, any degree, periodic or clamped, B- and D-splines), applied per direction on the local ghosted arrays; its transpose is the restriction. Homogeneous Dirichlet BCs are handled with the boundary operators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WeightedMassOperator records how it was created by WeightedMassOperators.create_weighted_mass (spaces, name, weights as given, transposition), so it can be re-created on another Derham with from_dict. The recipe is dropped when the data is modified afterwards (assemble with new weights, in-place arithmetic) or the weights are bound to the grid (quadrature values, spline functions). BasisProjectionOperator gets the same, for callable weights. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OperatorCoarsener rebuilds sums, compositions, scalings, powers and block operators from coarsened children; derivative, boundary, identity and zero operators on the coarse spaces; mass and basis projection operators from to_dict(). Leaves are cached, so changed scalars do not trigger re-assembly. Tests check the Galerkin property R A P = A_H. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chebyshev smoother (default, inner preconditioner: approximate mass inverse, Jacobi or identity; eigenvalue estimate by Lanczos), damped Jacobi and fixed-step PCG smoothers. Exact diagonals of composite operators by colored probing. MultiGridPreconditioner applies a symmetric V-cycle with a replicated direct (or CG) coarse solve and an optional constant null space; MultiGridSolver wraps it in PCG with a relative tolerance. Options in the MultiGridOptions dataclass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
precond="MultiGrid" uses MultiGridPreconditioner (options in the new multigrid field). The preconditioner is updated only when sigma_1 (e.g. sigma_1/dt) changes. Other precond values keep the previous behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spossann
marked this pull request as ready for review
October 3, 2026 17:05
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the previous multigrid attempt (#60, and the earlier state of this PR) with a new geometric multigrid that runs under MPI. Its V-cycle is used as a preconditioner for CG.
Paired feectools PR: struphy-hub/feectools#91 (into
devel-tiny). The submodule points to its branchddm-coarsen; thefeectoolspin inpyproject.tomlcan be raised once 0.3.0 is on PyPI.What it does
MultiGridSolver(A, derham, domain, MultiGridOptions(...))solvesA x = bfor a symmetric positive (semi-)definiteAon one Derham space. Typical example:sigma * M0 + grad.T @ M1 @ grad.Grid hierarchy (
multigrid/hierarchy.py): halves the number of elements in every direction where possible, and stops in a direction that gets too small (semi-coarsening). The MPI decomposition of each coarse level is aligned with the fine one, viaDomainDecomposition.coarsenand the newDerham(..., domain_decomposition=...)argument.Grid transfer (
multigrid/transfer.py):SplineProlongationis the exact embedding of the nested spline spaces, for any degree, periodic or clamped, B- and D-splines, with homogeneous Dirichlet BCs.Coarse operators (
multigrid/coarsen.py): the fine operator is walked as an expression tree and rebuilt on each coarse grid. No string recipes are needed.to_dict()/from_dict().Smoothers (
multigrid/smoothers.py), selected viaMultiGridOptions:The exact diagonals of composite operators are computed by colored probing.
V-cycle (
multigrid/preconditioner.py): symmetric pre- and post-smoothing. The coarsest level is solved directly on every rank (or by CG). There is an optionalnullspace="constants"for singular problems.Propagators:
ImplicitDiffusionandPoissonSolvegetprecond="MultiGrid"and amultigrid: MultiGridOptionsfield. The preconditioner is only updated whensigma_1(e.g.sigma_1/dt) changes. The otherprecondvalues keep their previous behavior (pc=None).Removed: the old
multigrid_solver.py(eval-string operators, serial-only transfer, 2D coarsening) and the 3,246-line research filefeec/tests/test_multigrid.py.Results
Poisson, CG iterations to a relative tolerance of 1e-8, default options:
Notes and known limitations
MassMatrixPreconditioneris the main cost: it calls SuperLU on many right-hand sides. A banded solver in feectools would help.Tests
linear_algebra/tests/, run serially and on 4 ranks:test_multigrid_transfer.py: exactness of the transfer, R = Pᵀ, R M_h P = M_H.test_multigrid_coarsen.py:to_dictround trips, R A P = A_H forGᵀM₁GandCᵀM₂C.test_multigrid_solver.py: smoother symmetry, V-cycle symmetric positive definite and contracting, iteration counts that don't grow with the grid,update.propagators/tests/test_poisson.py:PoissonSolvewith multigrid on the Colella mapping (periodic, Dirichlet, Neumann), andImplicitDiffusionwith a changingdt.🤖 Generated with Claude Code