|
Neko 1.99.11
A portable framework for high-order spectral element flow simulations
|
This appendix documents the Nek5000 file format as written and read by Neko in src/io/fld_file.f90. We refer to this format as .fld for brevity. Neko writes .fld files using MPI-IO, and the layout on disk follows the code paths in that module.
Neko writes a file series in Nek5000 style:
The .nek5000 file contains the file template and time range for the series and is used by Neko when reading a series.
Each .fld data file is binary and consists of:
The presence and ordering of the field blocks is described by rdcode in the header.
The header is a 132-character record written with the format:
In code, this is:
Fields:
rdcode is a compact descriptor of which fields are present and in which order:
The writer appends S followed by two digits for the scalar count. The reader parses these digits to determine the number of scalar fields.
Immediately after the header, the writer stores a single-precision real with value 6.54321. The reader validates this value to guard against format or endianness mismatches.
After the test pattern, the file contains glb_nelv integers storing the global element ids. Each MPI rank reads/writes its own slice based on offset_el.
Field data is written in the order indicated by rdcode. Within each block, Neko writes data in element-major order:
For vector fields, the layout per element is:
The block size is gdim * lxyz * glb_nelv values. Note that if U is written, all three components have to be present. One cannot, for example, write only one component of velocity.
If X is not written, then the files does not contain the mesh!
Scalar fields are stored as lxyz * glb_nelv values in element-major order. Scalars are written in sequence S1, S2, ....
Field blocks are written in either single or double precision, depending on the fld_data_size header value. Neko writes single precision by default unless configured otherwise.
For 3D output (gdim == 3), Neko appends per-element min/max metadata for all written fields. These metadata blocks are always single precision and follow the same field ordering as the data blocks.
For 2D output, these metadata blocks are not written.
When writing 2D fields, Neko sets gdim = 2 (lz = 1). If a Z-velocity component exists, it is stored as an additional scalar field in the output. This is a semantic convention rather than a special file layout.
The .fld format is not self-describing beyond the header. It depends on:
For robust I/O, use Neko's fld_file reader/writer or convert using tools that understand the Nek5000 format.