- Thank you received: 0
How to mesh on a semi-circumference
3 years 7 months ago #3781
by Younghigh
How to mesh on a semi-circumference was created by Younghigh
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
to get a mesh on an entire circumference.
I can also code like
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
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
Code:
geo.AddCircle(c=(0,0), r=0.5, maxh=0.01, leftdomain=1, rightdomain=1)
I can also code like
Code:
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)
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
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
3 years 7 months ago #3783
by mneunteufel
Replied by mneunteufel on topic How to mesh on a semi-circumference
Hi Di Yang,
with the CSG2D tools you can add, subtract, etc. primitives to form a semi-circumference without splines:
Best
Michael
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)
Best
Michael
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
3 years 7 months ago #3784
by christopher
Replied by christopher on topic How to mesh on a semi-circumference
(which internally generates the exact same splines )
Time to create page: 0.115 seconds