Curve mesh with boundarylayer

Hi, I’m using mesh.Curve(3) for a sphere. However, when I add a boundary layer in the mesh the Curve function does not improve the mesh. Can you see if I’m using it correctly? I attached images of the mesh with and without the line mesh.BoundaryLayer(“.*”, [0.01, 0.02], material=“mat”, domains=“mat”)


from netgen.occ import *
from ngsolve import Mesh
import netgen.gui

sp = Sphere(Pnt(0,0,0), 1)
sp.solids.name = "mat"
geo = OCCGeometry(sp)

mesh = geo.GenerateMesh(maxh=0.4)
mesh.BoundaryLayer(".*", [0.01, 0.02], material="mat", domains="mat")
mesh.Curve(3)
mesh = Mesh(mesh)

In this case adding disable_curving=False to the boundarylayer parameters should do the trick. But note that the curvature is not propagated into the layer so on convex surfaces this could lead to push through elements on not fine enough meshes (thats why we disable it by default)

1 Like

That option is unavailable to me. I also tried after pip install --upgrade ngsolve, but I still get this error:

TypeError                                 Traceback (most recent call last)
Cell In[1], line 10
      7 geo = OCCGeometry(sp)
      9 mesh = geo.GenerateMesh(maxh=0.4)
---> 10 mesh.BoundaryLayer(".*", [0.01, 0.02], material="mat", domains="mat", disable_curving=False)
     11 mesh.Curve(3)
     12 mesh = Mesh(mesh)

TypeError: BoundaryLayer(): incompatible function arguments. The following argument types are supported:
    1. (self: netgen.libngpy._meshing.Mesh, boundary: Union[str, int], thickness: Union[float, list], material: Union[str, Dict[str, str]], domains: Union[str, int] = '.*', outside: bool = False, project_boundaries: Optional[str] = None, grow_edges: bool = True, limit_growth_vectors: bool = True, sides_keep_surfaceindex: bool = False, keep_surfaceindex: bool = False) -> None

Invoked with: <netgen.libngpy._meshing.Mesh object at 0x7f71d8053470>, '.*', [0.01, 0.02]; kwargs: material='mat', domains='mat', disable_curving=False

Can you try

pip install --upgrade --pre ngsolve

I think this option is quite new

It upgraded to NGSolve-6.2.2405 with the --pre option, but the disable_curving option is still not available. I noticed that the latest release in git is NGSolve-6.2.2406 so perhaps that version contains the disable_curving?

It works now. Thanks!
For some reason the latest NGSolve version was not available in my python 3.8 installation. I installed python 3.12 and then I could get the latest version with pip install --upgrade --pre ngsolve.