[Paraview] Data formats and XDMF

Chris Richardson chris at bpi.cam.ac.uk
Thu May 14 05:29:38 EDT 2015


On 14/05/2015 02:08, Lucas Clemente Vella wrote:
> Hi,
> 
> I need to write the output of a CFD code, attributes are cell centered
> and my mesh looks like the picture attached: orthogonal edges, cells
> are rectangular, but unstructured (leafs of a tree, not necessarily
> octree).
> 
> I know how to work with HDF5, thus I prefer to write it in XDMF +
> HDF5, but I could settle with any format that provides compression,
> and I am able to write the tree once, and reuse it with different
> attribute fields per time step (I know how to do it both from XDMF and
> directly from HDF5).
> 
> So, is XDMF recommended, or should I use something else?
> 
> Also, in the picture, the bigger cell, can it be written as a
> hexahedron, ignoring that one face actually interfaces with 4 other
> cells, or should I describe it as a 9 face polyhedron, where there are
> 4 coplanar faces? The former is much easier, is there any difference
> from visualization standpoint? Is it more "correct" to use a 9 face
> polyhedron?
> 
> I have an idea on how to make a XDMF using only hexahedron, but not a
> clue with polyhedra of variable number of faces. Could you please
> assemble a sample XDMF depicting that mesh for me to use as base?
> 

I think if you are using cell-centered data, it will be OK to use 
hexahedra.
If you had vertex-centered data, then the approach you describe above
might make sense, as the values could be interpolated from the hanging 
node.

You may notice some artefacts in the rendering, though, due to "internal 
surfaces"
between the non-conforming cells. But only if you turn 'opacity' on, for 
example.

Here is a simple (XML) example to see what I mean (e.g. try in paraview 
with opacity=0.5)

<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="2.0" xmlns:xi="http://www.w3.org/2001/XInclude">
   <Domain>
     <Grid Name="grid_1" GridType="Uniform">
       <Topology NumberOfElements="3" TopologyType="Hexahedron">
         <DataItem Format="XML" Dimensions="3 8">
           0 1 2 3 4 5 6 7
           4 8 9 10 11 12 13 14
           7 15 17 16 8 12 13 9
         </DataItem>
       </Topology>
       <Geometry GeometryType="XYZ">
         <DataItem Format="XML" Dimensions="18 3">
           0.0 0.0 0.0
           0.0 0.0 1.0
           0.0 1.0 1.0
           0.0 1.0 0.0
           1.0 0.0 0.0
           1.0 0.0 1.0
           1.0 1.0 1.0
           1.0 1.0 0.0
           1.0 0.5 0.0
           1.0 0.5 0.5
           1.0 0.0 0.5
           1.5 0.0 0.0
           1.5 0.5 0.0
           1.5 0.5 0.5
           1.5 0.0 0.5
           1.5 1.0 0.0
           1.0 1.0 0.5
           1.5 1.0 0.5
         </DataItem>
       </Geometry>
       <Attribute Name="field" AttributeType="Scalar" Center="Cell">
         <DataItem Format="XML" Dimensions="3 1">
           1
           2
           3
         </DataItem>
       </Attribute>
     </Grid>
   </Domain>
</Xdmf>


XDMF/HDF5 works really well (especially in parallel).


-- 
Chris Richardson
BP Institute
Madingley Road
Cambridge CB3 0EZ


More information about the ParaView mailing list