 lc=1; nz=3; lg=0.25; eij=0.005; nb_tri=3;  m=0; p=0;

For n In{0:1}

     Printf("boucle %g",n);
     
     // création du premier canal plan
     
     a=newp; Point(a)={0,n*0.2,0,lc};
     b=newp; Point(b)={lg,n*0.2,0,lc};
     c=newp; Point(c)={lg,eij+n*0.2,0,lc};
     d=newp; Point(d)={0,eij+n*0.2,0,lc};
     l1=newreg; Line(l1)={a,b};
     l2=newreg; Line(l2)={b,c};
     l3=newreg; Line(l3)={c,d};
     l4=newreg; Line(l4)={d,a};
     Transfinite Line{l1,l3}=nb_tri+1;
     tot=newreg; Line Loop(tot)={l1,l2,l3,l4};
     surf=newreg; Plane Surface(surf)={tot};    
     
     test_surf[p]=newreg;     
     p1[]=Extrude Line{l1, {0,0,8}} {
     Layers { {nz}, {test_surf[p]}, {1} };
     };;
     surf1[m]=newreg;surf1[m]=p1[1];
     Printf("surf1_%g=%g",m,surf1[m]);    
     m=m+1;p=p+1;
     
     dom[n]=newreg;
     tmp[]=Extrude Surface {surf, {0,0,8}} {
     Layers { {nz}, {dom[n]}, {1} };
     };;
     sortie[n]=newreg; sortie[n]=tmp[0];
        
EndFor

Printf("Fin des boucles");

Printf("surf1_0=%g",surf1[0]);Printf("surf1_1=%g",surf1[1]);

Physical Surface(22222)={test_surf[]};
Physical Surface(11111)={surf1[]};
Physical Surface(88888)={sortie[]};
Physical Volume (99999)={dom[]};
Physical Surface(55555)={surf};

