Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Generating Finite Element Space with FESpace

More
3 years 5 months 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
3 years 5 months 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
3 years 5 months ago #3266 by elizabethmonte
I see, thank you! That works perfectly.
Time to create page: 0.210 seconds