[Gmsh] Different element sizes in different spatial directions?

Martin Meyer Martin.Meyer4 at mailbox.tu-dresden.de
Wed Jan 11 15:40:54 CET 2012


I've managed to compile a script that generates me some nodes that are  
distributed in the way I described, however with a slight random  
distortion of the coordinates:

dx = 500 ;
dy = 250 ;
n = 0 ;
m = 0 ;
k = 0 ;
randx = 0 ;
randy = 0 ;
x = 0 ;
y = 0 ;
xmax = 1000 ;
ymax = 500 ;
distort = 3 ;
For x In {0:xmax/dx}
  For y In {0:ymax/dy}
   n=n+1;
   randx=0;
   randy=0;
   If(x!=0 && x!=xmax/dx)
    randx=Rand(dx/distort);
   EndIf
   If(y!=0 && y!=ymax/dy)
    randy=Rand(dy/distort);
   EndIf
   Point(n)={x*dx+randx,y*dy+randy,0,dx};
   m=n-1;
   If(m>0 && y!=0)
    k=k+1;
    Line(k)={n,m};  //nach unten
   EndIf
   m=n-ymax/dy-1;
   If(m>0 && x!=0)
    k=k+1;
    Line(k)={n,m};  //nach links
   EndIf
  EndFor
EndFor

I can't however create a plane surface from these lines and points  
with my internal points and lines being taken into consideration. Can  
you help me with this?


Zitat von "Ruth V. Sabariego" <r.sabariego at ulg.ac.be>:

> Try this:
> a = 100 ;
> lc1 = 10 ;
> lc2 = 1 ;
>
> Point(1) = {0,0,0,lc1};
> Point(2) = {a,0,0,lc1};
>
> Line(1) = {1,2};
>
> Extrude {0, a, 0} {
>   Line{1}; Layers{a/lc2};
> }
>
> Regards,
> Ruth
>
> --
> Dr. Ir. Ruth V. Sabariego
> University of Liege, Electrical Engineering & Computer Science,
> Applied & Computational Electromagnetics (ACE),
> phone: +32-4-3663737 - fax: +32-4-3662910 - http://ace.montefiore.ulg.ac.be/
>
>
>
> On 10 Jan 2012, at 13:48, Martin Meyer wrote:
>
>> Hi,
>>
>> I'm pretty new to gmsh, and so far I haven't succeeded in creating   
>> a mesh with different element sizes in different spatial directions  
>>  (for instance a 100m*100m square with average element sizes of 10m  
>>  in x direction and 1m in y direction).
>> Is this possible, and if so, can you show me how to do that (either  
>>  script or GUI)?
>>
>> Thanks in advance for your thoughts,
>> Martin
>>
>> _______________________________________________
>> gmsh mailing list
>> gmsh at geuz.org
>> http://www.geuz.org/mailman/listinfo/gmsh
>
>