<div dir="ltr">I found the problem. I should restart the internal variables one[] and layer[] after each extrusion. How do I do that in Gmsh?</div><div class="gmail_extra"><br clear="all"><div>------------------------------------<b><br>
Félix Salazar<br></b><i><a href="mailto:felix.salazar@polymtl.ca" target="_blank"><span style="color:rgb(51,102,255)">felix.salazar@polymtl.ca</span></a></i><b><br></b><font size="1">Étudiant au doctorat - PhD Student</font><div>
<font face="arial, helvetica, sans-serif"><i>École Polytechnique de Montréal</i></font></div><div><i><font face="arial, helvetica, sans-serif"> </font><font face="'times new roman', serif">LADYF</font></i></div>
<div><i style="font-family:arial,helvetica,sans-serif"> </i><font face="'times new roman', serif"><span style="font-size:x-small">Lab. de dynamique </span><span style="font-size:x-small">des fluides</span></font></div>
<div><div><div><div>(514) 340 4711 ext 2489<br>Local: C-318.21.3<b><br></b>------------------------------------<br></div></div></div></div></div>
<br><br><div class="gmail_quote">On Tue, Nov 5, 2013 at 6:48 PM, Felix Salazar <span dir="ltr"><<a href="mailto:felix.salazar@polymtl.ca" target="_blank">felix.salazar@polymtl.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">In my previous message, I said 8 layers in the 1st and 3rd extrusion, but they are actually 10. The rest it's still valid</div><div class="gmail_extra"><div class="im"><br clear="all"><div>------------------------------------<b><br>
Félix Salazar<br></b><i><a href="mailto:felix.salazar@polymtl.ca" target="_blank"><span style="color:rgb(51,102,255)">felix.salazar@polymtl.ca</span></a></i><b><br></b><font size="1">Étudiant au doctorat - PhD Student</font><div>
<font face="arial, helvetica, sans-serif"><i>École Polytechnique de Montréal</i></font></div><div><i><font face="arial, helvetica, sans-serif"> </font><font face="'times new roman', serif">LADYF</font></i></div>
<div><i style="font-family:arial,helvetica,sans-serif"> </i><font face="'times new roman', serif"><span style="font-size:x-small">Lab. de dynamique </span><span style="font-size:x-small">des fluides</span></font></div>
<div><div><div><div><a href="tel:%28514%29%20340%204711%20ext%202489" value="+15143404711" target="_blank">(514) 340 4711 ext 2489</a><br>Local: C-318.21.3<b><br></b>------------------------------------<br></div></div></div>
</div></div>
<br><br></div><div><div class="h5"><div class="gmail_quote">On Tue, Nov 5, 2013 at 6:17 PM, Felix Salazar <span dir="ltr"><<a href="mailto:felix.salazar@polymtl.ca" target="_blank">felix.salazar@polymtl.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I'm building a cylindrical geometry using extrusion, and managed to put a Bump like layer distribution, using a modified version of an example given by Christophe in the mailing list. (It's actually a double progression). The script is not clean, and probably not very efficient, but it works. Or at least, it seems to work.<div>
<br></div><div>Part of my geometry includes a simple extrusion of a circle 3 times, with different length and layer distribution. The 1st and 3rd section should be identical. However, Gmsh is giving at least an additional layer in the 3rd section, with the normal in the opposite direction of the rest of extrusion.</div>
<div><br></div><div>Here's the simplified script reproducing the problem. I tested it in Gmsh 2.8, 2.6 and 2.5, with the same result.</div><div><br></div><div><font face="courier new, monospace">//==== BEGIN OF .GEO</font></div>
<div><div><font face="courier new, monospace">/*==============================*/</font></div><div><font face="courier new, monospace">/*==== Geometric parameters ====*/</font></div><div><font face="courier new, monospace">/*==============================*/</font></div>
<div><font face="courier new, monospace">D1 = 1;</font></div><div><font face="courier new, monospace">D2 = 1.00;</font></div><div><font face="courier new, monospace">L = D1;</font></div><div><font face="courier new, monospace">BL = 0.5;</font></div>
<div><font face="courier new, monospace">//==============================<br></font></div><div><font face="courier new, monospace">factorRefinement = 1.0;</font></div><div><font face="courier new, monospace">core = 4;</font></div>
<div><font face="courier new, monospace">radial = Ceil((R1+R2/4)/(BL/core));<br></font></div><div><font face="courier new, monospace">Rprog = 0.9;</font></div><div><font face="courier new, monospace">lc = R1*(Pi/2)/core;</font></div>
<div><font face="courier new, monospace">z1 = Ceil(factorRefinement*(L)/lc);</font></div><div><font face="courier new, monospace">z2 = Ceil(factorRefinement*(L/2)/lc);</font></div><div><font face="courier new, monospace">Zbump = 1.35;<br>
</font></div><div><font face="courier new, monospace">Geometry.ExtrudeReturnLateralEntities = 0;</font></div><div><font face="courier new, monospace">//==============================</font></div><div><font face="courier new, monospace">// LIST OF POINTS</font></div>
<div><font face="courier new, monospace">Point(1) = {0, 0, 0};</font></div><div><font face="courier new, monospace">Point(2) = {0, R1, 0};</font></div><div><font face="courier new, monospace">Point(3) = {0, BL*R1, 0};</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">rot1[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {</font></div><div><font face="courier new, monospace"> Duplicata{Point{2,3};}</font></div>
<div><font face="courier new, monospace">};</font></div><div><font face="courier new, monospace">rot2[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {</font></div><div><font face="courier new, monospace"> Duplicata{Point{rot1[0],rot1[1]};}</font></div>
<div><font face="courier new, monospace">};</font></div><div><font face="courier new, monospace">rot3[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {</font></div><div><font face="courier new, monospace"> Duplicata{Point{rot2[0],rot2[1]};}</font></div>
<div><font face="courier new, monospace">};</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Circle(1) = {2, 1, rot1[0]};</font></div><div><font face="courier new, monospace">Circle(2) = {rot1[0],1,rot2[0]};</font></div>
<div><font face="courier new, monospace">Circle(3) = {rot2[0],1,rot3[0]};</font></div><div><font face="courier new, monospace">Circle(4) = {rot3[0],1,2};</font></div><div><font face="courier new, monospace">Line(5) = {3, rot1[1]};</font></div>
<div><font face="courier new, monospace">Line(6) = {rot1[1],rot2[1]};</font></div><div><font face="courier new, monospace">Line(7) = {rot2[1],rot3[1]};</font></div><div><font face="courier new, monospace">Line(8) = {rot3[1],3};</font></div>
<div><font face="courier new, monospace">Transfinite Line {1,2,3,4,5,6,7,8} = Ceil(factorRefinement*core+1);</font></div><div><font face="courier new, monospace">Line(9) = {3,2};</font></div><div><font face="courier new, monospace">Line(10) = {rot1[1],rot1[0]};</font></div>
<div><font face="courier new, monospace">Line(11) = {rot2[1],rot2[0]};</font></div><div><font face="courier new, monospace">Line(12) = {rot3[1],rot3[0]};</font></div><div><font face="courier new, monospace">Transfinite Line {9,10,11,12} = Ceil(factorRefinement*radial+1) Using Progression Rprog;</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Line Loop(5) = {5,6,7,8};</font></div><div><font face="courier new, monospace">Plane Surface(5) = {-5};</font></div><div>
<font face="courier new, monospace">Line Loop(1) = {1,-10,-5,9};</font></div>
<div><font face="courier new, monospace">Plane Surface(1) = {-1};</font></div><div><font face="courier new, monospace">Line Loop(2) = {2,-11,-6,10};</font></div><div><font face="courier new, monospace">Plane Surface(2) = {-2};</font></div>
<div><font face="courier new, monospace">Line Loop(3) = {3,-12,-7,11};</font></div><div><font face="courier new, monospace">Plane Surface(3) = {-3};</font></div><div><font face="courier new, monospace">Line Loop(4) = {4,-9,-8,12};</font></div>
<div><font face="courier new, monospace">Plane Surface(4) = {-4};</font></div><div><font face="courier new, monospace">Transfinite Surface {5,1,2,3,4};</font></div><div><font face="courier new, monospace"><br></font></div>
<div><font face="courier new, monospace">//======================</font></div><div><font face="courier new, monospace">Function BumpExtrude</font></div><div><font face="courier new, monospace"> n0 = Ceil(n/2);</font></div>
<div><font face="courier new, monospace"> nN = n - n0;</font></div><div><font face="courier new, monospace"> a0= (n0/n)*(r - 1) / ((r^n0) - 1);</font></div><div><font face="courier new, monospace"> aN= (nN/n)*((1/r) - 1) / (((1/r)^nN) - 1);</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> one[0] = 1;</font></div><div><font face="courier new, monospace"> layer[0] = a0;</font></div><div><font face="courier new, monospace"> Printf("%g %g",0,layer[0]);</font></div>
<div><font face="courier new, monospace"> For i In {1:n-1}</font></div><div><font face="courier new, monospace"> one[i] = 1;</font></div><div><font face="courier new, monospace"> layer[i] = layer[i-1] + a0 * r^i;</font></div>
<div><font face="courier new, monospace"> If(i>=n0)</font></div><div><font face="courier new, monospace"> layer[i] = layer[i-1] + aN * (1/r)^(i-n0);</font></div><div><font face="courier new, monospace"> EndIf</font></div>
<div><font face="courier new, monospace"> Printf("%g %g",i,layer[i]);</font></div><div><font face="courier new, monospace"> EndFor</font></div><div><font face="courier new, monospace">Return</font></div><div>
<font face="courier new, monospace">//======================</font></div><div><font face="courier new, monospace">n = 3*(z2+1) - 1; // number of intervals</font></div><div><font face="courier new, monospace">r = Zbump; // Bump progression</font></div>
<div><font face="courier new, monospace">Call BumpExtrude;</font></div><div><font face="courier new, monospace">Extrude {0,0,-L/2} {</font></div><div><font face="courier new, monospace"> Surface{1,2,3,4,5}; Layers{one[], layer[]}; Recombine;</font></div>
<div><font face="courier new, monospace">}</font></div><div><font face="courier new, monospace">//======================</font></div><div><font face="courier new, monospace">n = 3*(z1+1) - 1; // number of intervals</font></div>
<div><font face="courier new, monospace">r = Zbump; // Bump progression</font></div><div><font face="courier new, monospace">Call BumpExtrude;</font></div><div><font face="courier new, monospace">Extrude {0,0,-L} {</font></div>
<div><font face="courier new, monospace"> Surface{-34,-56,-78,-100,-122}; Layers{one[], layer[]}; Recombine;</font></div><div><font face="courier new, monospace">}</font></div><div><font face="courier new, monospace">//======================</font></div>
<div><font face="courier new, monospace">n = 3*(z2+1) - 1; // number of intervals</font></div><div><font face="courier new, monospace">r = Zbump; // Bump progression</font></div><div><font face="courier new, monospace">Call BumpExtrude;</font></div>
<div><font face="courier new, monospace">Extrude {0,0,-L/2} {</font></div><div><font face="courier new, monospace"> Surface{-144,-166,-188,-210,-232}; Layers{one[], layer[]}; Recombine;</font></div><div><font face="courier new, monospace">}</font></div>
<div><span style="font-family:'courier new',monospace">//=====OPTIONS=====</span><br></div><div><span style="font-family:'courier new',monospace">Geometry.AutoCoherence = 1;</span><br></div><div><font face="courier new, monospace">Geometry.CopyMeshingMethod = 1;</font></div>
<div><span style="font-family:'courier new',monospace">Geometry.LightTwoSide = 0;</span><br></div><div><font face="courier new, monospace">Geometry.Lines = 1;</font></div><div><font face="courier new, monospace">Geometry.LineNumbers = 1;</font></div>
<div><font face="courier new, monospace">Geometry.Points = 0;</font></div><div><font face="courier new, monospace">Geometry.PointNumbers = 0;</font></div><div><font face="courier new, monospace">Geometry.Surfaces = 1;</font></div>
<div><font face="courier new, monospace">Geometry.SurfaceNumbers = 1;</font></div><div><font face="courier new, monospace">Geometry.Volumes = 0;</font></div><div><font face="courier new, monospace">Mesh.Algorithm = 6;</font></div>
<div><font face="courier new, monospace">Mesh.Algorithm3D = 4;</font></div><div><font face="courier new, monospace">Mesh.CharacteristicLengthExtendFromBoundary = 0;</font></div><div><font face="courier new, monospace">Mesh.CharacteristicLengthFromCurvature = 0;</font></div>
<div><font face="courier new, monospace">Mesh.CharacteristicLengthFromPoints = 0;</font></div><div><font face="courier new, monospace">Mesh.ColorCarousel = 2;</font></div><div><font face="courier new, monospace">Mesh.LabelType = 2;</font></div>
<div><font face="courier new, monospace">Mesh.ElementOrder = 2;</font></div><div><font face="courier new, monospace">Mesh.Light = 0;</font></div><div><font face="courier new, monospace">Mesh.LightTwoSide = 0;</font></div>
<div><font face="courier new, monospace">Mesh.Lines = 0;</font></div><div><span style="font-family:'courier new',monospace">Mesh.Optimize = 0;</span><br></div><div><span style="font-family:'courier new',monospace">Mesh.RandomFactor = 1e-6;</span><br>
</div><div><font face="courier new, monospace">Mesh.ReverseAllNormals = 1;</font></div><div><font face="courier new, monospace">Mesh.SaveElementTagType = 2;</font></div><div><font face="courier new, monospace">Mesh.Format = 30;</font></div>
<div><font face="courier new, monospace">Mesh.SecondOrderIncomplete = 0;</font></div><div><font face="courier new, monospace">Mesh.SecondOrderLinear = 0;</font></div><div><font face="courier new, monospace">Mesh.Smoothing = 0;</font></div>
<div><font face="courier new, monospace">Mesh.SurfaceFaces = 1;</font></div><div><font face="courier new, monospace">Mesh.VolumeEdges = 0;</font></div><div><font face="courier new, monospace">Mesh.RecombineAll = 1;</font></div>
<div><span style="font-family:'courier new',monospace">Mesh.Color.Zero = {177,149,255};</span><br></div><div><font face="courier new, monospace">Mesh.Color.One = {255,6,0};</font></div><div><font face="courier new, monospace">Mesh.Color.Two = {0,255,71};</font></div>
<div><font face="courier new, monospace">Mesh.Color.Three = {0,54,255};</font></div><div><font face="courier new, monospace">Mesh.Color.Four = {255,155,0};</font></div><div><font face="courier new, monospace">Mesh.Color.Six = {0,255,184};</font></div>
<div><font face="courier new, monospace">Mesh.Color.Seven = {195,255,152};</font></div><div><font face="courier new, monospace">Mesh.Color.Eight = {255,35,247};</font></div><div><font face="courier new, monospace">//END OF .GEO</font></div>
<div><br></div><div>Note that the parameters for the first and 3rd extrusions are identical, with the exception of the surface list.</div><div><br></div><div>I added a couple of lines, to print into console the position of the layers. The 1st and 3rd layer, with the parameters of the example, have 8 layers according to the printed info, but the mesh on the screen shows something different.</div>
<div><br></div><div>I tried tweaking some of the meshing options, without success. Displaying the normals show that the extra layer is somewhat "inverted" if compared with the others.</div><div>
<br></div><div>Is there anything wrong with my Mesh options? Or the script has an error that I can't see. Any help is appreciated.</div><div><br></div><div>Thanks,</div><div><br></div><div>------------------------------------<b><br>
Félix Salazar<br></b><i><a href="mailto:felix.salazar@polymtl.ca" target="_blank"><span style="color:rgb(51,102,255)">felix.salazar@polymtl.ca</span></a></i><b><br></b><font size="1">Étudiant au doctorat - PhD Student</font><div>
<font face="arial, helvetica, sans-serif"><i>École Polytechnique de Montréal</i></font></div><div><i><font face="arial, helvetica, sans-serif"> </font><font face="'times new roman', serif">LADYF</font></i></div>
<div><i style="font-family:arial,helvetica,sans-serif"> </i><font face="'times new roman', serif"><span style="font-size:x-small">Lab. de dynamique </span><span style="font-size:x-small">des fluides</span></font></div>
<div><div><div><div><a href="tel:%28514%29%20340%204711%20ext%202489" value="+15143404711" target="_blank">(514) 340 4711 ext 2489</a><br>Local: C-318.21.3<b><br></b>------------------------------------<br></div></div></div>
</div></div>
</div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>