# File of .mesh from GMSH (INRIA Medit) cannot be opened

**URL:** https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961
**Category:** General Discussion
**Created:** [August 25, 2022, 2:35am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961 "2022-08-25T02:35:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SHENG](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@SHENG](https://community.freefem.org/u/SHENG)
#### Post date: [August 25, 2022, 2:35am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/1 "2022-08-25T02:35:02Z")

</div>

Dear all,

I faced a problem. The file of .mesh from GMSH (INRIA Medit) cannot be opened by freefem++.

FreeFem reminded that " Return type false, your mesh is MeshS type, use gmshloadS function". However, the 3D geometry has been meshed by “Mesh \<\< 3D” in Gmsh.

The freefem code:  
"load “msh3”  
load “gmsh”

mesh3 Th=gmshload3(“Background.mesh”);  
plot (Th,wait=1);".

The Gmsh code:  
"SetFactory(“OpenCASCADE”);  
Box(1) = {0, 0, 0, 1, 1, 1};

Physical Volume(“background”) = {1};  
lcar1 = .05;  
MeshSize{ PointsOf{ Volume{:}; } } = lcar1;

Point(20009) = {0.45, 0.45, 1, 0.05};  
//+  
Point(20010) = {0.55, 0.45, 1, 0.05};  
//+  
Point(20011) = {0.55, 0.55, 1, 0.05};  
//+  
Point(20012) = {0.45, 0.55, 1, 0.05};  
//+  
Line(20013) = {20009, 20010};  
//+  
Line(20014) = {20010, 20011};  
//+  
Line(20015) = {20011, 20012};  
//+  
Line(20016) = {20012, 20009};  
//+  
Curve Loop(20017) = {20016, 20013, -20014, -20015};

Surface(1001)={20017};  
Physical Surface(“Source”,1002)={1001};  
Point(30009) = {0.45, 0, 0.45, 0.05};  
//+  
Point(30010) = {0.55, 0, 0.45, 0.05};  
//+  
Point(30011) = {0.55, 0, 0.55, 0.05};  
//+  
Point(30012) = {0.45, 0, 0.55, 0.05};  
//+  
Line(30013) = {30009, 30010};  
//+  
Line(30014) = {30010, 30011};  
//+  
Line(30015) = {30011, 30012};  
//+  
Line(30016) = {30012, 30009};  
//+  
Curve Loop(30017) = {30016, 30013, -30014, -30015};

Surface(2001)={30017};  
Physical Surface(“Source2”,2002)={2001};  
BooleanFragments{ Volume{1}; Delete; }{ Surface{1001,2001}; Delete; }".

The save processes of .mesh file: “File \>\> Export \>\> Mesh INRIA Medit.mesh \>\> Background.mesh.”.

Please give me some advice. I’d appreciate it.

Best regards

Liu

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 25, 2022, 12:50pm UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/2 "2022-08-25T12:50:12Z")

</div>

Can you send the Background.mesh , if it is possible  
I think you bug is in mesh part !

---

<div class="post-metadata">

### Author: ![SHENG](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@SHENG](https://community.freefem.org/u/SHENG)
#### Post date: [August 25, 2022, 1:44pm UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/3 "2022-08-25T13:44:45Z")

</div>

Dear Prof. Hecht,

