How to mesh on a semi-circumference

Dear all,

I wonder how to mesh on a semi-circumference
[tex]x^2+y^2=0.5^2,\quad y\geq 0.[/tex]

In fact, I can code like

geo.AddCircle(c=(0,0), r=0.5, maxh=0.01, leftdomain=1, rightdomain=1)

to get a mesh on an entire circumference.

I can also code like

p1,p2,p3,p4,p5= [ geo.AppendPoint(x,y) for x,y in [(0.5,0), (0.5,0.5), (0,0.5), (-0.5,0.5), (-0.5,0)] ]
geo.Append (["spline3", p1, p2, p3], maxh=0.01, leftdomain=1, rightdomain=1)
geo.Append (["spline3", p5, p4, p3], maxh=0.01, leftdomain=1, rightdomain=1)

to get a mesh on the semi-circumference. However, this method seems little awkward and also has some restricts in combined meshes, which may cause the global mesh failure.

So, is there a simple method to mesh on the semi-circumference just like meshing on an entire circumference? Please help me. Thank you very much.

Best,

Di Yang

Hi Di Yang,

with the CSG2D tools you can add, subtract, etc. primitives to form a semi-circumference without splines:

[code]from ngsolve import *
from netgen.geom2d import CSG2d, Circle, Rectangle

geo = CSG2d()
circle = Circle( center=(0,0), radius=0.5, mat=“circle”, bc=“bnd” )
rect = Rectangle( pmin=(-2,-1), pmax=(2,0), bc=“cut” )
geo.Add(circle - rect)

mesh = Mesh(geo.GenerateMesh(maxh=0.3))
mesh.Curve(2)
Draw(mesh)[/code]

Best
Michael

(which internally generates the exact same splines :wink: )