# Finite volume and anisotropic mesh

**URL:** <https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309>\
**Category:** General Discussion\
**Created:** [June 12, 2024, 8:22am UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309 "2024-06-12T08:22:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.freefem.org/u/Ali)\
**Post date:** [June 12, 2024, 8:22am UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/1 "2024-06-12T08:22:36Z")

</div>

Hello,

My question is : Is it possible to solve Euler’s equation using the Finite Volume Method with an anisotropic mesh in FreeFem++?

Thank you in advance for your answer.

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [June 13, 2024, 6:32pm UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/2 "2024-06-13T18:32:11Z")

</div>

Hello,  
I think you mean an explicit finite volume method. It is possible but you need to code it from scratch, using the vertex and triangle indices, and either P0, P1 data or even simply arrays for the unknowns. Thus it will use only the mesh structure and basic programmation tools.

---

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.freefem.org/u/Ali)\
**Post date:** [June 14, 2024, 7:49am UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/3 "2024-06-14T07:49:34Z")

</div>

Hello,

Thank you for your answer. Exactly, I mean an explicit finite volume method. For finite elements, it’s ok, but for the FV method, I don’t know. Do you have a simple example code combining the FV method and an anisotropic mesh to start with?

Thank you in advance for your answer.

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [June 15, 2024, 2:36pm UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/4 "2024-06-15T14:36:37Z")

</div>

Here is an example  
[https://perso.math.u-pem.fr/bouchut.francois/fv-scalar-cl.edp](https://perso.math.u-pem.fr/bouchut.francois/fv-scalar-cl.edp)  
It solves a scalar conservation law, at first order in space. Control volumes are the triangles of the mesh.

---

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.freefem.org/u/Ali)\
**Post date:** [June 17, 2024, 5:35am UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/5 "2024-06-17T05:35:26Z")

</div>

Hello,

Thank you very much !

---

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.freefem.org/u/Ali)\
**Post date:** [July 2, 2024, 2:04pm UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/6 "2024-07-02T14:04:11Z")

</div>

Hello,

I am trying to analyze your code to understand it, but I don’t understand which anisotropic mesh adaptation method you used. Thank you in advance for your answer.

Best Regards,  
Ali ALI AHMAD

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [July 2, 2024, 2:40pm UTC](https://community.freefem.org/t/finite-volume-and-anisotropic-mesh/3309/7 "2024-07-02T14:40:02Z")

</div>

There is no mesh adaptation in this code. If you want to perform mesh adaptation, you can try to refine locally using the command trunc,  
see the documentation p.131

> **[FreeFEM-documentation.pdf](https://doc.freefem.org/pdf/FreeFEM-documentation.pdf)**
>
> 33.81 MB

But then it is not much friendly to manage with the indices of triangles and edges.
