This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

What about hexahedron elements?

+1 vote

Hi,

I wrote a Fenics mesh XML import/export function for FreeCAD shortly ago and therefore digged through the source code of dolfin to get an idea how to interpret the XML files. My question is: In the dolfin/mesh/CellType.cpp file there are switch-case statements checking whether mesh type is 'hexahedron'. But somehow this function is not implemented in the MeshEditor class in dolfin/mesh/MeshEditor.cpp. (At least it is not implemented in the switch-case statement.) Therefore Fenics cannot read hexahedral meshes which I exported from FreeCAD, although the celltype is known in the CellType class. Is it planned to implement these in the MeshEditor class in the near future? Or are these hexahedral elements only empty placeholders for the very far future? Is it sufficient to just add an additonal case 'hexahedron' in the MeshEditor.cpp file?

Best wishes
Johannes

asked Mar 3, 2017 by joha2 FEniCS Novice (160 points)

1 Answer

0 votes
 
Best answer

Quadrilaterals and hexahedra are not supported at present. There is a suggestion in Google Summer of Code for a student project to implement this.

https://github.com/numfocus/gsoc/blob/master/2017/ideas-list-fenics.md

answered Mar 5, 2017 by chris_richardson FEniCS Expert (31,740 points)
selected Mar 5, 2017 by joha2

First of all thanks for the fast answer! I read your proposal of GSOC and it seems to me that there is a lot of work to be done to get quad/hex elements working in Fenics. Although those elements are not yet supported, is there anything special we should know about import/export them in a mesh XML file?

Best wishes
Johannes

I would try to use xdmf format rather than dolfin XML. XDMF is more flexible, can use ASCII or hdf5 storage, and can be visualised with paraview...

Ah thanks for the hint! I already read a few lines about it, since it is also mentioned at your GSOC proposal. But is it supported by Fenics at the moment? It was never mentioned in the tutorials. From the FreeCAD point of view we would like to simplify the mesh generation for Fenics. Until now I thought, the dolfin XML format is state of the art. It would be a pity if we would implement support for an outdated file transfer format. Anyway is there any documentation on XDMF in Fenics?

Edit: I'm interested in support from the Fenics community regarding the communication with FreeCAD (import/export mesh data/mesh functions in the first place). Where could I ask for testing of certain features? Is this Q&A forum the correct place or one of the mailing lists?

Best wishes
Johannes

XDMF has a description at http://xdmf.org - it has been supported in dolfin for a few years now, but only recently as ASCII only. We will probably deprecate the dolfin XML format at some point.

Another project which may be of interest is meshio. https://github.com/nschloe/meshio

We can discuss on here, or join the fenics slack: see under

https://fenicsproject.org/community/

Thanks for the immediate answer!
I searched through the dolfin source and found a section about the XDMF file format, but somehow it is not listed in the valid extensions in File.cpp. Do I have to manually call the XDMF writeout for a specific mesh?

Thanks for the meshio github repo. I will check it for some useful hints about the dolfin import/export.

First I'd like to discuss here. Should I open a new question for request of testing fenics mesh import/export from/to FreeCAD?

Best wishes
Johannes

Syntax is something like:

xdmf = XDMFFile(mpi_comm_world(), "a.xdmf")
xdmf.write(mesh)

It does not use the File interface, because there are potentially more options and possibilities than can be expressed through a flat interface.

Probably better to discuss on slack or bitbucket than here - this is really a support forum for questions and answers.

OK, thanks for your support! I will register at your development slack channel and we could continue our discussion there :-)

See you,
Johannes

...