- Thank you received: 0
Setting the mesh size for an edge in 3d
6 years 3 months ago #707
by Gerhardt
Setting the mesh size for an edge in 3d was created by Gerhardt
Hi,
in the tutorials the setting of the mesh size for a surface and for a point is demonstrated.
How can this be done for an edge, for example for a cube (for local refinement towards an edge) either in a python file or in the gui (How can I select an edge in the "Refinement dialog ...")?
Best regards,
Gerhard
in the tutorials the setting of the mesh size for a surface and for a point is demonstrated.
How can this be done for an edge, for example for a cube (for local refinement towards an edge) either in a python file or in the gui (How can I select an edge in the "Refinement dialog ...")?
Best regards,
Gerhard
6 years 3 months ago #726
by cwinters
Replied by cwinters on topic Setting the mesh size for an edge in 3d
Hi,
since the geometry is modeled by 3d objects and planes, you can not directly set the mesh size on an edge.
But you can restrict the mesh size in an arbitrary point. I would suggest a loop over points on the edge and using the "RestrictH(...)" function as in the following code.
Best
Christoph
since the geometry is modeled by 3d objects and planes, you can not directly set the mesh size on an edge.
But you can restrict the mesh size in an arbitrary point. I would suggest a loop over points on the edge and using the "RestrictH(...)" function as in the following code.
Code:
from netgen.csg import *
cube = OrthoBrick(Pnt(-1,-1,-1),Pnt(1,1,1))
geo = CSGeometry()
geo.Add(cube)
maxh = 0.5
mp = MeshingParameters (maxh=maxh)
n = 40
for i in range(n+1):
loc_h = 2/n # edge length devided by number of points
mp.RestrictH(x=1,y=-1+i*loc_h,z=1,h=loc_h) # restrict local mesh size at a point
ngmesh = geo.GenerateMesh(mp=mp)
from ngsolve import *
Draw(Mesh(ngmesh))
Best
Christoph
The following user(s) said Thank You: Gerhardt
Time to create page: 0.116 seconds