Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Setting the mesh size for an edge in 3d

More
5 years 8 months ago #707 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
More
5 years 8 months ago #726 by cwinters
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.
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.154 seconds