# multi-grid with vector valued space

This is related to a recent post of mine.

If I define a FE space like this: H1(mesh, order=1, dim=2)
then when if I solve my elliptic system with geometric multi-grid, it is fine. However, if I use “h1amg”, then it “silently” crashes; it just exits and says nothing.

However, if I define the space like this:
H1(mesh, order=1) ** 2
then the reverse happens. I can use “h1amg” no problem, but if I use “multigrid”, then it “silently” crashes again.

What is the deal here?

The “h1amg” is now (will be online tomorrow) throwing an exception when applied to H1(dim=2)

The geometric multigrid is working for both versions, H1(dim=2) as well as H1()**2 in my tests. Can you send your example ?

Do I need to update my NGsolve?

It will take some time to produce a “standalone” example.

## Here is a standalone example. It seems to crash when doing the assembly…

import numpy as np

import netgen.gui
from ngsolve import *

from netgen.geom2d import SplineGeometry

# make the mesh

geo = SplineGeometry()
geo.AddRectangle( (0,0), (1,1), bc = “Gamma”)
mesh = Mesh(geo.GenerateMesh(maxh=1.0))
for r in range(4):
mesh.Refine()

Draw(mesh)
print(mesh.GetBoundaries())

zero_vec = CoefficientFunction((0.0, 0.0))

fes_V = H1(mesh, order=1) ** 2

a_form = BilinearForm (fes_V, symmetric=False)

# setup weak formulation

qq = fes_V.TrialFunction()
pp = fes_V.TestFunction()

a_form += InnerProduct(qq,pp) * dx

f_form = LinearForm(fes_V)

f_vec = CoefficientFunction((x, y))
f_form += InnerProduct(f_vec,pp) * dx

# this does NOT work (silently crashes; it doesn’t make it to the “Attempt to solve…” statement below)

c = Preconditioner(a_form, “multigrid”) # Register ‘c’ to ‘a’ BEFORE assembly

# c = Preconditioner(a_form, “h1amg”) # Register ‘c’ to ‘a’ BEFORE assembly

print(“Attempt to assemble…”)
a_form.Assemble()
f_form.Assemble()

print(“Attempt to solve…”)