# Higher-Order elements with curved elements and GMSH support

**URL:** <https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772>\
**Category:** General\
**Created:** [May 23, 2024, 10:10am UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772 "2024-05-23T10:10:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chennachaos](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/chennachaos/32/7007_2.png) [@chennachaos](https://fenicsproject.discourse.group/u/chennachaos)\
**Post date:** [May 23, 2024, 10:10am UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/1 "2024-05-23T10:10:59Z")

</div>

Hello,  
I am interested in using FEniCS for my research, particularly in developing the framework FSI problems, by porting the existing [FreeFEM code](https://github.com/chennachaos/FSIwithFreeFEM).

I would like to know

1. If there is straightforward support for reading GMSH meshes along with their tags instead of the hassle of XDMF files.
2. If FEniCS supports higher-order elements with curved elements for meshes generated with GMSH.
3. Other mesh generation tools that I can use for generating meshes with higher-order elements.

Thanks in advance for your time and assistance!

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [May 23, 2024, 10:21am UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/2 "2024-05-23T10:21:29Z")

</div>

For dolfinx: see for instance [dolfinx/python/demo/demo\_gmsh.py at v0.8.0 · FEniCS/dolfinx · GitHub](https://github.com/FEniCS/dolfinx/blob/v0.8.0/python/demo/demo_gmsh.py) to verify that the answer to 1 and 2 is yes for dolfinx. Further lower level details are shown in [dolfinx/python/test/unit/mesh/test\_higher\_order\_mesh.py at main · FEniCS/dolfinx · GitHub](https://github.com/FEniCS/dolfinx/blob/main/python/test/unit/mesh/test_higher_order_mesh.py)

The answer to 3 is probably yes too, except that you’ll need to write your own reader.

For dolfin: see for instance [Is it possible to program (from scratch) a 2nd-order tetrahedron in FeniCs Legacy?](https://fenicsproject.discourse.group/t/is-it-possible-to-program-from-scratch-a-2nd-order-tetrahedron-in-fenics-legacy/14554) . The short answer is that we’d suggest moving on to dolfinx anyways.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 23, 2024, 7:52pm UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/3 "2024-05-23T19:52:23Z")

</div>

An example of how to use GMSH with second order elements is shown in  
[https://jsdokken.com/dolfinx-tutorial/chapter2/ns\_code2.html](https://jsdokken.com/dolfinx-tutorial/chapter2/ns_code2.html)  
where I employ a second order mesh directly from the gmsh model in the GMSH Python API.

DOLFINx also supports reading msh files using `dolfinx.io.gmshio.read_from_msh` [dolfinx.io.gmshio — DOLFINx 0.8.0 documentation](https://docs.fenicsproject.org/dolfinx/v0.8.0/python/generated/dolfinx.io.gmshio.html#dolfinx.io.gmshio.read_from_msh)

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 23, 2024, 7:54pm UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/4 "2024-05-23T19:54:19Z")

</div>

> [@chennachaos](#):
>
> Other mesh generation tools that I can use for generating meshes with higher-order elements.

I am planning to write a general mesh IO framework for DOLFINx at [GitHub - jorgensd/mesh\_converter: A mesh converter from EXODUS 2 to XDMF](https://github.com/jorgensd/mesh_converter/) which currently adds exodus2 support to XDMF files. However, I am not going to implement any format under the sun, and I would need to get good examples of mesh formats that are usable to continue this development.

It is rather straightforward to read in meshes in DOLFINx from raw data arrays, as for instance shown in  
[http://jsdokken.com/FEniCS23-tutorial/src/mesh\_generation.html#higher-order-meshes](http://jsdokken.com/FEniCS23-tutorial/src/mesh_generation.html#higher-order-meshes)

---

<div class="post-metadata">

**Author:** ![chennachaos](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/chennachaos/32/7007_2.png) [@chennachaos](https://fenicsproject.discourse.group/u/chennachaos)\
**Post date:** [May 29, 2024, 1:37pm UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/5 "2024-05-29T13:37:44Z")

</div>

Thank you very much! I will check the suggested links.

---

<div class="post-metadata">

**Author:** ![chennachaos](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/chennachaos/32/7007_2.png) [@chennachaos](https://fenicsproject.discourse.group/u/chennachaos)\
**Post date:** [May 29, 2024, 2:53pm UTC](https://fenicsproject.discourse.group/t/higher-order-elements-with-curved-elements-and-gmsh-support/14772/6 "2024-05-29T14:53:01Z")

</div>

Thank you very much! I will go through your suggestions.
