28. File formats¶
This chapter describes the format of various input and output files used by ComFLOW. Most of the binary files used by ComFLOW are based on the HDF5 file format, but also other (in-house) formats are being used.
28.1. Restart files and legacy snapshot files¶
Almost all pre-processing and post-processing files produced by ComFLOW have the same file format. The output produced by the different programs in the package can be visualized using the ComFLOW post-processor GUI in MATLAB.
The (raw) data in the output files can also be accessed directly by using the MATLAB scripts that are provided in the ComFLOW package. For example, the following MATLAB code can be used to load water height information from a ComFLOW snapshot and present a 2-D plot:
s = CMFSnapshot;
s.loadFile( fullfile('data','cmf3d0001.dat') );
whstruct = s.waterHeight();
% NB: switched X and Y to account for storage ordering in MATLAB
[Y,X] = meshgrid(whstruct.yc,whstruct.xc);
figure;
pcolor(X,Y,whstruct.wh);
More information can be found in the post-processing manual of ComFLOW.
28.2. HDF5 field data¶
The contents of the HDF5 file is formatted as follows.
The root contains sub-folders /boundaryData
(or /boundaryData01
, /boundaryData02
, …) and fieldData
which each contain box
data stored in the same format as described in Table 28.1. The different names are used for historical reasons only.
Variable | Description |
---|---|
x , y , z |
Coordinate vectors x(1:imax) , y(1:jmax) , z(1:kmax) for the cell centers. |
x_stg , y_stg , z_stg |
Coordinate vectors x(0:imax) , y(0:jmax) , z(0:kmax) for the cell corners. |
bounding_box |
Bounding box based on the cell centers:
[ min(x), max(x), min(y), max(y), min(z), max(z) ] |
bounding_box_stg |
Bounding box based on the lower and upper cell corners:
[ min(x_stg), max(x_stg), min(y_stg), max(y_stg), min(z_stg), max(z_stg) ] |
t |
Time instances t(1:nmax) . |
fb , fs , p , u , v , w |
Grid variables stored in matrices with dimensions Note that the matrix dimensions are ordered as (outer=) |
plane_normal |
a 3-D normal vector (not used) |
The MATLAB post-processor is already able to read special box files, so this may give additional insight (see the file postpr/@CMFSnapshot/loadSnapshot_specialbox.m
in the ComFLOW distribution).
Similarly, it is possible to have a look at the C++ source of the plug-in hdf5reader
(see the file src_public/plugins/dynamic_library/dll_hdf5reader.cxx
).
28.3. Monitor surfaces¶
The output of monitor surface is stored in an in-house binary file format.
Still to come…
28.4. VTK snapshot files (*.vtu)¶
Still to come…
28.5. HDF5 matrix files (*.csr)¶
HDF5 matrix files may be used to store (sparse) matrices right hand sides as well as additional information related to the linear system and the computational grid.
Still to come…