[Gmsh] Issues with Gmsh GUI

Gmsh User amrit_pou at hotmail.com
Wed May 11 19:14:32 CEST 2011


Hello everyone,
I am having issues with physically grouping different volumes and having them
displayed correctly after saving them in .msh file. I think I get the meshing
part right when I first run .geo file in GMSH, but once I save this .msh file
and try to re-open it from GMSH, some of the volumes are gone. I am thinking
that this is somehow associated with the way I am grouping different volumes. It
will be very hard for me to explain what exactly I am talking about unless
someone runs my .geo file and saves the resulting meshes in .msh file and opens
it again from GMSH. I see that physical tags do appear in .msh file for
tetrahedrons belonging to different volumes. But why does GMSH not display the
entire volume in GUI when I open the .msh file? Why does it miss some of the
volumes? My another question is: how can I assign different colors to different
physical volumes (in my .geo file) so that I can easily identify volumes with
the same tag?
As you can tell by looking at my .geo file, this geometry is used as an outer
boundary to employ "Perfectly Matched Layer" technique in finite element
electromagnetic calculation.
Thank you in advance for sharing your insight!
Ps # .geo file attached.

// .geo file begins here
*****************************************************
// Mesh size
lc = 0.3 ; // change this if needed

// All point at z = -1.5 
Point(1) = {-1.0, -1.0, -1.5, lc} ;
Point(2) = {-1.0, 1.0, -1.5, lc} ;
Point(3) = {1.0, 1.0, -1.5, lc} ;
Point(4) = {1.0, -1.0, -1.5, lc} ;
Point(5) = {-1.5, -1.5, -1.5, lc} ;
Point(6) = {-1.5, -1.0, -1.5, lc} ;
Point(7) = {-1.5, 1.0, -1.5, lc} ;
Point(8) = {-1.5, 1.5, -1.5, lc} ;
Point(9) = {-1.0, 1.5, -1.5, lc} ;
Point(10) = {1.0, 1.5, -1.5, lc} ;
Point(11) = {1.5, 1.5, -1.5, lc} ;
Point(12) = {1.5, 1.0, -1.5, lc} ;
Point(13) = {1.5, -1.0, -1.5, lc} ;
Point(14) = {1.5, -1.5, -1.5, lc} ;
Point(15) = {1.0, -1.5, -1.5, lc} ;
Point(16) = {-1.0, -1.5, -1.5, lc} ;



// Z surface bottom (PML)
// Lines
Line(1) = {1, 2} ;
Line(2) = {2, 3} ;
Line(3) = {3, 4} ;
Line(4) = {4, 1} ;
Line Loop(5) = {1, 2, 3, 4} ;
// Surface 
Plane Surface(6) = {5} ;


// XZ Edge North (PML)
// Lines
Line(7) = {6 ,7} ;
Line(8) = {7, 2} ;
Line(9) = {1, 6} ;
Line Loop(10) = {7, 8, -1, 9} ;
// Surface 
Plane Surface(11) = {10} ; 



// YZ Edge East (PML) 
// Lines
Line(12) = {2, 9} ;
Line(13) = {9, 10} ;
Line(14) = {10, 3} ;
Line Loop(15) = {12, 13, 14, -2} ;
// Surface 
Plane Surface(16) = {15} ; 


// XZ Edge South (PML) 
// Lines
Line(17) = {3, 12} ;
Line(18) = {12, 13} ;
Line(19) = {13, 4} ;
Line Loop(20) = {-3, 17, 18, 19} ;
// Surface 
Plane Surface(21) = {20} ; 


// YZ Edge West (PML)
// Lines
Line(22) = {16, 1} ;
Line(23) = {4, 15} ;
Line(24) = {15, 16} ;
Line Loop(25) = {22, -4, 23, 24} ;
// Surface 
Plane Surface(26) = {25} ; 




// XYZ Corner  North-West (PML)
// Lines
Line(27) = {5, 6} ;
Line(28) = {16, 5} ;
Line Loop(29) = {27, -9, -22, 28} ;
// Surface 
Plane Surface(30) = {29} ; 



// XYZ Corner North-East (PML)
// Lines
Line(31) = {7, 8} ;
Line(32) = {8, 9} ;
Line Loop(33) = {31, 32, -12, -8 } ;
// Surface 
Plane Surface(34) = {33} ; 


// XYZ Corner South-East (PML) 
// Lines
Line(35) = {10, 11} ;
Line(36) = {11, 12} ;
Line Loop(37) = {-14, 35, 36, -17} ;
// Surface 
Plane Surface(38) = {37} ; 


// XYZ Corner South-West (PML) 
// Lines
Line(39) = {13, 14} ;
Line(40) = {14, 15} ;
Line Loop(41) = {-23, -19, 39, 40} ;
// Surface 
Plane Surface(42) = {41} ; 

// Surfaces at z = -1.0
surf2[] = Translate{0, 0, 0.5} {Duplicata{ Surface{6, 11, 16, 21, 26, 30, 34,
38, 42} ; } } ; 

// Surfaces  at z = 1.5 
surf3[] = Translate{0, 0, 3} {Duplicata{ Surface{6, 11, 16, 21, 26, 30, 34, 38,
42} ; } } ; 

// Volumes from surfaces at z = -1.5 
out1[] = Extrude{0, 0, 0.5} {Surface{6, 11, 16, 21, 26, 30, 34, 38, 42};} ;

// Volumes from surfaces at z = -1.0 
out2[] = Extrude{0, 0, 2} {Surface{surf2[0], surf2[1], surf2[2], surf2[3],
surf2[4], surf2[5], surf2[6], surf2[7], surf2[8]}; } ;

// Volumes from surfaces at z = 1.5 
out3[] = Extrude{0, 0, -0.5} {Surface{surf3[0], surf3[1], surf3[2], surf3[3],
surf3[4], surf3[5], surf3[6], surf3[7], surf3[8]}; } ;


// Grouping common volumes 
Physical Volume(1000) = {out2[1], out2[3] } ;
Physical Volume(1001) = { out2[2], out2[4] } ;
Physical Volume(1002) = {out1[0], out3[0] } ;

Physical Volume(1003) = {out2[5], out2[6], out2[7], out2[8]} ;
Physical Volume(1004) = {out1[2], out1[4], out3[2], out3[4]} ;
Physical Volume(1005) = {out1[1], out1[3], out3[1], out3[3]} ;
Physical Volume(1006) = {out1[5], out1[6], out1[7], out1[8], out3[5], out3[6],
out3[7], out3[8]} ;



Physical Volume(1007) = {out2[0]} ;