# Upload with gmsh and plot mesh

**URL:** <https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044>\
**Category:** General Discussion\
**Created:** [June 17, 2021, 6:11am UTC](https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044 "2021-06-17T06:11:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![distractor](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@distractor](https://community.freefem.org/u/distractor)\
**Post date:** [June 17, 2021, 6:11am UTC](https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044/1 "2021-06-17T06:11:06Z")

</div>

Hi everyone,

I am generating a \*.msh file with python (please see [this link](https://drive.google.com/file/d/1hxeKcDGZihd9R0gDtqWRcZo6-9S9ZqAv/view?usp=sharing)). The same file is then supposed to be imported in the FreeFem++ and I do that with:

```auto
load "medit"
load "gmsh"

mesh3 Th = gmshload3("../processed_data/EPC.msh");
fespace Vh (Th, P1);
Vh us;

plot(Th, wait=1);
medit("sol1", Th, us, wait=1);

```

Now the mesh gets imported successfully, it also prints that 13342 tetrahedrons were imported which is perfect. However, when I try to plot the mesh things go bad:

- the plot function works, but it only plots the nodes, not the finite elements which I want to see
- while the medit function fails with segmentation error so no image is returned.

It is really important for me to know if I am using the medit function in a wrong way or the \*.msh file is broken and I have to fix it somehow. I have no idea how, but at least I would know what the issue is.

BTW: Gmsh, opens the \*.msh normally.

Thank you!

---

<div class="post-metadata">

**Author:** ![fivanci](https://avatars.discourse-cdn.com/v4/letter/f/e95f7d/32.png) [@fivanci](https://community.freefem.org/u/fivanci)\
**Post date:** [June 17, 2021, 6:54am UTC](https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044/2 "2021-06-17T06:54:54Z")

</div>

Hi !

I tried to load and open your mesh - I can do it without a problem both using `plot(...)` and `medit(...)`. Maybe your `medit` is outdated ?

Also, I see you are trying to plot function `us` with `medit`, but you did not define it prior to that. Maybe this is the problem as well (although, it works fine for me, just plots the mesh). Try this e.g.

```auto
us = x;
medit("us",Th,us,wait=1);

```

or just

```auto
medit("mesh only",Th,wait=1);

```

Unrelated (but maybe useful), I noticed that you only have one label of the boundary on the mesh. I don’t have much experience with `gmsh` but as far as I know you can define boundary label with `physical labels` withing `gmsh`. One way to check your mesh labels in `freefem` is

```auto
int[int] labs = labels(Th);
cout << labs << endl;

```

if

---

<div class="post-metadata">

**Author:** ![distractor](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@distractor](https://community.freefem.org/u/distractor)\
**Post date:** [June 17, 2021, 7:12am UTC](https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044/3 "2021-06-17T07:12:28Z")

</div>

Oh thank you, that was extremely helpful. At least now I know the \*.msh file should work.

The

```auto
medit("mesh only",Th,wait=1);

```

still finishes in segmentation fault while

```auto
us = x;
medit("us",Th,us,wait=1);

```

doesn’t but at the same time no window is opened - the program just finished execution.

Isn’t `medit` supposed to be included in the FreeFem? Is there a special way to update it? My FreeFem version is probably the latest (4.6 installed on Windows yesterday), and since I believed `medit` is included I thought I have the latest version of it as well.

---

<div class="post-metadata">

**Author:** ![fivanci](https://avatars.discourse-cdn.com/v4/letter/f/e95f7d/32.png) [@fivanci](https://community.freefem.org/u/fivanci)\
**Post date:** [June 17, 2021, 7:49am UTC](https://community.freefem.org/t/upload-with-gmsh-and-plot-mesh/1044/4 "2021-06-17T07:49:56Z")

</div>

> [@distractor](#):
>
> Isn’t `medit` supposed to be included in the FreeFem? Is there a special way to update it? My FreeFem version is probably the latest (4.6 installed on Windows yesterday), and since I believed `medit` is included I thought I have the latest version of it as well.

Not sure how things work on Windows - currently, I run ff version 4.9 on Linux where it is easier (at least for me) to link and update different software. I have no idea how Windows is handling these kind of thing.

Maybe just try to export your mesh from `FreeFem++` to `.vtu` / `.vtk` file and check how things are in `Paraview`. Probably easiest detailed visualization option. Or better, solve some trivial example on this mesh and check solution in `Paraview`. This should give you some answers.

if
