Dealing with mesh with multiple kind of elements

Hello,

I have to deal with meshes using multiple elements

Segments ( 2 nodes elements)
Triangles ( 3 nodes)
Quad ( 4 nodes )
Tetra (4 nodes)
Pyramid (5 nodes)
Prism (6 nodes)
Hex (8 nodes)

I have managed to write an export function in another software to export the geometry of this mesh.

The fact is that I had properties which are ONLY on the volumetric elements (Hex, tetra, prisms, pyramids). Let’s say for example a Young modulus.

I would like to know if it is possible, in my .vtu file, to specify that ? In other words, I do not want to have to write some useless values for these properties on the segments, quad and triangles.

Is there a way to do this in the vtu format ?

Thanks !

I would like to know if it is possible, in my .vtu file, to specify that ? In other words, I do not want to have to write some useless values for these properties on the segments, quad and triangles.

It is not possible to write values only for certain types of cells. Unstructured grids in VTK require a one-to-one value between cells and elements in a cell data array. The closest thing we support to not writing a data value for certain cells is writing a NaN for a cell type that has no value.

Another approach would involved breaking up your mesh into a vtkMultiBlockData set where one block has only cell types with common properties and another block has cells without that property. The block with the property can provide an array containing those values, but the other block would have no such array.

Hi Cory,

Thank you for your answer !

Yes, writing a vtm instead of a vtu is a great idea. I have managed to do what I want, thanks !

But the problem is for the Parallel version. I think a “.pvtm” format does nos exist. Also, a pvtu can’t refer to vtm files, but only vtu files. Have you got an idea for this ?

Thanks,

.pvtm is not needed. .vtm file are automatically distributed when opened in parallel.

Hi Mathieu,

Indeed !

Thank you all for the information, I will find a way to reach my goal which is

  • Start from a mesh with surfaces and volumes elements. With properties on volumes, and properties on surface
  • Partition this mesh using METIS (for instance)
  • Save this mesh in a parallel format, keeping the properties on the volumes and the surfaces
  • Read this format with a MPI simulator

Thank you !

1 Like