Thank you so much for your reply.  
I am sorry that I cannot attached the Background.mesh, because I am a new registrant.  
I post a part of the contents of the mesh file here. Please have a look. Thank you very much.  
" MeshVersionFormatted 2  
Dimension  
3  
Vertices  
7151  
0.45 0.45 1 20009  
0.55 0.45 1 20010  
0.55 0.55 1 20011  
0.45 0.55 1 20012  
0.45 0 0.45 30009  
0.55 0 0.45 30010  
0.55 0 0.55 30011  
0.45 0 0.55 30012  
0 0 1 30013  
0 0 0 30014  
0 1 1 30015  
0 1 0 30016  
1 0 1 30017  
1 0 0 30018  
1 1 1 30019  
1 1 0 30020  
0.5 0.45 1 20013  
0.55 0.5 1 20014  
0.5 0.55 1 20015  
0.45 0.5 1 20016  
0.5 0 0.45 30013  
0.55 0 0.5 30014  
0.5 0 0.55 30015  
0.45 0 0.5 30016  
0 0 0.05 30017  
0 0 0.1 30017  
0 0 0.15 30017  
0 0 0.2 30017  
0 0 0.25 30017  
0 0 0.3 30017  
0 0 0.35 30017  
0 0 0.4 30017  
0 0 0.45 30017  
0 0 0.5 30017  
0 0 0.55 30017  
0 0 0.6 30017  
0 0 0.65 30017  
0 0 0.7 30017  
0 0 0.75 30017  
0 0 0.8 30017  
0 0 0.85 30017  
0 0 0.9 30017  
0 0 0.95 30017  
0 0.05 1 30018  
0 0.1 1 30018  
0 0.15 1 30018  
0 0.2 1 30018  
0 0.25 1 30018  
0 0.3 1 30018  
0 0.35 1 30018  
0 0.4 1 30018  
0 0.45 1 30018  
0 0.5 1 30018  
0 0.55 1 30018  
0 0.6 1 30018  
0 0.65 1 30018  
0 0.7 1 30018  
0 0.75 1 30018  
0 0.8 1 30018  
0 0.85 1 30018  
0 0.9 1 30018  
0 0.95 1 30018  
0 1 0.05 30019  
0 1 0.1 30019  
0 1 0.15 30019  
0 1 0.2 30019  
0 1 0.25 30019  
0 1 0.3 30019  
0 1 0.35 30019  
0 1 0.4 30019  
0 1 0.45 30019  
0 1 0.5 30019  
0 1 0.55 30019  
0 1 0.6 30019  
0 1 0.65 30019  
0 1 0.7 30019  
0 1 0.75 30019  
0 1 0.8 30019  
0 1 0.85 30019  
0 1 0.9 30019  
0 1 0.95 30019  
0 0.05 0 30020  
0 0.1 0 30020  
0 0.15 0 30020  
0 0.2 0 30020  
0 0.25 0 30020  
0 0.3 0 30020  
0 0.35 0 30020  
0 0.4 0 30020  
0 0.45 0 30020  
0 0.5 0 30020  
0 0.55 0 30020  
0 0.6 0 30020  
0 0.65 0 30020  
0 0.7 0 30020  
0 0.75 0 30020  
0 0.8 0 30020  
0 0.85 0 30020  
0 0.9 0 30020  
0 0.95 0 30020  
1 0 0.05 30021  
1 0 0.1 30021  
1 0 0.15 30021  
1 0 0.2 30021  
1 0 0.25 30021  
1 0 0.3 30021  
1 0 0.35 30021  
1 0 0.4 30021  
1 0 0.45 30021  
1 0 0.5 30021  
1 0 0.55 30021  
1 0 0.6 30021  
1 0 0.65 30021  
1 0 0.7 30021  
1 0 0.75 30021  
1 0 0.8 30021  
1 0 0.85 30021  
1 0 0.9 30021  
1 0 0.95 30021  
1 0.05 1 30022  
1 0.1 1 30022  
1 0.15 1 30022  
1 0.2 1 30022  
1 0.25 1 30022  
1 0.3 1 30022  
1 0.35 1 30022  
1 0.4 1 30022  
1 0.45 1 30022  
1 0.5 1 30022  
1 0.55 1 30022  
1 0.6 1 30022  
1 0.65 1 30022  
1 0.7 1 30022  
1 0.75 1 30022  
1 0.8 1 30022  
1 0.85 1 30022  
1 0.9 1 30022  
1 0.95 1 30022  
1 1 0.05 30023  
1 1 0.1 30023  
1 1 0.15 30023  
1 1 0.2 30023  
1 1 0.25 30023  
1 1 0.3 30023  
1 1 0.35 30023  
1 1 0.4 30023  
1 1 0.45 30023  
1 1 0.5 30023  
1 1 0.55 30023  
1 1 0.6 30023  
1 1 0.65 30023  
1 1 0.7 30023  
1 1 0.75 30023  
1 1 0.8 30023  
1 1 0.85 30023  
1 1 0.9 30023  
1 1 0.95 30023  
1 0.05 0 30024  
1 0.1 0 30024  
1 0.15 0 30024  
1 0.2 0 30024  
1 0.25 0 30024  
1 0.3 0 30024  
1 0.35 0 30024  
1 0.4 0 30024  
1 0.45 0 30024  
1 0.5 0 30024  
1 0.55 0 30024  
1 0.6 0 30024  
1 0.65 0 30024  
1 0.7 0 30024  
1 0.75 0 30024

…  
"

Sincerely yours,  
Liu

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 26, 2022, 9:55am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/4 "2022-08-26T09:55:48Z")

</div>

You have no Triangle and No Tetrahedron i the mesh file, so no way your problem is in gmsh.

---

<div class="post-metadata">

### Author: ![SHENG](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@SHENG](https://community.freefem.org/u/SHENG)
#### Post date: [August 26, 2022, 11:48am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/5 "2022-08-26T11:48:42Z")

</div>

Dear Prof. Hecht,

Thank you very much for your valuable reply.  
I have successfully run the file of .msh (Gmsh MSH\_version 2 ) using FreeFem++.  
What are the differences between the two formats (i.e., .mesh and .msh)?  
Could I use the file of .msh rather than .mesh?

Best regards,  
Liu

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 26, 2022, 2:20pm UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/6 "2022-08-26T14:20:45Z")

</div>

mes .msh is the mesh format

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 26, 2022, 2:23pm UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/7 "2022-08-26T14:23:02Z")

</div>

Sorry the previous mail is send too early.

the .msh are Gmsh File and …mesh are inria mesh file .  
so to read .msh use loadgmsh() function or  
rea .mesh with readmesh() function.

Best Regards,

Frédéric Hecht.

---

<div class="post-metadata">

### Author: ![SHENG](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@SHENG](https://community.freefem.org/u/SHENG)
#### Post date: [August 27, 2022, 12:45am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961/8 "2022-08-27T00:45:36Z")

</div>

Dear Prof. Hecht,

Thank you so much for your message.

Best regards,  
Liu
