High order mesh interface


I had a question regard the high order meshes. In an earlier version of netgen(5.0) there is an option for element order which, from what I understand, generates curved elements by using the selected order of splines from the geometry. I am assuming this generates curved edges at the boundary and not the interior.

I intend to make high order edges in the interior as well and I want to explicitly move the edge centres. So, I went ahead with another option called ‘Second order elements’ in meshing options. This gives me control over the mid point of the edges. (as of now I am working only with 2D grids with triangles only)

Now, despite explicitly moving the mid point of the node to curve the edge the boolean IsElementCurved returns 0. My question was, how exactly to use the second order elements to interface into my solver. Are there special parameters to be passed to get the correct element transformations?

I have attached two images one for a linear mesh with 2 triangles and another a second order mesh with the mid point of the shared edge slightly moved. [attachment=undefined]curved.png[/attachment] [attachment=undefined]linear.png[/attachment]

maybe you have to additionally call element.SetCurved(true)? But this should actually be set if you use the right element types. To use second order elements you need the types SEGMENT3, TRIG6, TET10,…
Curved elements are still part of Netgen/NGSolve, but they are usually used for approximating curved geometries and not in the interior, so I’m not a 100% sure that what you want works right now, only about 70% :wink: Could you upload a small example to see what you already got?
I increased the upload size for images, maybe that was the reason why you couldn’t upload the images.


Hi Christopher,

Sorry for my delayed reply!

I am attaching two images of what exactly I am trying to do. It is a simple two cell square domain. I have a straight edge in one while in the other I have a second order mesh where I have moved the mid point of the edge.

I have attached a pdf with the image of the two meshes.

Best regards


Attachment: combined.pdf

I’ve exported curved trigs to python with commit Merge branch 'second_order_trigs' into 'master' · NGSolve/netgen@9384078 · GitHub
so after updating to the most recent version (easiest way would be to use the nightly version tomorrow or so) creating a mesh like that should be possible from Python like this:

from netgen.meshing import *

mesh = Mesh(2)

pnts1 = [mesh.Add(MeshPoint(0,0))), mesh.Add(MeshPoint(Pnt(0.5,0))), mesh.Add(MeshPoint(Pnt(1,0))),
         mesh.Add(MeshPoint(Pnt(1,0.5))), mesh.Add(MeshPoint(Pnt(1,1))), mesh.Add(MeshPoint(Pnt(0.7,0.3)))]

pnts2 = [pnts1[0], pnts1[5], pnts1[4], mesh.Add(MeshPoint(Pnt(0.5,1))), mesh.Add(MeshPoint(Pnt(0,1))),

el1 = Element2D(index=1,vertices = pnts1)
el2 = Element2d(index=1,vertices = pnts2)


from ngsolve import *

So if its not a too big mesh then I’d suggest to use a Python script to switch all the elements you want to curve to second order ones.