# h1amg

I saw here 2.1.1 Preconditioners in NGSolve — NGS-Py 6.2.2302-87-ga5a5eff3b documentation that NGSolve has an algebraic multigrid method implemented. I implemented Poisson equation using H1 space with order 4, I set the preconditioner

c = Preconditioner(a, “h1amg”)

and use the CG solver:

inv = CGSolver(a.mat, c.mat, maxsteps=100)

Sometimes the solver converges but the L2-error of the solution isn’t great, and sometimes the solver doesn’t converge. Here some output of when it doesn’t converge:

H1AMG: level = 19, num_edges = 925, nv = 150
H1AMG: level = 20, num_edges = 905, nv = 147
H1AMG: level = 21, num_edges = 888, nv = 145
H1AMG: level = 22, num_edges = 878, nv = 144
0 nan

I have two questions:

1. Is c = Preconditioner(a, “h1amg”) the correct way to set the h1amg preconditioner?
2. If I apply static condensation and apply h1amg I get a segmentation fault. Do I need to do something different for the h1amg preconditioner when I also apply static condensation?

When I apply geometric multigrid via c = Preconditioner(a, “multigrid”) everything works perfectly (both with and without static condensation). Any insight is greatly appreciated.

I think both h1amg and the geometric multigrid are implemented for the P1 only.

For higher order, you may either do p-version of bddc (with h1amg as a coarse grid solver) or auxilary space preconditioner.

https://docu.ngsolve.org/latest/i-tutorials/unit-2.1.3-bddc/bddc.html?highlight=bddc

https://docu.ngsolve.org/latest/i-tutorials/unit-2.10-dualbasis/dualbasis.html