Generating Finite Element Space with FESpace

More
4 years 2 weeks ago #3263 by elizabethmonte
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?

File Attachment:

File Name: test_2020-10-27.py
File Size:1 KB
More
4 years 2 weeks ago #3265 by joachim
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:
Code:
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
Code:
fes = getattr(ngs, fes_type) (mesh, order=3)

Joachim
More
4 years 2 weeks ago #3266 by elizabethmonte
I see, thank you! That works perfectly.
Time to create page: 0.106 seconds