# Algebraic multigrid in PETSc

Consider a potential/poisson equation on a very large, complicated geometry. Currently, an self-written FEM and linear solvers from NumPy are used. Performance is, of course, not good enough for larger problems.

I'd like to switch to PETSc and use algebraic multigrid preconditioners. Surprisingly, I could not find good documentation or examples on algebraic multigrid in PETSc. Are there any good examples? Or is it maybe to early to use algebraic multigrid, if I don't want to go into development too deep?

(This question is mainly intended to find more documentation about algebraic multigrid in PETSc, but please let me know if my approach is generally a bad idea.)

• -pc_type gamg is a native (smoothed) aggregation method.
• -pc_type ml is a smoothed aggregation implementation from the ML project (part of Trilinos). Configure PETSc with --download-ml to make this solver available.
• -pc_type hypre is a classical AMG implementation (BoomerAMG from Hypre). Configure PETSc with --download-hypre to make this solver available.
• @Michael Can you be more specific about what you hope to learn? Every example is a "complete example" in a limited sense and lots of the tests use multigrid. Many of the slide decks on the tutorials page discuss multigrid configuration and diagnostics. Ultimately, you have to get your hands dirty using the solver diagnostics and multigrid configuration options (-help shows all relevant options; you can pipe its output through grep). Commented Jul 13, 2017 at 23:25
• As I stated above, every example in PETSc is an AMG example because it requires no specific code, just run any example with the run-time argument -pc_type gamg. If you're interested is solving a particular kind of equation, perhaps 3D elasticity, then there are specific examples. If not, I'd recommend starting with src/snes/examples/tutorials/ex5.c which solves the Bratu equation. Commented Jul 17, 2017 at 18:00