[Gmsh] Array interval as argument for Plane Surface holes

Ricardo Luiz Dalbosco ricardo at dalbosco.net
Thu Jan 10 19:45:38 CET 2013


It worked properly.

Thank you Cristophe.



-- 
Ricardo Luiz Dalbosco      -



On Wed, Jan 9, 2013 at 5:10 AM, Christophe Geuzaine <cgeuzaine at ulg.ac.be>wrote:

>
> Indeed: coilLoops[1]:coilLoops[nc] means {coilLoops[1], coilLoops[1]+1,
> coilLoops[1]+2, ..., coilLoops[nc]}. What you want is coilLoops[{1:nc}].
>
> So I would do:
>
> Plane Surface(loopAir) = {loopAir, coilLoops[{1:nc}]};
>
> Cheers,
> Christophe
>
> On 08 Jan 2013, at 23:27, Ricardo Luiz Dalbosco <ricardo at dalbosco.net>
> wrote:
>
> > Hi Christophe,
> >
> > Here is the code I'm trying to run:
> >
> >
> > a = 0.3;              //Coil side lenght
> > kr = 2;               //Coil correction factor
> > nc = 10;             //Num,ber of ciol turns
> > b = kr*a;            //Space between coils
> > lc = a*( kr*(nc - 1) + 1 ) + a;               //Air region lenhgt
> > mesh = 1.0;
> >
> > x = 0; y = lc/2; z = 0;
> >
> > //Loop to draw nc squares
> > For turn In {1:nc}
> >
> >       //Points
> >       point1 = newp; Point(point1) = {x, y, z, mesh};
> >       point2 = newp; Point(point2) = {x + a, y, z, mesh};
> >       point3 = newp; Point(point3) = {x + a, y + a, z, mesh};
> >       point4 = newp; Point(point4) = {x, y + a, z, mesh};
> >
> >       //Lines
> >       line1 = newl; Line(line1) = {point1, point2};
> >       line2 = newl; Line(line2) = {point2, point3};
> >       line3 = newl; Line(line3) = {point3, point4};
> >       line4 = newl; Line(line4) = {point4, point1};
> >
> >       //Plane Surface (newsl = surface loop)
> >       lineLoop = newsl; Line Loop(lineLoop) = {line1, line2, line3,
> line4};
> >
> >       //Lista para criar a Physical Surface
> >       coilLoops[turn] = lineLoop;
> >
> >       //Space between turns
> >       x += b;
> >
> > EndFor
> >
> > //Draw a rectangular Air container
> > x = 0; y = 0; z = 0;
> > pAir1 = newp; Point(pAir1) = {x - a, y, z, mesh};
> > pAir2 = newp; Point(pAir2) = {x + lc, y, z, mesh};
> > pAir3 = newp; Point(pAir3) = {x + lc, y + lc, z, mesh};
> > pAir4 = newp; Point(pAir4) = {x - a, y + lc, z, mesh};
> >
> > //lines
> > lineAir1 = newl; Line(lineAir1) = {pAir1, pAir2};
> > lineAir2 = newl; Line(lineAir2) = {pAir2, pAir3};
> > lineAir3 = newl; Line(lineAir3) = {pAir3, pAir4};
> > lineAir4 = newl; Line(lineAir4) = {pAir4, pAir1};
> >
> > //Line Loop
> > loopAir = newsl;
> > Line Loop(loopAir) = {lineAir1, lineAir2, lineAir3, lineAir4};
> > //Plane Surface with coil squares as holes
> > Plane Surface(loopAir) = {loopAir, coilLoops[1]:coilLoops[nc]};
> > //Physical Surface
> > Physical Surface("Air") = {loopAir};
> >
> > ---------
> >
> > So, the problem seems to be this line:
> > Plane Surface(loopAir) = {loopAir, coilLoops[1]:coilLoops[nc]};
> >
> > Also, the code Plane Surface(loopAir) = {coilLoops[1]:coilLoops[nc]};
> gives the same problem.
> >
> > It works fine when I describe the Plane Surface like this:
> > Plane Surface(loopAir) = {loopAir, coilLoops[1], coilLoops[2],
> coilLoops[3], ..., coilLoops[nc] };
> >
> > And the syntax  coilLoops[1]:coilLoops[nc], also works describing a
> Physical Surface("Coil") = {coilLoops[1]:coilLoops[nc]}.
> >
> > I am using Gmsh 2.6.1 version.
> >
> >
> >
> > --
> > Ricardo Luiz Dalbosco      -
> >
> >
> >
> > On Tue, Jan 8, 2013 at 8:38 AM, Christophe Geuzaine <cgeuzaine at ulg.ac.be>
> wrote:
> >
> > Hi Riccardo - Could you send a complete test file? Here this type of
> syntax seems to work just fine:
> >
> > Point(3) = {0.9, 0.7, 0, 1.0};
> > Point(4) = {-0.9, 0.7, 0, 1.0};
> > Point(5) = {-0.5, 0.2, 0, 1.0};
> > Point(6) = {-0.5, -0.1, 0, 1.0};
> > Point(7) = {-0.3, -0.1, 0, 1.0};
> > Point(8) = {-0.3, 0.2, 0, 1.0};
> > Point(9) = {0.3, 0.2, 0, 1.0};
> > Point(10) = {0.3, -0.1, 0, 1.0};
> > Point(11) = {0.5, -0.1, 0, 1.0};
> > Point(12) = {0.5, 0.2, 0, 1.0};
> > Line(1) = {1, 2};
> > Line(2) = {2, 3};
> > Line(3) = {3, 4};
> > Line(4) = {4, 1};
> > Line(5) = {6, 7};
> > Line(6) = {7, 8};
> > Line(7) = {8, 5};
> > Line(8) = {5, 6};
> > Line(9) = {10, 11};
> > Line(10) = {11, 12};
> > Line(11) = {12, 9};
> > Line(12) = {9, 10};
> > Line Loop(13) = {4, 1, 2, 3};
> > Line Loop(14) = {8, 5, 6, 7};
> > Line Loop(15) = {12, 9, 10, 11};
> > hh[] = {14, 15};
> > Plane Surface(16) = {13, hh[0]:hh[1]};
> >
> >
> >
> > On 07 Jan 2013, at 17:48, Ricardo Luiz Dalbosco <ricardo at dalbosco.net>
> wrote:
> >
> > > Hi,
> > >
> > > I'm trying to use an array interval to create holes in a Plane Surface.
> > >
> > > My script generates dynamically a variable number of squares, wich
> represent coil turns. Those squares are then assembled in Line Loops and
> saved in an array.
> > >
> > > Then, It's possible to create a Physical Surface like this
> > > Physical Surface("Coil") = {loopsCoil[1]:loopsCoil[n]};
> > >
> > > Where loopsCoil[ ] is the array, and n is the number of turns
> > >
> > > It happens that the coil is placed inside the Air region. Then, to
> define my Air region I need to specify the Coil as a "hole".
> > > But when I try to do this:
> > >
> > > Plane Surface(airRegion) = {allAirRegion, loopsCoil[1]:loopsCoil[n]}
> > >
> > > Gmsh simply closes, without an error message.
> > > So, it seems I can't define a Plane Surface with the array syntax.
> > >
> > > Does anyone knows how I can proceed to create the holes in the surface?
> > >
> > >
> > > --
> > > Ricardo Luiz Dalbosco      -
> > >
> > > _______________________________________________
> > > gmsh mailing list
> > > gmsh at geuz.org
> > > http://www.geuz.org/mailman/listinfo/gmsh
> >
> > --
> > Prof. Christophe Geuzaine
> > University of Liege, Electrical Engineering and Computer Science
> > http://www.montefiore.ulg.ac.be/~geuzaine
> >
> >
> >
> >
> > _______________________________________________
> > gmsh mailing list
> > gmsh at geuz.org
> > http://www.geuz.org/mailman/listinfo/gmsh
>
> --
> Prof. Christophe Geuzaine
> University of Liege, Electrical Engineering and Computer Science
> http://www.montefiore.ulg.ac.be/~geuzaine
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130110/67a0dc68/attachment.html>