# Plotting issue on square mesh

**URL:** https://community.freefem.org/t/plotting-issue-on-square-mesh/1897
**Category:** General Discussion
**Created:** [July 16, 2022, 5:57pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897 "2022-07-16T17:57:40Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![AzizTakhirov](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aziztakhirov/32/26_2.png) [@AzizTakhirov](https://community.freefem.org/u/AzizTakhirov)
#### Post date: [July 16, 2022, 5:57pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/1 "2022-07-16T17:57:41Z")

</div>

Hello,  
I just installed the FreeFem++ v4.11 on Linux Mint 20.3 on my new machine.  
I was testing the codes in the examples and encountered segfault with plotting on a square mesh.

For example, this code produces segfault when it comes to the plot line:

> mesh Th = square(150, 50, [3_x, y]);  
> plot(Th,wait=1);  
> fespace Vh(Th, P1);  
> Vh u;  
> u = cos(2.0_pi_x_y);  
> plot(u,wait=1,cmm=“initial field”);

However, if I set u = const, then there is no segfault.

On the other hand, this code goes through fine:

> border C(t=0, 2_pi){x=cos(t); y=sin(t);}  
> mesh Th = buildmesh(C(50));  
> fespace Vh(Th, P1);  
> Vh u;  
> u = cos(2.0_pi_x_y);  
> plot(u,wait=1,cmm=“initial field”);

Any ideas on what could be going wrong?

---

<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: [July 17, 2022, 10:28am UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/2 "2022-07-17T10:28:07Z")

</div>

Do you have old version of freefem installed  
Check with

```auto
which freefem++
which ffglut 

```

If the paths are not the same then you have two version so remote thé old one

---

<div class="post-metadata">

### Author: ![AzizTakhirov](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aziztakhirov/32/26_2.png) [@AzizTakhirov](https://community.freefem.org/u/AzizTakhirov)
#### Post date: [July 17, 2022, 10:37am UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/3 "2022-07-17T10:37:49Z")

</div>

I only have one version.

---

<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: [July 17, 2022, 1:19pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/4 "2022-07-17T13:19:20Z")

</div>

You can try to create a file of the plot

```auto
FreeFem++ script.edp -fglut script.fglut

```

to see the plot

```auto
ffglut -vvv script.fglut

```

And the have an idea of the problem!

---

<div class="post-metadata">

### Author: ![AzizTakhirov](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aziztakhirov/32/26_2.png) [@AzizTakhirov](https://community.freefem.org/u/AzizTakhirov)
#### Post date: [July 17, 2022, 6:21pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/5 "2022-07-17T18:21:24Z")

</div>

> [@frederichecht](#):
>
> ```auto
> FreeFem++ script.edp -fglut script.fglut
> 
> ```

Thank you for your suggestion. I tried what you said and here is what I’m getting. If I use

> mesh Th = square(15,15);

then ffglut plots it without an issue. But with

> mesh Th = square(20,20);

I get the following error message:  
[out.pdf](https://community.freefem.org/uploads/short-url/9VlaeAegzkFlj69srvlEsakdXka.pdf) (76.3 KB)

---

<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: [July 18, 2022, 9:47am UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/6 "2022-07-18T09:47:30Z")

</div>

Can you sent the file script.fglut ?

---

<div class="post-metadata">

### Author: ![AzizTakhirov](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aziztakhirov/32/26_2.png) [@AzizTakhirov](https://community.freefem.org/u/AzizTakhirov)
#### Post date: [July 18, 2022, 5:43pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/7 "2022-07-18T17:43:43Z")

</div>

Here it is:  
[fflgut file](https://www.dropbox.com/s/w21tohdrvgu3sej/Heat1.fglut?dl=0)

---

<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: [July 22, 2022, 10:04am UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/8 "2022-07-22T10:04:01Z")

</div>

I have try the glut file is ok for my version of FreeFem

the output is :

```auto
MBP-M1-FH:Downloads hecht$ ffglut -v Heat1.fglut 
 glutscreenscale 1 1152 744 1728 1117
ffglut : 10
 fopen :Heat1.fglut 0x1ee0c4d50
 mode read = r
 GRead : nv 441 800 80
  -- End of read: mesure = 1 border mesure 4
  -- BuildAdj:0x600000618e60 nb Elememt 800 nb vertices 441
             : nb adj = 1240 on border 80 nea = 3 nva = 2 nb no manifold border 0

  -- Mesh2 (File *), d 2, n Tet 800, n Vtx 441 n Bord 80

 next is build 0x13ee0efa0 wait :1 -> 1 gwait = 0

on a lue le premier plot next plot: 0x13ee0efa0
pView 0 0 1153 745 kscreenscale= 1
DefaultView 2 0 theplot 0x0
 change current plot to: 0x13ee0efa0 et Lock Plot . winnum 0
OneWindow:: add 0 -> 0
OneWindow:: set 0 -> 0
DefaultView 2 0 theplot 0x13ee0efa0
 We Read a plot : 1 0x0 -1
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 01
DefaultView 0 0 theplot 0x13ee0efa0
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
Key winnum: 0
 send signal For Next plot, skip: No More Plot !  
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
Key winnum: 0
 send signal For Next plot, skip: No More Plot !  
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
Key winnum: 0
 send signal For Next plot, skip: No More Plot !  
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
      ThePlot::Plot 1 0x13ee0efa0 win 0x13ef60170 11
Key winnum: 0
MBP-M1-FH:Downloads hecht$ 

```

The only way is to recompile ffglut and reinstall.

remove ffglut

```auto
MBP-M1-FH:~ hecht$ cd ff/ff-10/
MBP-M1-FH:ff-10 hecht$ rm src/nw/ffglut 
make 

/Library/Developer/CommandLineTools/usr/bin/make all-am
make[4]: Nothing to be done for `all-am'.
Making all in nw
g++ -Wno-undefined-var-template -m64 -fPIC -DNDEBUG -O3 -O3 -O3 -std=c++14 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -o ffglut ../femlib/Drawing.o ../femlib/fem.o ../fflib/ffapi.o ../femlib/FQuadTree.o ../femlib/GQuadTree.o ../femlib/Mesh1dn.o ../femlib/Mesh2dn.o ../femlib/Mesh3dn.o ../femlib/MeshSn.o ../femlib/MeshLn.o ../femlib/mshptg.o ../Graphics/ffglut.o ../Graphics/ffthreads.o ../Graphics/gggg.o ../libMesh/libMesh.a -framework GLUT -framework OpenGL -framework Cocoa -lpthread 
Making all in mpi
make[3]: Nothing to be done for `all'.
make install

```

---

<div class="post-metadata">

### Author: ![AzizTakhirov](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aziztakhirov/32/26_2.png) [@AzizTakhirov](https://community.freefem.org/u/AzizTakhirov)
#### Post date: [July 25, 2022, 11:15am UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/9 "2022-07-25T11:15:56Z")

</div>

I reinstalled Linux 20.2 and then everything worked.  
Thank you for your help!

---

<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: [July 25, 2022, 12:59pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/10 "2022-07-25T12:59:43Z")

</div>

Very good, I close this plotting issue.

---

<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: [July 25, 2022, 1:00pm UTC](https://community.freefem.org/t/plotting-issue-on-square-mesh/1897/11 "2022-07-25T13:00:02Z")

</div>


