[Gmsh] Fragment + addSurfaceLoop

Bruno bruno.agostini at gmail.com
Tue Oct 20 15:40:48 CEST 2020

Dear Gmsh Community:

In the code below I import a 3D cooling fin CAD in Brep format. I want 
to modify the model to insert a heating area smaller than the base area 
and have a conformal meshing. I then tag the heating area for further 
use to apply boundary conditions. To this end I used the python code below:


# New heating area

qa.append((2, factory.addRectangle(0, 0, 0, dz, -dy)))
factory.rotate([qa], 0, 0, 0, 0, 1, 0, pi/2)
tx = -Hd/2 - HEV
ty = ( dy - ( Wd + CH0 ) / 2 ) / 2
tz = Ld/2 + zq
factory.translate([qa], tx, ty, tz)

s = model.getEntitiesInBoundingBox(-Hd/2-HEV-tol, -Wd/2-CH0/2-tol, 
-Ld/2-tol, -Hd/2-HEV+tol, Wd/2+CH0/2+tol, Ld/2+tol, dim = 2) # Get fin 
bottom surface
sc = list(set(s) - set(qa)) # Remove heating area (duplicates)
sf = factory.fragment(sc, qa, removeObject = True, removeTool = False)[0]
s = model.getEntities(2)
s = list(set(s) - set(sc)) # Remove original base area (duplicates)

sl = factory.addSurfaceLoop([s[i][1] for i in range(len(s))], sewing = True)

vol = factory.addVolume([sl])

p = model.addPhysicalGroup(2, [qa[i][1] for i in range(len(qa))])
model.setPhysicalName(2, p, "base")

p = model.addPhysicalGroup(3, [vol])
model.setPhysicalName(3, p, "fin")



If I use `sewing=True` then I get the results in the attached picture 
(superimposed_mesh.png): the heating area and the volume seem to have 
superimposed meshes even though I used fragment to cut-out the heating area.

If I use `sewing=False` then I get facet intersection errors (fin_NOK.png).

Any idea what I am doing wrong here?

Best regards


-------------- next part --------------
A non-text attachment was scrubbed...
Name: superimposed_mesh.png
Type: image/png
Size: 393058 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20201020/0b126d82/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fin_NOK.png
Type: image/png
Size: 474915 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20201020/0b126d82/attachment-0003.png>

More information about the gmsh mailing list