# Periodic mesh in a .xml file converted with dolfin-convert

**URL:** <https://fenicsproject.discourse.group/t/periodic-mesh-in-a-xml-file-converted-with-dolfin-convert/13130>\
**Category:** Legacy DOLFIN\
**Tags:** mesh, boundary-conditions\
**Created:** [December 21, 2023, 1:46pm UTC](https://fenicsproject.discourse.group/t/periodic-mesh-in-a-xml-file-converted-with-dolfin-convert/13130 "2023-12-21T13:46:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexis\_Valls](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/alexis_valls/32/5542_2.png) [@Alexis\_Valls](https://fenicsproject.discourse.group/u/Alexis_Valls)\
**Post date:** [December 21, 2023, 1:46pm UTC](https://fenicsproject.discourse.group/t/periodic-mesh-in-a-xml-file-converted-with-dolfin-convert/13130/1 "2023-12-21T13:46:04Z")

</div>

Hi everyone, I have troubles in making a 2D periodic mesh for use with fenics. I have a .geo which is computed into a .msh file using “gmsh -2 file.geo -format msh2”. I then get a .msh file which I convert in the xml format with “dolfin-convert file.msh file.xml”. The command actually returns a .xml file but the mesh seems to be different from the one contained in the .msh file (the .msh file contains 98 elements whereas the .xml only contains 68 elements, though both files have the same number of nodes). When running the python/dolfin script, the .xml is read without raising any error but the results lets me think there is no periodic boundary condiiton.

Here is the .geo file :

```auto
SetFactory("OpenCASCADE");
Mesh.CharacteristicLengthMin = 3;
Mesh.CharacteristicLengthMax = 8;
p0 = newp;
Point(p0) = {-16.0, -4.0, 0.0};
p1 = newp;
Point(p1) = {16.0, -4.0, 0};
p2 = newp;
Point(p2) = {16.0, 4.0, 0.0};
p3 = newp;
Point(p3) = {-16.0, 4.0, 0};
l0 = newl;
Line(l0) = {p0, p1};
l1 = newl;
Line(l1) = {p1, p2};
l2 = newl;
Line(l2) = {p2, p3};
l3 = newl;
Line(l3) = {p3, p0};
ll0 = newll;
Line Loop(ll0) = {l0, l1, l2, l3};
s0 = news;
Plane Surface(s0) = {ll0};
Periodic Curve { l1 } = { l3 } Translate { 32.0, 0.0, 0.0 };

```

Thanks in advance for your help

---

<div class="post-metadata">

**Author:** ![violetus](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/violetus/32/5122_2.png) [@violetus](https://fenicsproject.discourse.group/u/violetus)\
**Post date:** [December 21, 2023, 9:46pm UTC](https://fenicsproject.discourse.group/t/periodic-mesh-in-a-xml-file-converted-with-dolfin-convert/13130/2 "2023-12-21T21:46:36Z")

</div>

Have you tried msh version 2 (ASCII) ?

> [@Problem converting file.msh (from gmsh) to file.xml](https://fenicsproject.discourse.group/t/problem-converting-file-msh-from-gmsh-to-file-xml/93/12):
>
> Hi, are you exporting your mesh using msh version 2 (ASCII)? I think that dolfin-convert only works with that version of msh format. Cheers, Rodolfo

Also, please consider reading -

> [@Importing mesh from gmsh 4.7.1 to dolfin 2019.2.0.dev0](https://fenicsproject.discourse.group/t/importing-mesh-from-gmsh-4-7-1-to-dolfin-2019-2-0-dev0/5286/2):
>
> Dolfin-convert is no longer maintained, and meshio is the recommended way of converting meshes. See for instance: [Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio - #155 by dokken](https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412/155) Or [Why to update from dolfin-convert to meshio? - #4 by dokken](https://fenicsproject.discourse.group/t/why-to-update-from-dolfin-convert-to-meshio/4130/4)
