(quadrilateral) mesh export & (re)import

Hi everyone,

I’m a FEniCS beginner and I am really looking forward to using it for my research.

Since I’d like to use my own (hex and quad) meshes from abaqus later, I’d first like to generate example meshes using quadrilaterals to understand the xml syntax, that I’d have to use when converting my abaqus mesh to fenics/dolfin.

However, I am not able to export quadrilateral xml mesh files.
I have found a tutorial [1], where a simple quad mesh is created.

Since the tutorial is based on FEniCS version 2018.1.0, I had to adapt it for my installed version 2017.2.0
from

from dolfin import *
mesh = UnitSquareMesh.create(1, 1, CellType.Type.quadrilateral)
File(‘mesh.xml’) << mesh

to

from dolfin import *
mesh = UnitSquareMesh.create(1, 1, CellType.Type_quadrilateral)
File(‘mesh.xml’) << mesh

Generation of the “mesh” object then works perfectly fine, but when trying to export, it prompts an error message like the following:

*** Error: Unable to write mesh to XML file.
*** Reason: Unknown cell type (3).
*** Where: This error was encountered inside XMLMesh.cpp.
*** Process: 0


*** DOLFIN version: 2017.2.0
*** Git changeset: unknown

Am I missing something?
Thanks for any help!

[1] https://fenicsproject.org/docs/dolfin/2018.1.0/python/demos/cahn-hilliard/demo_cahn-hilliard.py.html

I would also be interested in this.

For quadrilateral meshes, you should use DOLFINx, as the support for quads and hexes has been vastly improved.
As an introduction, I would suggest you have a look at my tutorial on the subject:The FEniCSx tutorial — FEniCSx tutorial