# Problem with adaptmesh and periodic boundary condition

**URL:** https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337
**Category:** General Discussion
**Created:** [November 18, 2021, 11:26am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337 "2021-11-18T11:26:51Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [November 18, 2021, 11:26am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/1 "2021-11-18T11:26:51Z")

</div>

Hi everyone,

I have run into an issue, which I am not sure how to solve myself. I am solving multiphase (Navier-Stokes + phase-field) equations and marching in time. I use “adaptmesh” function to tailor my FE mesh to the phase function. The code I developed was working fine until recently I got the error:  
“Exec error : periodic: Sorry one vertex of edge is losted”

I have found the error in the mailing list [here](https://www.ljll.math.upmc.fr/pipermail/freefempp/2012-September/002129.html), but adding “fixeborder=true” to “buildmesh” did not do anything. I also tried to make “adaptmesh” use old vertices with “keepbackvertices=true”, but that also did not help.

I created minimal example to reproduce the error (~ 8 MB ZIP file [here](http://www.mech.kth.se/~ugis/2021.11.18_lostEdge.zip)). When I run it, I get:

```auto
minExample> FreeFem++ -ne -nw tryAdapt.edp
-- FreeFem++ v4.6 (Tue 16 Jun 2020 06:53:31 AM CEST - git v4.6-113-g243cbb52)
 Load: lg_fem lg_mesh lg_mesh3 eigenvalue
 load: iovtk
 sizestack + 1024 =3856 ( 2832 )

I am here 1!!!
I am here 2!!!
Abscisse: s0 = 0.399285 <==> s1 0.315121
  current line = 78
Exec error : periodic: Sorry one vertex of edge is losted
   -- number :1
Exec error : periodic: Sorry one vertex of edge is losted
   -- number :1
 err code 8 , mpirank 0

```

Any idea regarding what I am doing wrong? I have also checked the “c” function I am using as an input for adaptmesh and did not see any weird behaviour.

My FreeFEM version is v4.6 (Tue 16 Jun 2020 06:53:31 AM CEST - git v4.6-113-g243cbb52).

Best wishes,  
Ugis

---

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [November 18, 2021, 1:31pm UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/2 "2021-11-18T13:31:28Z")

</div>

Small update. I upgraded to the current development version of FreeFEM:  
– FreeFem++ v4.1 (Thu 18 Nov 2021 01:19:08 PM CET - git v4.10-1-g5525c9c1)

Nevertheless, I get the same outcome on the example I have posted.

Any input would be appreciated.

Best,  
Ugis

---

<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: [November 19, 2021, 9:06am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/3 "2021-11-19T09:06:56Z")

</div>

Generally the problem is due buildmesh without option of fixedborder=1 to for no soothing of boundary mesh.  
So add fixedborder=1 in the list of parameter of buildmesh.

---

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [November 19, 2021, 9:46am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/4 "2021-11-19T09:46:51Z")

</div>

Hi Frederic,

Thanks a lot for the suggestion. But if you check the file “surface\_msh.idp” of my example, I have already added “fixeborder=true” to buildmesh. I also tried to change it to “fixeborder=1”, but there was no improvement.

Perhaps you have some other idea?

Best,  
Ugis

---

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [November 22, 2021, 10:39am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/5 "2021-11-22T10:39:53Z")

</div>

I just noticed that for some reason clicking on my example link does not work. If you would like to try it, please copy the link:  
[http://www.mech.kth.se/~ugis/2021.11.18\_lostEdge.zip](http://www.mech.kth.se/~ugis/2021.11.18_lostEdge.zip)  
into a new window/tab of your web browser.

Is there anyone who is more familiar with the inner workings of adaptmesh and interpolation procedure to help me find out what is the cause for the error?

Best wishes,  
Ugis

---

<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: [November 22, 2021, 4:08pm UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/6 "2021-11-22T16:08:12Z")

</div>

You find a true bug,

I will try to correct soon as possible  
Thank for freefem++

---

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [November 22, 2021, 4:12pm UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/7 "2021-11-22T16:12:07Z")

</div>

Great, thanks a lot for the help!

Best,  
Ugis

---

<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: [November 26, 2021, 9:34pm UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/8 "2021-11-26T21:34:38Z")

</div>

I am sorry, it is a hard bug, it takes times.

---

<div class="post-metadata">

### Author: ![UgisL](https://avatars.discourse-cdn.com/v4/letter/u/c0e974/32.png) [@UgisL](https://community.freefem.org/u/UgisL)
#### Post date: [December 1, 2021, 6:37am UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/9 "2021-12-01T06:37:16Z")

</div>

Of course, I understand.

---

<div class="post-metadata">

### Author: ![zzh](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@zzh](https://community.freefem.org/u/zzh)
#### Post date: [March 9, 2024, 7:05pm UTC](https://community.freefem.org/t/problem-with-adaptmesh-and-periodic-boundary-condition/1337/10 "2024-03-09T19:05:11Z")

</div>

Hi, I met the same problem with the interface between adaptmesh and periodic boundary conditions. Have you solved this problem? Professor Frederic says that its a bug of FreeFEM, does it fixed now? Thank you very much
