# Too many vertices when I apply the adaptmesh comand

**URL:** https://community.freefem.org/t/too-many-vertices-when-i-apply-the-adaptmesh-comand/2030
**Category:** General Discussion
**Created:** [September 28, 2022, 12:51pm UTC](https://community.freefem.org/t/too-many-vertices-when-i-apply-the-adaptmesh-comand/2030 "2022-09-28T12:51:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jacoban90](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jacoban90](https://community.freefem.org/u/Jacoban90)
#### Post date: [September 28, 2022, 12:51pm UTC](https://community.freefem.org/t/too-many-vertices-when-i-apply-the-adaptmesh-comand/2030/1 "2022-09-28T12:51:38Z")

</div>

Hello Freefem Users,

I’ve been trying to simulate iteratively a deformation of a rectangular geometry and readapting the mesh in order to avoid execution errors. However, I after a few iteration I still obtain an error message when I apply the adaptmesh:

Too many vertices on geometry 9825 \>= 9000  
Fatal error in the mesh generator 3  
current line = 202  
Meshing error: Bamg  
number : 3,  
Meshing error: Bamg  
number : 3,  
err code 5 , mpirank 0

Is there a way to solve this problem? I applied the refinement in those regions with better convergence

Ps: The mesh is initially refined at the corners in order to help the program to a better convergence.

Attached you have the .edp file and the .mesh file.

[Test-2.edp](https://community.freefem.org/uploads/short-url/dpjmiNzC09vYpEteWNf9Lt9edht.edp) (5.1 KB)  
[Deformation.mesh](https://community.freefem.org/uploads/short-url/yvEwKkbXmMlC85yr2CZBG90Kevd.mesh) (712.9 KB)

Best Regards  
Jacob

---

<div class="post-metadata">

### Author: ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)
#### Post date: [September 28, 2022, 8:17pm UTC](https://community.freefem.org/t/too-many-vertices-when-i-apply-the-adaptmesh-comand/2030/2 "2022-09-28T20:17:46Z")

</div>

I think you should increase the maximum number of vertices when calling `adaptmesh`:

```auto
solid=adaptmesh(solid,dispx,dispy, hmin=h[].max*a, hmax=h[].max*b,nbvx=20000);

```

Please check out the parameters of `adaptmesh` in the documentation for further info.

---

<div class="post-metadata">

### Author: ![emmawilson](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/emmawilson/32/2346_2.png) [@emmawilson](https://community.freefem.org/u/emmawilson)
#### Post date: [May 14, 2024, 12:23pm UTC](https://community.freefem.org/t/too-many-vertices-when-i-apply-the-adaptmesh-comand/2030/3 "2024-05-14T12:23:35Z")

</div>

I also faced the same issue. Thanks for guidance.
