[Gmsh] physical surface in gmsh

Geordie McBain gdmcbain at freeshell.org
Tue Mar 18 01:09:28 CET 2014


2014-03-18 5:54 GMT+11:00 王学敏 <campusxuemin at gmail.com>:
> Dear gmsh user,
> I got geometry from solidwork and got mesh from gmsh. I should define
> physical surface in .geo file and I did. But when I imported mesh to
> freefem, it seemed that there was no physical surface. Especially physical
> surface 27 in geo file. Attachments are geo file and msh file. Thank you so
> much.

For FreeFem++, you might have more luck exporting in "format -mesh",
as in http://www.geuz.org/pipermail/gmsh/2010/005438.html

On the command-line (after having renamed your "solid (1).geo" as "solid1.geo"):

$ gmsh -3 -format mesh -string 'Mesh.SaveElementTagType=2;' solid1.geo

For me this produced a solid1.mesh, as attached, which did have
triangular elements with tag 27.  I verified this by calculating their
collective area in FreeFem++ with a very small FreeFem++ script,
solid1.edp, as attached:

mesh3 Th = readmesh3("solid1.mesh");
int[int] surfaces = [25, 26, 27];
for (int i = 0; i < surfaces.n; i++) {
    cout << "Area of Surface" << " " << surfaces[i] << ": " <<
int2d(Th, surfaces[i]) (1.0)
    << endl;
}

It produces the output:

Area of Surface 25: 2
Area of Surface 26: 2.1146
Area of Surface 27: 105.613
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solid1.mesh
Type: model/mesh
Size: 16498 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20140318/92072814/attachment.mesh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solid1.edp
Type: application/octet-stream
Size: 218 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20140318/92072814/attachment.edp>