Naturally, HDF5 is only a bunch of numbers in some order and it does not contain anything that required to have geometric meanings. XDMF is a very useful tool combining with HDF5 to provide powerful visualization results. Here is my script for XDMF (a xmf file) together to show a h5 file with Visit. The only tricky thing in writing the xmf, is GRID.
For my 3D h5 file, although the grid is CORECT(contant rectangular), the script I use so far the mesh I use is curvilinear mesh, which is the stupidest(yet the most comprehensive grid) that need a whole 3D scalar field for each directions. However, this is the most powerful one for structured grid. ## The XMF file is down below <?xml version="1.0" ?> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []> <Xdmf Version="2.0"> <Domain> <Grid Name="mesh1" GridType="Uniform"> <Topology TopologyType="3DSMesh" NumberOfElements="512 512 512"/> <Geometry GeometryType="X_Y_Z"> <DataItem Dimensions="512 512 512" NumberType="Float" Precision="7" Format="HDF"> grid.h5:/X </DataItem> <DataItem Dimensions="512 512 512" NumberType="Float" Precision="7" Format="HDF"> grid.h5:/Y </DataItem> <DataItem Dimensions="512 512 512" NumberType="Float" Precision="7" Format="HDF"> grid.h5:/Z </DataItem> </Geometry> <Attribute Name="pre" AttributeType="Scalar" Center="Node"> <DataItem Dimensions="512 512 512" NumberType="Float" Precision="7" Format="HDF"> outputhdf000.h5:/pre </DataItem> </Attribute> <Attribute Name="xve" AttributeType="Scalar" Center="Node"> <DataItem Dimensions="512 512 512" NumberType="Float" Precision="7" Format="HDF"> outputhdf000.h5:/xve </DataItem> </Attribute> </Grid> </Domain> </Xdmf> The corresponding HDF5 file is my default turbulent file and a grid file. Be advised the XDMF can read multiple HDF5 file. |
AuthorShaowu Pan Archives
December 2017
Categories
All
|