Introduction
W-data was designed to satisfy the following requirements:
- Binary data is stored in a conceptually easy format that allows a variety of tools/languages to be used.
- Format provides storage for data with time stepping (frames/measurements/cycles).
- Data format is suitable for parallel processing (preferably with MPI I/O).
- Data is easy to process via VisIt.
- It provides an extensible framework - new variables can be created and easily added to the existing dataset.
- Data is convenient for copying between computing systems.
- It allows for easy extraction/copying of selected variables.
W-data format is not a library. It is only a concept. It specifies how the data should be saved or read. It means that you do not need to use any external libraries to be able to read or write. It is sufficient to use standard I/O functions to work with this format. We provide within this repository libraries written in C or in python just for convenience. The example code demonstrating this concept can be found here c-examples /example-write-low-level.c. The concept is described below.
W-data format concept
The data set will consist of a set of files, for example:
test.wtxt # metadata file, this one should be indicated when opening in VisIt
test_density_a.wdat # binary file with data
test_delta.wdat # binary file with data
test_current_a.wdat # binary file with data
The content of test.wtxt may look like this:
# Comments with additional info about the data set
# Comments are ignored when reading by the parser
nx 24 # lattice
ny 28 # lattice
nz 32 # lattice
dx 1 # spacing
dy 1 # spacing
dz 1 # spacing
datadim 3 # dimension of block size: 1=nx, 2=nx*ny, 3=nx*ny*nz
prefix test # prefix for files belonging to this data set, binary files have names `prefix_variable-name.format`
cycles 10 # number of cycles (measurements)
t0 0 # time value for the first cycle
dt 0.1 # time interval between cycles. If `dt` negative then time step is varying and is read from binary file `prefix__t.wdata`
# variables
# tag name type unit format
var density_a real none wdat
var delta complex none wdat
var current_a vector none wdat
# links
# tag name link-to
link density_b density_a
link current_b current_a
# consts
# tag name value unit
const eF 0.5 MeV
const kF 1 1/fm
According to our experience, three types of variables (real
, complex
, vector
) are sufficient and cover more than 90% of applications. However, we have implemented single-precision (float
in C notation) types denoted as real4
, complex8
, and vector4
. To be consistent with the notation, one can use real8
, complex16
or vector8
exchangeable for real
, complex
, vector
.
Binary files store data as row arrays called datablocks
:
The size of datablock
depends on the variable type and the data dimensionality.
-
real/real8:
blocksize=blocklength*8 Bytes
-
real4:
blocksize=blocklength*4 Bytes
-
complex/complex16:
blocksize=blocklength*16 Bytes
-
complex8:
blocksize=blocklength*8 Bytes
-
vector/vector8:
blocksize=blocklength*3*8 Bytes
-
vector4:
blocksize=blocklength*3*4 Bytes
where blocklength
is
- for datadim=3:
blocklength=nx*ny*nz
- for datadim=2:
blocklength=nx*ny
- for datadim=1:
blocklength=nx
Note that for vector variables, we use the following storage pattern:
To compute time associated with a given icycle
, we use the formula
time = t0 + dt * icycle;
If dt
is negative then time
parameter has to be extracted from the additional binary file of the name prefix__t.wdat
. For more information, see the implementation of function wdata_get_time
(...) from our C library.
Let's get back to the *wtxt
file.
W-data format allows for the representation of the following elements:
-
variable:
Each variable is represented by the binary file of nameprefix_varname.format
. The variable description has the following format:
var name type unit format
The following formats are allowed:
-
wdat
: default format for WSLDA codes. Binary files contain row data (no header). -
dpca
: (deprecated) previous format of cold atomic codes. The binary file contains a header of size 68B where additional info about file content is stored. For this format, wdata lib provides only reading functionality. -
npy
: binary files are numpy arrays. Functionality under construction - link: It is an alternative name for a given variable. The entry has a form
link alternative-name var-name
Frequently, users call the same variable differently. For example, the user creates a variable
var density real none wdat
while another user, in his/her code, uses the name rho
for the same variable. To maintain the operativity of the code that uses the variable rho
, the second user can add an entry to *wtxt
file as a form
link rho density
-
constant:
Typically, besides variables, we have some useful constants during the data analysis process. To provide values of selected constants, we useconst
field. For example:
const eF 0.5
See here for a complete list of tags.