<div dir="ltr"><div>Hi Bruno, </div><div><br></div><div>At a quick glance, it's possible you require some more
<span style="font-family:monospace">synchronize </span>
<span style="font-family:monospace"><font face="arial,sans-serif">calls between the different API calls.</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">It's good practice to call
<span style="font-family:monospace">synchronize</span> when you move from one part of the API to another (e.g. from gmsh.model.geo to gmsh.model.geo.mesh).</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">This is a somewhat common issue (see e.g. <a href="https://gitlab.onelab.info/gmsh/gmsh/-/issues/987">https://gitlab.onelab.info/gmsh/gmsh/-/issues/987</a>, <a href="https://gitlab.onelab.info/gmsh/gmsh/-/issues/986">https://gitlab.onelab.info/gmsh/gmsh/-/issues/986</a>).</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif"><br></font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">I see you have a single sync call at the end but it possibly comes too late to register the transfinite settings.<br></font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">I would suggest trying to minimize your script further (maybe a single geometry and a single transfinite call) to dig in further.</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif"><br></font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">Sincerely, <br></font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">Max<br></font></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 6, 2020 at 10:43 AM Bruno <<a href="mailto:bruno.agostini@gmail.com">bruno.agostini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Gmsh community,<br>
<br>
I have a 3 dimensional square duct here attached that I wish to mesh <br>
using the transfinite option in Gmsh, which seems very powerful.<br>
<br>
I wish to have on each side of the inlet and outlet square of the duct <br>
20 meshing points<br>
<br>
To this end I wrote the script below, but it does the meshing without <br>
taking into account the transfinite points.<br>
<br>
Any clue what I am doing wrong here? I could not find the answer in the <br>
mail archive.<br>
<br>
Python script:<br>
<br>
import gmsh<br>
<br>
dcell = Wd = Hd = 2.8<br>
tol = dcell / 100<br>
Ld = 18.46<br>
<br>
gmsh.initialize()<br>
gmsh.option.setNumber("General.Terminal", 1)<br>
gmsh.option.setNumber("Mesh.MshFileVersion", 4.1)<br>
gmsh.option.setString("Geometry.OCCTargetUnit", "MM")<br>
gmsh.option.setNumber("Mesh.Optimize",1)<br>
#gmsh.option.setNumber("Mesh.Optimize",1)<br>
<br>
gmsh.merge("SquareDuct.brep")<br>
model = gmsh.model<br>
model.mesh.removeDuplicateNodes()<br>
<br>
<br>
# CREATE PHYSICAL GROUPS<br>
<br>
# WALLS<br>
s = []<br>
s_bot = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, -Ld/2-tol, <br>
-Hd/2+tol, Wd/2+tol, Ld/2+tol, dim = 2)<br>
s_top = model.getEntitiesInBoundingBox(Hd/2-tol, -Wd/2-tol, -Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, Ld/2+tol, dim = 2)<br>
s_left = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, -Ld/2-tol, <br>
Hd/2+tol, -Wd/2+tol, Ld/2+tol, dim = 2)<br>
s_right = model.getEntitiesInBoundingBox(-Hd/2-tol, Wd/2-tol, -Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, Ld/2+tol, dim = 2)<br>
s = s + s_bot + s_left + s_top + s_right<br>
s_no_slip = [s[i][1] for i in range(len(s))]<br>
p = model.addPhysicalGroup(2, s_no_slip)<br>
model.setPhysicalName(2, p, "noslip")<br>
print("noslip = ", len(s))<br>
<br>
# FLUID INLET CURVE<br>
c_in = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, -Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, -Ld/2+tol, dim = 1)<br>
# FLUID INLET<br>
s = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, -Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, -Ld/2+tol, dim = 2)<br>
p = model.addPhysicalGroup(2, [s[i][1] for i in range(len(s))])<br>
model.setPhysicalName(2, p, "inlet")<br>
print("inlet = ", len(s))<br>
for ci in c_in:<br>
gmsh.model.geo.mesh.setTransfiniteCurve(ci[1], 20)<br>
p = model.addPhysicalGroup(1, [c_in[i][1] for i in range(len(c_in))])<br>
model.setPhysicalName(1, p, "inlet_curve")<br>
<br>
# FLUID OUTLET CURVE<br>
c_out = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, Ld/2+tol, dim = 1)<br>
# FLUID OUTLET<br>
s = model.getEntitiesInBoundingBox(-Hd/2-tol, -Wd/2-tol, Ld/2-tol, <br>
Hd/2+tol, Wd/2+tol, Ld/2+tol, dim = 2)<br>
p = model.addPhysicalGroup(2, [s[i][1] for i in range(len(s))])<br>
model.setPhysicalName(2, p, "outlet")<br>
print("outlet = ", len(s))<br>
for co in c_out:<br>
gmsh.model.geo.mesh.setTransfiniteCurve(co[1], 20)<br>
p = model.addPhysicalGroup(1, [c_out[i][1] for i in range(len(c_out))])<br>
model.setPhysicalName(1, p, "outlet_curve")<br>
<br>
for si in s_no_slip:<br>
gmsh.model.geo.mesh.setTransfiniteSurface(si)<br>
<br>
# VOLUME<br>
s = model.getEntities(3)<br>
p = model.addPhysicalGroup(3, [s[i][1] for i in range(len(s))])<br>
model.setPhysicalName(3, p, "air")<br>
<br>
for vi in [s[i][1] for i in range(len(s))]:<br>
gmsh.model.geo.mesh.setTransfiniteVolume(vi)<br>
<br>
gmsh.model.geo.synchronize()<br>
<br>
# MESH 3D<br>
model.mesh.generate(3)<br>
#model.mesh.recombine()<br>
<br>
gmsh.write("SquareDuct.msh")<br>
gmsh.finalize()<br>
<br>
<br>
Best regards<br>
<br>
Bruno Agostini<br>
<br>
<br>
_______________________________________________<br>
gmsh mailing list<br>
<a href="mailto:gmsh@onelab.info" target="_blank">gmsh@onelab.info</a><br>
<a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer" target="_blank">http://onelab.info/mailman/listinfo/gmsh</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Max Orok</div><div>Contractor<br></div></div><div dir="ltr"><a href="http://www.mevex.com" target="_blank">www.mevex.com</a><br><br><img src="https://docs.google.com/uc?export=download&id=1fHTIiW4OMUjQr1iOkspQ7wiEsxunoOs0&revid=0B6x5w-5zVaEjSkpwbm5oY29jbG1XMzJoYldXTmJpNGFtb3dVPQ" width="164" height="42"><br></div></div></div></div></div></div>