[Gmsh] Medit file format

Martin Vymazal martin.vymazal at vki.ac.be
Tue May 4 08:04:43 CEST 2010


Hi Geordie,

  you're right, it works. In fact, I forgot to define some surface or  
volume last time, that's why the cube was not meshed properly. I would  
have had the same problem if I saved the output in any other file  
format supported by gmsh.
  There's still a slight problem, though (I think). I force the faces  
of the cube to have physical numbers 1,2 or 3. Hence I'd expect that  
the nodal reference index in medit file format can be 1,2 or 3.  
However, in addition to those numbers, I also have some weird values  
like 10 or 14 (the files are attached).

  Best regards,

Martin Vymazal



Quoting Geordie McBain <gdmcbain at freeshell.org>:

> 2010/4/20 Martin Vymazal <martin.vymazal at vki.ac.be>:
>> Hello gmsh community,
>>
>>  I would like to ask if it is possible to save a 3D mesh generated by gmsh
>> in medit file format. I have a cube, I set both the faces of the cube and
>> its volume as physical before saving the mesh as a medit file. However, when
>> I re-open the saved file with gmsh, I see only 2D faces of the cube meshed,
>> the 3D elements in the interior of the cube are missing.
>>  I found some older posts in the mailing list archive (2007) with the same
>> question. The reply was 'the support of medit file format is highly
>> experimental and not recommended to use'. What's the status today?
>
> Today it works fine.  I regularly generate 3-D MEDIT meshes using Gmsh.
>
> There were some significant improvements in September and October
> 2009.  Are you using a version of Gmsh more recent than that?
>
>>  If gmsh cannot save directly correct medit files, does anyone know of any
>> other way of converting msh -> medit? Thanks for any ideas/suggestions.
>
> I did write a translator for msh -> medit, but I do not believe it is
> required any longer.
>
> Try the following at the command line:
>
> $ gmsh -3 -format mesh -string 'Mesh.SaveElementTagType=2;' cuboid.geo
>
> with the attached .geo geometry file.  I also attach the resulting
> MEDIT mesh; it correctly contains vertices, triangles, and tetrahedra.
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
//-*- C++ -*-
/*********************************************       
Cube uniformly meshed along all three axes      
**********************************************/       
lc = 0.2; //.05;     
X = 1; // x 
Y = 1; // y
Z = 0.0625; //0.05; // extrude en z

Point(1) = {0, 0, 0, lc}; 
Point(2) = {X, 0, 0, lc};
Point(3) = {X, Y, 0, lc};
Point(4) = {0, X, 0, lc};

Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};

nb_pts_edge = 17;
nb_layers = 1;

For iLine In {1:4}
	Transfinite Line{iLine} = nb_pts_edge;
EndFor

Line Loop(1) = {1,2,3,4};
Plane Surface(1) = {1};


Transfinite Surface(1) = {1,4,3,2}; 
out[] = Extrude{0, 0, Z}{Surface{1}; Layers{nb_layers}; Recombine;};


Printf("PRINTING INFO: extruded face on top = %g,  original face =  %g", out[0], out[1]);
Printf("PRINTING INFO: side1 = %g,  side2 =  %g", out[2], out[3]);
Printf("PRINTING INFO: side3 = %g,  side4 =  %g", out[4], out[5]);


Physical Surface(1) = {out[4]};
Physical Surface(2) = {out[2],out[3],out[5]};
Physical Surface(3) = {out[0],out[1]};


Surface Loop(1) = {out[0],out[1],out[2],out[3],out[4],out[5]};
//Volume (1) = {1};
Physical Volume (1) = {1};

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cube.mesh
Type: model/mesh
Size: 63200 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100504/44b3f61e/attachment.mesh>