Generating Finite Element Space with FESpace

Hello,

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?

https://ngsolve.org/media/kunena/attachments/1344/test.py

Attachment: test_2020-10-27.py

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)

Joachim

I see, thank you! That works perfectly.