# How to build a structured mesh?

**URL:** <https://community.freefem.org/t/how-to-build-a-structured-mesh/2175>\
**Category:** General Discussion\
**Created:** [December 8, 2022, 2:48pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175 "2022-12-08T14:48:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@Christian](https://community.freefem.org/u/Christian)\
**Post date:** [December 8, 2022, 2:48pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175/1 "2022-12-08T14:48:01Z")

</div>

Hi everyone!  
Can you suggest to me a way for having a structured mesh for my geometry?  
The system’s geometry is a honeycomb-like shape.  
Initilly i tried with just one hexagon: I have made a first mesh with the command “buildmesh” with just one element for border and I have obtained a good structured mesh (as you can see, there are 6 triangles inside one singular hexagon) then, in order the increase the number of elements while still hold this kind of structure, I have used the comand “trunc”.  
Unfortunally, if I try to use the same procedure for a more-complex geometry, the first mesh generation (the one that should have only 6 triangles elements inside a singular hexagon) have this weird behaviour (see linked immagine). Some hexagones have a wrong element distribution, with a bigger center triangle.

 ![Screenshot_20221208_154454](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/5/537d9361303a51ad5cfb9c9f9f3229e7b015999c.png)

 ![Screenshot_20221208_154632](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/0/0f1f4fed02d0aee49065db1ff169fd600502080c.png)

Can you help me, please?  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [December 8, 2022, 3:46pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175/2 "2022-12-08T15:46:12Z")

</div>

I recognize that this doesn’t answer your question, but why is it that you want a structured mesh?

In an effort to provide a more constructive answer, might I suggest you try using the `adaptmesh` function to control the tolerated aspect ratios / vertex angles…

---

<div class="post-metadata">

**Author:** ![Christian](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@Christian](https://community.freefem.org/u/Christian)\
**Post date:** [December 8, 2022, 6:07pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175/3 "2022-12-08T18:07:40Z")

</div>

In few words, i should reproduce a result generated by another softwar that use this kind of structured mesh.

Thank you for your answer! I arleady have tried to modify “manually” the mesh parameters, unfortunally this is the best result reached.

 ![Screenshot_20221208_185806](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/7/799b0eaacfbe8bbc88b54cdd60b490fc32d6d61a.png)

Even if hmin is fixed, some elements has smaller lenght sides, same problem even when “thetamax” is defined!

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [December 8, 2022, 6:24pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175/4 "2022-12-08T18:24:57Z")

</div>

But shouldn’t your results be mesh-independent?

I generally use GMSH to generate meshes and import them into FreeFEM. GMSH may offer more precise control of angles/aspect ratios

---

<div class="post-metadata">

**Author:** ![Christian](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@Christian](https://community.freefem.org/u/Christian)\
**Post date:** [December 8, 2022, 7:03pm UTC](https://community.freefem.org/t/how-to-build-a-structured-mesh/2175/5 "2022-12-08T19:03:55Z")

</div>

Yes it should be grid-idependet, that’s why once the coarse mesh is created correctly, I would increase the elements number by usign “trunc” comand!

Thank you for your Answer! I will try GMSH!
