-
Notifications
You must be signed in to change notification settings - Fork 1
Importing Data to ParaView
ParaView can read XDMF files which provide a specification of how to read data from your HDF5 files.
Suppose you have some data, e.g. density field, defined on a uniform grid from your simulation, and they are stored in a HDF5 file, you can create a XDMF file which contains the information of the dataset. The XDMF file can then be used by ParaView to load the data. An example of the XDMF file can be found below
<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="2.0">
<Domain>
<Grid Name="Simulation" GridType="Uniform">
<Topology TopologyType="3DCoRectMesh" Dimensions="256 256 256"/>
<Geometry GeometryType="ORIGIN_DXDYDZ">
<DataItem Name="Origin" DataType="Float" Dimensions="3" Format="XML">0.0 0.0 0.0</DataItem>
<DataItem Name="Spacing" DataType="Float" Dimensions="3" Format="XML">1.0 1.0 1.0</DataItem>
</Geometry>
<Attribute Name="density" AttributeType="Scalar" Center="Node">
<DataItem Dimensions="256 256 256" NumberType="Float" Precision="8" Format="HDF">simulation_data.h5:density</DataItem>
</Attribute>
</Grid>
</Domain>
</Xdmf>
First, we need to define the Topology and Geometry of the box. In the example above, we have a box with the origin at (0,0,0) and a grid spacing of (1,1,1). The data are defined on a uniform 256^3 grid.
Then we add the information of the data to an Attribute. We need to specify the Dimensions, NumberType, Precision and Format of the dataset. Finally, simulation_data.h5:density specifies the name of HDF5 file and the name of the dataset in the file.
Now your data are ready to use in ParaView. Just put the XDMF file and the HDF5 in the same folder.