Generating Finite Element Space with FESpace


I’m trying to use FESpace to construct finite element spaces. However, for certain types of elements I get an error of the sort NgException: undefined fespace ‘H1’. I’ve attached a script with a basic test and I only seem to be able to use FESpace for VectorH1 and VectorL2 elements.

Are certain types of finite element space only available from the generator functions directly?


Hi Elizabeth,

the old, internal name of the fespaces (as used ngs.FESpace(fes_type, …)) is not the same as the Python class name.

You can figure out the typename as follows:

fes = ngs.H1(mesh, order=3)
print (fes.type)

It gives you ‘h1ho’.

Alternatively, you can create an object of the python class given as string via

fes = getattr(ngs, fes_type) (mesh, order=3)


I see, thank you! That works perfectly.