fem icon indicating copy to clipboard operation
fem copied to clipboard

Generate XDMF to allow ParaView to read HDF5 file (instead of having to generate separate PVD/VTR files)

Open mlp6 opened this issue 3 years ago • 0 comments

The XML schema

The XML schema produced by the program indicates that data should be read from the xdmf2d.h5 file. The mesh is 2DSmesh indicating that the mesh is 2D and structured. The mesh coordinates use the X_Y syntax, which indicates that each coordinate field is stored in a different HDF5 array. The Attribute tags in the XML specify both of the fields that are defined on the mesh. Note that the order of the coordinates when using HDF5 and the XML file is: Z, Y, X (with Z being optional).

Another important point is that you should take care to specify the number of nodes for most dimensions of the mesh. The number of cells only seems important for specifying the dimensions of cell-centered variables. The (NX+1) in the above source code example program means the number of nodes in X since NX is the number of cells in X. Thus (NX+1) is used to write any node-sized value (with respect to X) to the XML file.

<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="2.0">
 <Domain>
   <Grid Name="mesh1" GridType="Uniform">
     <Topology TopologyType="2DSMesh" NumberOfElements="21 31"/>
     <Geometry GeometryType="X_Y">
       <DataItem Dimensions="21 31" NumberType="Float" Precision="4" Format="HDF">
        xdmf2d.h5:/X
       </DataItem>
       <DataItem Dimensions="21 31" NumberType="Float" Precision="4" Format="HDF">
        xdmf2d.h5:/Y
       </DataItem>
     </Geometry>
     <Attribute Name="Pressure" AttributeType="Scalar" Center="Cell">
       <DataItem Dimensions="20 30" NumberType="Float" Precision="4" Format="HDF">
        xdmf2d.h5:/Pressure
       </DataItem>
     </Attribute>
     <Attribute Name="VelocityX" AttributeType="Scalar" Center="Node">
       <DataItem Dimensions="21 31" NumberType="Float" Precision="4" Format="HDF">
        xdmf2d.h5:/VelocityX
       </DataItem>
     </Attribute>
   </Grid>
 </Domain>
</Xdmf>

Source: http://visitusers.org/index.php?title=Using_XDMF_to_read_HDF5

mlp6 avatar Oct 01 '20 16:10 mlp6