Secondorder structured mesh

I upgraded from 6.2.2604 to 6.2.2606 (with pip) and am having a problem with generating curved structured meshes. Following works in 6.2.2604

from ngsolve import *
from ngsolve.webgui import Draw
from ngsolve.meshes import MakeStructured3DMesh

mesh = MakeStructured3DMesh(nx=2, ny=2, nz=2, secondorder=True, mapping=lambda x, y, z: (x, y + 0.5*x**2, z))
Draw(mesh)

This produces a nicely curved mesh:

Now in 6.2.2605 and 6.2.2606 MakeStructured3DMesh only works with secondorder=False. With secondorder=True, the notebook kernel dies. I am getting the same behavior with MakeStructured2DMesh. Was there some change to how higher oder elements are handled in netgen? When using OCC for the domain, both ngmesh.SecondOrder() and mesh.Curve(…) are still working fine. It is just the structured meshes that I am having issues with.

I would appreciate any help on the topic!

Best regards, Lucca

Ah - this comes from the new concept of EdgeDescriptors. Fixed in the next pre-repease. In the meanwhile you may use this py-file for structured meshes:

meshes.py (26.3 KB)

thank you for reporting,

Joachim

Thank you for the quick fix! I have somewhat of a follow-up question regarding the curved structured meshes.

I noticed that the point search mesh(…) fails when using secondorder=True in the structured mesh. This is not new behavior, I have also had the same issue in previous NGSolve versions:

from ngsolve import *
from ngsolve.webgui import Draw
from ngsolve.meshes import MakeStructured3DMesh

# Create mesh with ngmesh.SecondOrder()
mesh = MakeStructured3DMesh(nx=2, ny=2, nz=2, secondorder=True, mapping=lambda x, y, z: (x, y + 0.5*x**2, z))

# Check evaluation of GridFunction at a meshpoint:
gf = GridFunction(H1(mesh))
gf.Interpolate(y)
Draw(gf)
print(gf(mesh(1,1.5,1))) # Only works with secondorder=False

Another thing I noticed here is that the edges seem not to curve with the faces in the updated MakeStructured3DMesh code that you uploaded yesterday? But I haven’t tested this enough, so this may as well just be a visualization problem:

My workaround for getting the point search to work is to curve the mesh with SetDeformation and Curve(order):

from ngsolve import *
from ngsolve.webgui import Draw
from ngsolve.meshes import MakeStructured3DMesh

# Create mesh where we curve with SetDeformation and mesh.Curve(order) 
mesh = MakeStructured3DMesh(nx=2, ny=2, nz=2, secondorder=False)
gf_mesh = GridFunction(VectorH1(mesh, order=2))
gf_mesh.Interpolate(CF((0,0.5*x**2,0)))
mesh.SetDeformation(gf_mesh)
mesh.Curve(2)
Draw(mesh)  # --> Nicely curved mesh

# Check evaluation of GridFunction at a meshpoint:
gf = GridFunction(H1(mesh))
gf.Interpolate(y)
Draw(gf)
print(gf(mesh(1,1,1))) # Works fine

Here point search works and also in the new version that you sent yesterday, the edges behave nicely in Draw() :

I should note that the point search problem with mesh(…) is specific to the MakeStructuredMesh functions. When meshing OCC geometries, point search works fine with both SecondOrder() and .Curve(), so the issue seems specific to structured meshes rather than SecondOrder() in general.

Now to my question: Is the SetDeformation + .Curve() route generally the preferred approach when generating meshes with netgen directly, or am I missing something when not using the “traditional” (if we can call it that) approach SecondOrder()?