Error while taking the union of different volume elements

More
3 years 3 months ago - 3 years 3 months ago #3904 by renard
Hi,
I'm trying to create a finite element mesh which consists of a cylindrical part upon which several smaller cylindrical branches are attached. I'm using the `python` API of `netgen/Ngsolve` for this. However during the meshing process, the code remains stuck at a particular position and hence the meshing is not successful. I have tried a lot and could not find a solution to the problem. The situation is more difficult as there is no particular error message produced.

Below is a minimum working example of the code which I used
Code:
import numpy from netgen.csg import * cyl_rad = 10.0 # a list containing the end points of the cylinders [p1,p2] dataPoints =[[[0, 0, 323.31615074619043], [40, 40, 282.9016319029166]], [[0, 0, 484.9742261192857], [40, 40, 444.55970727601186]], [[0, 0, 646.6323014923809], [40, 40, 606.2177826491071]], [[0, 0, 808.2903768654761], [40, 40, 767.8758580222024]], [[0, 0, 969.9484522385713], [40, 40, 929.5339333952975]], [[0, 0, 1131.6065276116665], [40, 40, 1091.1920087683927]]] def NG_cylinder(p1, p2, rad): # A function which creates a cylinder using Netgen pnt1 = Pnt(p1[0], p1[1], p1[2]) pnt2 = Pnt(p2[0], p2[1], p2[2]) cyl = Cylinder(pnt1, pnt2, rad) dir1 = numpy.subtract(p1, p2) dir2 = numpy.subtract(p2, p1) vec1 = Vec(dir1[0], dir1[1], dir1[2]) vec2 = Vec(dir2[0], dir2[1], dir2[2]) plane1 = Plane(pnt1, vec1) plane2 = Plane(pnt2, vec2) return cyl * plane1 * plane2 #Initializing the geo object by creating the trunk structure # TheStructure = NG_cylinder([0,0,200],[0,0,1200], cyl_rad*2.0) # going through the list hence attaching each cylinder to the main branch for i in range(0, 6): print("i = ", i) i_pnt = dataPoints[i] cyl0 = NG_cylinder(i_pnt[0], i_pnt[1], cyl_rad) TheStructure = TheStructure + cyl0 geo = CSGeometry() geo.Add(TheStructure) mesh = geo.GenerateMesh(maxh=10) mesh = geo.GenerateMesh() mesh.Export(str("Ntgn_cyls.msh"), 'Gmsh2 Format')

Can anyone help me fix this error? If possible can you please explain to me what is causing the problem here? I have used Netgen in past to make similar structures and never faced this error before, so I would like to know the reason why this happened.

P.S : I need the structure meshed as a single , continuous mesh. So meshing one cylinder and copying them will not work for me. I thank you for your attention and time.
Last edit: 3 years 3 months ago by renard. Reason: corrections in formatting
Time to create page: 0.101 seconds