[Gmsh] Extrusion produces an incorrect number of layers
Felix Salazar
felix.salazar at polymtl.ca
Wed Nov 6 01:00:02 CET 2013
I found the problem. I should restart the internal variables one[] and
layer[] after each extrusion. How do I do that in Gmsh?
------------------------------------
* Félix Salazar**felix.salazar at polymtl.ca <felix.salazar at polymtl.ca>*
Étudiant au doctorat - PhD Student
*École Polytechnique de Montréal*
* LADYF*
Lab. de dynamique des fluides
(514) 340 4711 ext 2489
Local: C-318.21.3
------------------------------------
On Tue, Nov 5, 2013 at 6:48 PM, Felix Salazar <felix.salazar at polymtl.ca>wrote:
> 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
>
> ------------------------------------
>
> * Félix Salazar**felix.salazar at polymtl.ca <felix.salazar at polymtl.ca>*
> Étudiant au doctorat - PhD Student
> *École Polytechnique de Montréal*
> * LADYF*
> Lab. de dynamique des fluides
> (514) 340 4711 ext 2489
> Local: C-318.21.3
> ------------------------------------
>
>
> On Tue, Nov 5, 2013 at 6:17 PM, Felix Salazar <felix.salazar at polymtl.ca>wrote:
>
>> 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.
>>
>> 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.
>>
>> Here's the simplified script reproducing the problem. I tested it in Gmsh
>> 2.8, 2.6 and 2.5, with the same result.
>>
>> //==== BEGIN OF .GEO
>> /*==============================*/
>> /*==== Geometric parameters ====*/
>> /*==============================*/
>> D1 = 1;
>> D2 = 1.00;
>> L = D1;
>> BL = 0.5;
>> //==============================
>> factorRefinement = 1.0;
>> core = 4;
>> radial = Ceil((R1+R2/4)/(BL/core));
>> Rprog = 0.9;
>> lc = R1*(Pi/2)/core;
>> z1 = Ceil(factorRefinement*(L)/lc);
>> z2 = Ceil(factorRefinement*(L/2)/lc);
>> Zbump = 1.35;
>> Geometry.ExtrudeReturnLateralEntities = 0;
>> //==============================
>> // LIST OF POINTS
>> Point(1) = {0, 0, 0};
>> Point(2) = {0, R1, 0};
>> Point(3) = {0, BL*R1, 0};
>>
>> rot1[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {
>> Duplicata{Point{2,3};}
>> };
>> rot2[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {
>> Duplicata{Point{rot1[0],rot1[1]};}
>> };
>> rot3[] = Rotate { {0,0,1}, {0,0,0}, Pi/2} {
>> Duplicata{Point{rot2[0],rot2[1]};}
>> };
>>
>> Circle(1) = {2, 1, rot1[0]};
>> Circle(2) = {rot1[0],1,rot2[0]};
>> Circle(3) = {rot2[0],1,rot3[0]};
>> Circle(4) = {rot3[0],1,2};
>> Line(5) = {3, rot1[1]};
>> Line(6) = {rot1[1],rot2[1]};
>> Line(7) = {rot2[1],rot3[1]};
>> Line(8) = {rot3[1],3};
>> Transfinite Line {1,2,3,4,5,6,7,8} = Ceil(factorRefinement*core+1);
>> Line(9) = {3,2};
>> Line(10) = {rot1[1],rot1[0]};
>> Line(11) = {rot2[1],rot2[0]};
>> Line(12) = {rot3[1],rot3[0]};
>> Transfinite Line {9,10,11,12} = Ceil(factorRefinement*radial+1) Using
>> Progression Rprog;
>>
>> Line Loop(5) = {5,6,7,8};
>> Plane Surface(5) = {-5};
>> Line Loop(1) = {1,-10,-5,9};
>> Plane Surface(1) = {-1};
>> Line Loop(2) = {2,-11,-6,10};
>> Plane Surface(2) = {-2};
>> Line Loop(3) = {3,-12,-7,11};
>> Plane Surface(3) = {-3};
>> Line Loop(4) = {4,-9,-8,12};
>> Plane Surface(4) = {-4};
>> Transfinite Surface {5,1,2,3,4};
>>
>> //======================
>> Function BumpExtrude
>> n0 = Ceil(n/2);
>> nN = n - n0;
>> a0= (n0/n)*(r - 1) / ((r^n0) - 1);
>> aN= (nN/n)*((1/r) - 1) / (((1/r)^nN) - 1);
>>
>> one[0] = 1;
>> layer[0] = a0;
>> Printf("%g %g",0,layer[0]);
>> For i In {1:n-1}
>> one[i] = 1;
>> layer[i] = layer[i-1] + a0 * r^i;
>> If(i>=n0)
>> layer[i] = layer[i-1] + aN * (1/r)^(i-n0);
>> EndIf
>> Printf("%g %g",i,layer[i]);
>> EndFor
>> Return
>> //======================
>> n = 3*(z2+1) - 1; // number of intervals
>> r = Zbump; // Bump progression
>> Call BumpExtrude;
>> Extrude {0,0,-L/2} {
>> Surface{1,2,3,4,5}; Layers{one[], layer[]}; Recombine;
>> }
>> //======================
>> n = 3*(z1+1) - 1; // number of intervals
>> r = Zbump; // Bump progression
>> Call BumpExtrude;
>> Extrude {0,0,-L} {
>> Surface{-34,-56,-78,-100,-122}; Layers{one[], layer[]}; Recombine;
>> }
>> //======================
>> n = 3*(z2+1) - 1; // number of intervals
>> r = Zbump; // Bump progression
>> Call BumpExtrude;
>> Extrude {0,0,-L/2} {
>> Surface{-144,-166,-188,-210,-232}; Layers{one[], layer[]}; Recombine;
>> }
>> //=====OPTIONS=====
>> Geometry.AutoCoherence = 1;
>> Geometry.CopyMeshingMethod = 1;
>> Geometry.LightTwoSide = 0;
>> Geometry.Lines = 1;
>> Geometry.LineNumbers = 1;
>> Geometry.Points = 0;
>> Geometry.PointNumbers = 0;
>> Geometry.Surfaces = 1;
>> Geometry.SurfaceNumbers = 1;
>> Geometry.Volumes = 0;
>> Mesh.Algorithm = 6;
>> Mesh.Algorithm3D = 4;
>> Mesh.CharacteristicLengthExtendFromBoundary = 0;
>> Mesh.CharacteristicLengthFromCurvature = 0;
>> Mesh.CharacteristicLengthFromPoints = 0;
>> Mesh.ColorCarousel = 2;
>> Mesh.LabelType = 2;
>> Mesh.ElementOrder = 2;
>> Mesh.Light = 0;
>> Mesh.LightTwoSide = 0;
>> Mesh.Lines = 0;
>> Mesh.Optimize = 0;
>> Mesh.RandomFactor = 1e-6;
>> Mesh.ReverseAllNormals = 1;
>> Mesh.SaveElementTagType = 2;
>> Mesh.Format = 30;
>> Mesh.SecondOrderIncomplete = 0;
>> Mesh.SecondOrderLinear = 0;
>> Mesh.Smoothing = 0;
>> Mesh.SurfaceFaces = 1;
>> Mesh.VolumeEdges = 0;
>> Mesh.RecombineAll = 1;
>> Mesh.Color.Zero = {177,149,255};
>> Mesh.Color.One = {255,6,0};
>> Mesh.Color.Two = {0,255,71};
>> Mesh.Color.Three = {0,54,255};
>> Mesh.Color.Four = {255,155,0};
>> Mesh.Color.Six = {0,255,184};
>> Mesh.Color.Seven = {195,255,152};
>> Mesh.Color.Eight = {255,35,247};
>> //END OF .GEO
>>
>> Note that the parameters for the first and 3rd extrusions are identical,
>> with the exception of the surface list.
>>
>> 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.
>>
>> 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.
>>
>> Is there anything wrong with my Mesh options? Or the script has an error
>> that I can't see. Any help is appreciated.
>>
>> Thanks,
>>
>> ------------------------------------
>>
>> * Félix Salazar**felix.salazar at polymtl.ca <felix.salazar at polymtl.ca>*
>> Étudiant au doctorat - PhD Student
>> *École Polytechnique de Montréal*
>> * LADYF*
>> Lab. de dynamique des fluides
>> (514) 340 4711 ext 2489
>> Local: C-318.21.3
>> ------------------------------------
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20131105/d50924b0/attachment.html>