Uneven mesh

Hi,

Could I generate a mesh for a sphere where the two hemispheres have entirely different mesh sizes—for example, one hemisphere with a mesh size of 0.01 and the other with 0.2? Alternatively, is it possible to create a curve with non-uniformly distributed mesh points (for instance, placing a point at the north pole and distributing all remaining points on the south hemisphere) and then revolve this meshed curve to form a 2D surface mesh?

Thank you very much.

Something like this should work

from ngsolve import *
from netgen.occ import *
from ngsolve.webgui import *

halfcircle = WorkPlane().Arc(1,180).Close().Face()

upperhalfsphere = halfcircle.Revolve( Axis((0,0,0), (0,1,0)), 180).faces.Min(Z)
upperhalfsphere.maxh = 0.5 # Give here the maxh !!!

lowerhalfsphere = halfcircle.Revolve( Axis((0,0,0), (0,1,0)), -180).faces.Max(Z)
lowerhalfsphere.maxh = 0.05 # Give here a different maxh !!!

geo = Glue([lowerhalfsphere ,upperhalfsphere])

mesh = Mesh( OCCGeometry(geo, dim =3).GenerateMesh(maxh =0.5))
mesh.Curve(3)

Draw(mesh)

1 Like

The method works well. Thank you so much.