[Gmsh] 3D meshing
Gagliardini
gagliar at lgge.obs.ujf-grenoble.fr
Wed Mar 2 08:53:04 CET 2005
Dear all,
I have to mesh a geophysical object defined by its upper and lower surfaces
(a z=f(x,y) function that can be set on a regular grid). The 4 vertical
faces are plane surfaces (a kind of shoes box with not flat upper and
lower surfaces).
I have read in the gmsh mailing list that only 5 or 6 faces volume can be
meshed using gmsh. Is this still true ?
If gmsh is not able to mesh volume with more than 6 faces, do you know an
other mesher that can do that ?
I have tried a small script to mesh my shoes box (attached). All the
surfaces are meshed but no volume element are created.
What I'm doing wrong ?
Thanks
Olivier Gagliardini
-------------- next part --------------
// Number of band
N = 10 ;
// x and y size
H = 2.0 ;
dH = 0.5 ;
L = 1.0 ;
delta = L/N ;
// mesh element lenght
lc = delta ;
// mesh element lenght at the surface
lcs = lc ;
Function bedrock
bed = L + dH*Sin(2*Pi*xx/L)*Sin(2*Pi*yy/L) ;
Return
Function surface
Surf = H ;
Return
// mesh the bed surface 6
y= 0 ;
x = 0 ;
Nsurf0 = 15*N*N + 1 ;
Nsurf = Nsurf0 ;
For j In {1:N}
For i In {1:N}
//
// p4 ---- l3 ---- p3
// | \ / |
// | \ / |
// | l8 l7 |
// | \ / |
// l4 p5 l2
// | / \ |
// | l5 l6 |
// | / \ |
// |/ \ |
// p1 ---- l1 ---- p2
//
// Define 5 points
xx = x ; yy = y ; Call bedrock ;
p1 = newp ; Point(p1) = {xx,yy,bed,lc} ;
xx = x + delta ; yy = y ; Call bedrock ;
p2 = newp ; Point(p2) = {xx,yy,bed,lc} ;
xx = x + delta ; yy = y + delta ; Call bedrock ;
p3 = newp ; Point(p3) = {xx,yy,bed,lc} ;
xx = x ; yy = y + delta ; Call bedrock ;
p4 = newp ; Point(p4) = {xx,yy,bed,lc} ;
xx = x + 0.5*delta ; yy = y + 0.5*delta ; Call bedrock ;
p5 = newp ; Point(p5) = {xx,yy,bed,lc} ;
// Define 8 lines
l1 = newc ; Line(l1) = {p1,p2} ;
l2 = newc ; Line(l2) = {p2,p3} ;
l3 = newc ; Line(l3) = {p3,p4} ;
l4 = newc ; Line(l4) = {p4,p1} ;
l5 = newc ; Line(l5) = {p1,p5} ;
l6 = newc ; Line(l6) = {p2,p5} ;
l7 = newc ; Line(l7) = {p3,p5} ;
l8 = newc ; Line(l8) = {p4,p5} ;
// Define 4 Line Loop and 4 Ruled Surface
ll1 = newc; Line Loop(ll1) = {l1,l6,-l5}; Ruled Surface(Nsurf) = {ll1};
Nsurf += 1 ;
ll2 = newc; Line Loop(ll2) = {l2,l7,-l6}; Ruled Surface(Nsurf) = {ll2};
Nsurf += 1 ;
ll3 = newc; Line Loop(ll3) = {l3,l8,-l7}; Ruled Surface(Nsurf) = {ll3};
Nsurf += 1 ;
ll4 = newc; Line Loop(ll4) = {l4,l5,-l8}; Ruled Surface(Nsurf) = {ll4};
Nsurf += 1 ;
x += delta ;
EndFor
x=0.0 ;
y += delta ;
EndFor
Coherence ;
Physical Surface(6) = {Nsurf0:Nsurf-1} ;
// mesh the 5 other surfaces
xx = 0.0 ; yy = 0.0 ; Call bedrock ;
p1 = newp ; Point(p1) = {xx,yy,bed,lc} ;
xx = L ; yy = 0.0 ; Call bedrock ;
p2 = newp ; Point(p2) = {xx,yy,bed,lc} ;
xx = L ; yy = L ; Call bedrock ;
p3 = newp ; Point(p3) = {xx,yy,bed,lc} ;
xx = 0.0 ; yy = L ; Call bedrock ;
p4 = newp ; Point(p4) = {xx,yy,bed,lc} ;
xx = 0.0 ; yy = 0.0 ; Call surface ;
p5 = newp ; Point(p5) = {xx,yy,Surf,lcs} ;
xx = L ; yy = 0.0 ; Call surface ;
p6 = newp ; Point(p6) = {xx,yy,Surf,lcs} ;
xx = L ; yy = L ; Call surface ;
p7 = newp ; Point(p7) = {xx,yy,Surf,lcs} ;
xx = 0.0 ; yy = L ; Call surface ;
p8 = newp ; Point(p8) = {xx,yy,Surf,lcs} ;
l1 = newc ; Line(l1) = {p1,p2} ;
l2 = newc ; Line(l2) = {p2,p3} ;
l3 = newc ; Line(l3) = {p3,p4} ;
l4 = newc ; Line(l4) = {p4,p1} ;
l5 = newc ; Line(l5) = {p5,p6} ;
l6 = newc ; Line(l6) = {p6,p7} ;
l7 = newc ; Line(l7) = {p7,p8} ;
l8 = newc ; Line(l8) = {p8,p5} ;
l9 = newc ; Line(l9) = {p1,p5} ;
l10 = newc ; Line(l10) = {p2,p6} ;
l11 = newc ; Line(l11) = {p3,p7} ;
l12 = newc ; Line(l12) = {p4,p8} ;
ll1 = newc; Line Loop(ll1) = {l1,l10,-l5,-l9}; Ruled Surface(Nsurf) = {ll1};
Physical Surface(1) = {Nsurf} ;
Nsurf += 1 ;
ll1 = newc; Line Loop(ll1) = {l2,l11,-l6,-l10}; Ruled Surface(Nsurf) = {ll1};
Physical Surface(2) = {Nsurf} ;
Nsurf += 1 ;
ll1 = newc; Line Loop(ll1) = {-l3,-l12,l7,l11}; Ruled Surface(Nsurf) = {ll1};
Physical Surface(3) = {Nsurf} ;
Nsurf += 1 ;
ll1 = newc; Line Loop(ll1) = {-l4,-l9,l8,l12}; Ruled Surface(Nsurf) = {ll1};
Physical Surface(4) = {Nsurf} ;
Nsurf += 1 ;
ll1 = newc; Line Loop(ll1) = {l5,l6,l7,l8}; Ruled Surface(Nsurf) = {ll1};
Physical Surface(5) = {Nsurf} ;
Coherence ;
s1 = newc ; Surface Loop(s1) = {Nsurf0:Nsurf} ;
v1 = newc ; Volume(v1) = {s1} ;
Physical Volume(7) = {v1} ;
-------------- next part --------------
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Olivier Gagliardini
Laboratoire de Glaciologie et G?ophysique de l'Environnement
54, rue Moli?re
BP 96, 38402 Saint-Martin-d'H?res
Cedex France
http://www-lgge.ujf-grenoble.fr/~gagliar/
Tel : 04 76 82 42 76
Fax : 04 76 82 42 01
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&