Plotting & Data Output

There are the following file formats in Fosite:

  • VTK (recommended to use with ParaView)
  • Binary (recommended to be used with provided read.py file)
  • XDMF (recommended to use with VisIt)

XDMF and VTK

The xdmf file format carries light data in a xml file and can store heavy data in binary or hdf5 files. This implementation stores the heavy data in binary files (see the fileio_binary module). These are exactly the same files, like putting out only the Binary. XDMF file I/O needs Fortran Stream IO (F2003 standard).

Some convenient programs to display the output data are ParaView (for VTK) or VisIt (for XDMF).

Python

It is also possible to read in the binary data directly in Python. This is very convenient for persons with own manipulation scripts. For this we provide the file "read.py" in the subdirectory "tools/plot/". The script should be added to the folder where the plotting routines lie or added to the pythonpath.

Below is a minimum example to make a 1D plot:

from read import read
import matplotlib.pyplot as plt
f = read('dataname.bin')
density = f['/timedisc/density']
x = f['/mesh/bary_centers'][:,:,:,0]
plt.plot(x, density)
plt.show()

To access the right data, the according keys need to be known. A full list of available keys can be printed out (for the above example) with

print(f.keys())

Which keys and thus which output is available needs to set in the initialization file.

The module should run with both Python 2 and Python 3. You are of course also free to use Python wrappers for XDMF or VTK if you are familiar with this.

Binary Output Format

General Specification

[header],[data],[data],[data],..

Header

The header includes all necessary information in 13 bytes of ASCII signs.

magic endian version real size integer size total siz
bytes 6 2 1 2 2 =13

These are all ASCII characters except the version, which is single byte unsigned integer.

Data

key length key type data length data
bytes 4 * 4 * *

The key has the in key length specified size. It then contains, e.g., /timedisc/density (17 bytes). type indicates the type of the following data (e.g. 4D array) and data length includes then 16 bytes extra for dimensional information (4 bytes per dimension). The existing types are defined in the common_dict module.