# Adapmesh and heat equation

**URL:** <https://community.freefem.org/t/adapmesh-and-heat-equation/371>\
**Category:** General Discussion\
**Created:** [April 27, 2020, 10:21pm UTC](https://community.freefem.org/t/adapmesh-and-heat-equation/371 "2020-04-27T22:21:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [April 27, 2020, 10:21pm UTC](https://community.freefem.org/t/adapmesh-and-heat-equation/371/1 "2020-04-27T22:21:37Z")

</div>

Hello,

I tried mesh adaptation procedure with a very simple heat equation and it seems something wrong with my basic heat problem. The geometry is a two layered wall junction and two Robin boundary conditions are prescribed as follow dn(T)=hs(T-Ts)

The heat simulation, before adaptation, is ok, but a simple mesh adapatation make the temperature field very strange.

Is there something wrong ?  
Best regards.

PS : I can’t upload files (i’m a new user) but my msh and edp files can be found [here](https://drive.google.com/drive/folders/1XMSGBibPb0GBqnWQEhlTslc2yQ9eEPnc?usp=sharing)

---

<div class="post-metadata">

**Author:** ![simon.garnotel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/simon.garnotel/32/11_2.png) [@simon.garnotel](https://community.freefem.org/u/simon.garnotel)\
**Post date:** [April 28, 2020, 12:18pm UTC](https://community.freefem.org/t/adapmesh-and-heat-equation/371/2 "2020-04-28T12:18:03Z")

</div>

Hello,

You have to interpolate your unknown function after the mesh adaptation. In your script, you have to add `u = u;` on line 43, before the second resolution of your problem.

---

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [May 1, 2020, 6:21pm UTC](https://community.freefem.org/t/adapmesh-and-heat-equation/371/3 "2020-05-01T18:21:38Z")

</div>

I get this following message error while using adaptmesh with iso=true

> Blockquote  
> Loop in forcing Egde AB  
> vertex A ([937742596,118936430],[8.3174,-12.5915]{0.014155,0.014155,[1,0]})  
> vertex B ([937742595,119852252],[8.3174,-12.5772]{0.0148936,0.0148936,[1,0]})  
> nb de swap 85132  
> nb of try swap too big = 10000002 greater than 1000000  
> vertex number 478134456 478134457  
> Fatal error in the mesh generator 990  
> current line = 68  
> Meshing error: Bamg  
> number : 990,  
> Meshing error: Bamg  
> number : 990,  
> err code 5 , mpirank 0

but the mesh file is ok.  
using iso=false lead to a quite long computation and a very bad mesh.

I tried to use mmgmet and mmg but it seems that both alternive can’t refine the mesh ?

Best regards.
