facecoding error

I’m trying to manually build a 2D anisotropic mesh for BL,
so I’ m starting my homework from the mesh building example in ngspy tutorial,
but I get a

has no facedecoding: fd.size = 0, ind = 1

error on the Element2D add operation.

Installation on Ubuntu 16.04 LTS from repository as suggested.

thanks for help


you have to add a FaceDescriptor before you can add 2D elements (a 2D mesh is handled as a single face).
When adding a FaceDescriptor you get it’s number as return value. Use this value as first argument of your Element2D.

fd = ngmesh.Add (FaceDescriptor(surfnr=1,domin=1,bc=1))

You could also use an hp-refinement when generating a SplineGeometry from python. If you append a segment to your geometry, just add “hpref=1” to mark the segment.


After converting the mesh to an ngsolve mesh you can call the RefineHP function like this:

mesh = ngsolve.Mesh(ngmesh)