# Convert 2D msh file to xdmf with physical groups

**URL:** https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959
**Category:** mesh
**Created:** [June 4, 2021, 5:17pm UTC](https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959 "2021-06-04T17:17:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![essicolo](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/essicolo/32/2494_2.png) [@essicolo](https://fenicsproject.discourse.group/u/essicolo)
#### Post date: [June 4, 2021, 5:17pm UTC](https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959/1 "2021-06-04T17:17:09Z")

</div>

Hi,

I’ve been struggling to replicate [tutorial 5 with subdomains](https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html#defining-subdomains-for-different-materials) using gmsh. There seems to be a lot of incompatibilities between `meshio` versions, and couldn’t find a working solution for FEniCS 2019.1. How would you import [this mesh](https://gist.github.com/essicolo/0067225e65db25b3b5a86343a5981820) to FEniCS?

Thanks!

---

<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: [June 4, 2021, 5:54pm UTC](https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959/2 "2021-06-04T17:54:31Z")

</div>

See for instance; [Need help converting GMSH to FEniCS - #17 by dokken](https://fenicsproject.discourse.group/t/need-help-converting-gmsh-to-fenics/5192/17)

---

<div class="post-metadata">

### Author: ![essicolo](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/essicolo/32/2494_2.png) [@essicolo](https://fenicsproject.discourse.group/u/essicolo)
#### Post date: [June 4, 2021, 8:03pm UTC](https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959/3 "2021-06-04T20:03:42Z")

</div>

I’m not sure if I understand the procedure, but it works. From this point, is it possible to assign material values to `cf` and boundary conditions to `mf`? Thanks

---

<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: [June 4, 2021, 8:57pm UTC](https://fenicsproject.discourse.group/t/convert-2d-msh-file-to-xdmf-with-physical-groups/5959/4 "2021-06-04T20:57:26Z")

</div>

For material parameters (cf) see: [How to define different materials / importet 3D geometry (gmsh) - #2 by dokken](https://fenicsproject.discourse.group/t/how-to-define-different-materials-importet-3d-geometry-gmsh/2709/2)  
For boundary conditions, see;  
[Subdomains and boundary conditions](https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html)
