# PLOT3D file format

In computational fluid dynamics, the PLOT3D file format is a standard file format used for storing grid and results data. PLOT3D was created by NASA Ames Research Center in 1982 by Pieter Buning and remains an often used file format. It can only store a structured grid. The structured grid allows random access, that is by knowing the block number, i location, j location, and k location, any grid point value or result value may be extracted. Additionally, given the location of any value, the block number, i location, j location, and k location may be determined. This makes it simple to iterate through a series of volumetric elements and calculate all required properties for the purpose of a CFD analysis.
The most basic format includes two different files, a grid file (G-file) and a solution file (Q-file). The filename extensions used vary, though .q is common for Q-files. Grid files may use .g, .x, .xy, or .xyz, among other extensions. The grid file contains the coordinates of the solution grid, while the solution file contains information typical of a CFD solution, flow density, flow momentum (a vector), and flow energy. Data may be stored in either binary or ASCII text format and floating point values may be either single or double precision. There are also multiblock and unstructured extensions to the format, so it is often unclear how a particular set of nominally PLOT3D-format files is formatted on the binary level without referring to the software that created them. Examination with a hex editor may be useful in determining the format variant.
Additional files may be present containing different kinds of ancillary data.
"Formatted" FORTRAN (ASCII text) data files will typically use CR-LF (0x0d 0x0a) delimiters at the end of the line, though the line breaks are implementation dependent. "Unformatted" FORTRAN (binary) files have the variables laid out in the same order but will normally lack delimiters such as line breaks. The binary format will be implementation and machine dependent.
A multiblock, 3 dimensional Q file begins with a single integer for the number of blocks M on its own line. The next M lines contain three integers for each of the blocks, which give the i, j, and k dimension sizes for each block. The M blocks are read in next. Each block begins with a line containing four floating-point values, the freestream Mach number, the freestream angle of attack, the freestream Reynolds number, and the time. The rest of the block contains the values iterated over i, j, k, m (block index), and the outermost n, which counts through 5 sections, the density, the 3 components of the momentum, and finally the energy.
A multiblock, 3 dimensional grid file begins with a single integer for the number of blocks M on its own line. The next M lines contain three integers for each of the blocks, which give the i, j, and k dimension sizes for each block. The M blocks are read in next. Each block contains a coordinate value iterated over i, j, k, and then the three coordinates, x, y, and z.
Additionally, the format may be simplified such that only a two-dimensional problem is analyzed or the iBlank parameter is omitted. The iBlank parameter indicates whether or not the cell is a physical or non-physical cell. For example, if two PLOT3D grids are intersected, one of an aircraft fuselage, and the other of an aircraft wing, there are internal cells that should not be analyzed. These are iBlank'ed cells and have a value of 0.

## Other structured file formats

* CGNS
* Tecplot