Dear Christophe,

Thank you, I am going to try that.

I also found that using removeAllDuplicates() before creating the physical group also solved the issue, but your approach seems cleaner.


Best regards

Bruno


On 04.11.20 09:57, Christophe Geuzaine wrote:

On 20 Oct 2020, at 15:40, Bruno <[email protected]> wrote:

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:

```python

# 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)
factory.synchronize()

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]
factory.synchronize()
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)
factory.synchronize()

vol = factory.addVolume([sl])
factory.synchronize()

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")

model.mesh.generate(3)

```

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.

I would fragment the whole model, which will ensure that everything is 
conforming; then extract the parts needed for boundary conditions.

Christophe



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

Any idea what I am doing wrong here?


Best regards


Bruno




<superimposed_mesh.png><fin_NOK.png>_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh
—
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://people.montefiore.ulg.ac.be/geuzaine





_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh

Reply via email to