The first part of this chapter shows the data file formats for PLOT3D (a widely used visualization program developed by Pieter Buning at NASA Ames). The same formats are used for the grid and solution files input to FAST. Most of the grid and solution generator programs have the option of outputting files in "PLOT3D format;" if you are using those programs, you do not need this chapter. Formatting information is included here for programmers writing their own grid or solution generators.
One thing to check is that your solutions are calculated for the grid points, not at cell centers.
The following diagram shows the basic idea of the sequence the data should be in (for a 2D grid).
IDIM=IMAX; JDIM=JMAX. PLOT3D and FAST expect to start reading at I=1, J=1 (and K=1). The following sections give details of how to organize your data.
FAST reads these types of files:
These formats can be used as a general guide to writing your program to comply with PLOT3D/FAST file requirements. The first set of formats is for structured grids; the second set is for unstructured. In the formats described below, the brackets indicate one record in Plot3D WHOLE format.
Some example FORTRAN code fragments are included after the general formats.
See also Introduction on page 431XREF.
[IDIM, JDIM, KDIM]
IDIM x JDIM x KDIM (call this product NPOINTS) floating-point X coordinates (brackets indicate one record):
[x1,x2,...,xNPOINTS,
NPOINTS floating-point Y coordinates:
y1,y2,...,yNPOINTS,
NPOINTS floating-point Z coordinates:
z1, z2,...,zNPOINTS]
[NZONES]
NZONES * 3 integers (brackets indicate one record):
[IDIM1, JDIM1, KDIM1, IDIM2, JDIM2, KDIM2, ...,
IDIM_NZONES, JDIM_NZONES, KDIM_NZONES]
series of NZONES datasets:
[XVALUES1, YVALUES1, ZVALUES1] (see above) for 1st zone
[VALUES1, YVALUES1, ZVALUES1] (see above) for 2nd zone
...,
[XVALUES1, YVALUES1, ZVALUES1] (see above) for last zone
[IDIM, JDIM, KDIM]
IDIM x JDIM x KDIM (call this product NPOINTS) floating-point X coordinates (brackets indicate one record):
[x1, x2,...,xNPOINTS,
NPOINTS floating-point Y coordinates:
y1, y2,...,yNPOINTS,
NPOINTS floating-point Z coordinates:
z1, z2,...,zNPOINTS,
NPOINTS integer iblank values:
i1, i2,...,iNPOINTS]
[NZONES]
NZONES * 3 integers (brackets indicate one record):
[IDIM1, JDIM1, KDIM1,IDIM2, JDIM2, KDIM2, ...,
IDIM_NZONES, JDIM_NZONES, KDIM_NZONES]
series of NZONES datasets (see above):
[XVALUES1, YVALUES1, ZVALUES1, IVALUES1] for 1st zone
[XVALUES2, YVALUES2, ZVALUES2, IVALUES2] for 2nd zone
...,
[XVALUES_NZONES, YVALUES_NZONES,
ZVALUES_NZONES, IVALUES_NZONES]
for last zone
For a brief explanation of unstructured grids, see SURFERU on page 379XREF.
If you are writing or reading unformatted FORTRAN, the x's, y\xd5 s and z's should all be in one WRITE or READ statement. In the formats described below, the brackets indicate one record.
NOTE: NTETRAHEDRA can be 0.
The triangles are used to define surfaces (such as the surface of the object, or the boundary) for display in SURFERU. More than one surface can be defined. The integer iflags are used to assign a surface number to each triangle.
Unformatted files are written in two records. The first contains the dimensions, the second one all the data (coordinates, triangle vertex indices, iflag values, and (optionally) tetrahedra vertex indices). In the case of multi-zone files (see below), the first record contains all of the dimesions and the remaining N records contain the data for the N zones.
[NPOINTS, NTRIANGLES, NTETRAHEDRA]
NPOINTS xyz floating-point coordinates (in scalar format, like PLOT3D) (brackets indicate one record):
[x1,x2,..., xNPOINTS,y1,y2, ..., yNPOINTS,z1,z2, ..., zNPOINTS,
NTRIANGLES integer vertex index triples:
v11,v12,v13,v21,v22,v23,...,vNTRIANGLES1,
vNTRIANGLES2,vNTRIANGLES3
,
NTRIANGLES integer flags:
i1,i2,...,iNTRIANGLES,
NTETRAHEDRA integer vertex index quadruples:
v11,v12,v13,v14,v21,v22,v23,v24,...,
vNTETRAHEDRA1,vNTETRAHEDRA2,vNTETRAHEDRA3,
vNTETRAHEDRA4]
[NZONES]
NZONES * 3 integers (brackets indicate one record):
[NPOINTS1, NTRIANGLES1, NTETRAHEDRA1,NPOINTS2, NTRIANGLES2, NTETRAHEDRA2,...,NPOINTS_NZONES, NTRIANGLES_NZONES, NTETRAHEDRA_NZONES]
series of NZONES datasets (see above):
[POINTS1, TRIANGLES1, IFLAGS1, TETRAHEDRA1] for the 1st zone
[POINTS2, TRIANGLES2, IFLAGS2, TETRAHEDRA2] for the 2nd zone
...,
[POINTS_NZONES, TRIANGLES_NZONES, IFLAGS_NZONES, TETRAHEDRA_NZONES]
[IDIM, JDIM, KDIM]
4 floating-point conditions:
(free-stream mach number, angle-of-attack, Reynold's number, and integration time)
[FSMACH, ALPHA, RE, TIME]
IDIM x JDIM x KDIM (call this product NPOINTS) floating-point Q1 values (brackets indicate one record):
(Q1 is density (RHO))
[q11, q12,...,q1NPOINTS,
NPOINTS floating-point Q2 values:
(Q2 is x momentum (RHO*U))
q21,q22,...,q2NPOINTS,
NPOINTS floating-point Q3 values:
(Q3 is y momentum (RHO*V))
q31,q32,..., q3NPOINTS,
NPOINTS floating-point Q4 values:
(Q4 is z momentum (RHO*W))
q41,q42,...,q4NPOINTS,
NPOINTS floating-point Q5 values:
(Q5 is total energy per unit volume (E))
q51,q52,...,q5NPOINTS]
[NZONES]
3 integers: (brackets indicate one record)
[IDIM1, JDIM1, KDIM1,IDIM2, JDIM2, KDIM2,...,
IDIM_NZONES, JDIM_NZONES, KDIM_NZONES]
series of NZONES datasets preceeded by each set of conditions:
[FSMACH1, ALPHA1, RE1, TIME1]
[Q1VALUES1, Q2VALUES1, Q3VALUES1, Q4VALUES1, Q5VALUES1] (see above) for 1st zone
[FSMACH, ALPHA2, RE2, TIME2]
[Q1VALUES2, Q2VALUES2, Q3VALUES2, Q4VALUES2, Q5VALUES2] (see above) for 2nd zone
...,
[FSMACHN, ALPHAN, REN, TIMEN]
[Q1VALUESN, Q2VALUESN, Q3VALUESN, Q4VALUESN, Q5VALUESN] (see above) for last zone
[IDIM, JDIM, KDIM, 1]
IDIM x JDIM x KDIM (call this product NPOINTS) floating-point F values:
[f1, f2, ..., f1NPOINTS]
[NZONES]
4 integers (brackets indicate one record):
[IDIM1, JDIM1, KDIM1, 1,IDIM2, JDIM2, KDIM2, 1,...,IDIM_NZONES, JDIM_NZONES, KDIM_NZONES, 1]
series of NZONES datasets:
[FVALUES1] (see above) for 1st zone
[FVALUES2] (see above) for 2nd zone
[...,]
[FVALUESN] (see above) for last zone
[IDIM, JDIM, KDIM, 3]
IDIM x JDIM x KDIM (call this product NPOINTS) floating-point FX values (brackets indicate one record):
[fx1,fx2,...,fxNPOINTS,
NPOINTS floating-point FY values:
fy1,fy2,...,fyNPOINTS,
NPOINTS floating-point FZ values:
fz1,fz2,...,fzNPOINTS]
[NZONES]
4 integers (brackets indicate one record):
[IDIM1, JDIM1, KDIM1, 3, IDIM2, JDIM2, KDIM2, 3,...,
IDIM_NZONES, JDIM_NZONES, KDIM_NZONES, 3]
series of NZONES datasets:
[FXVALUES1, FYVALUES1, FZVALUES1] (see above) for 1st zone
[FXVALUES2, FYVALUES2, FZVALUES2] (see above) for 2nd zone
...,
[FXVALUESN, FYVALUESN, FZVALUESN] (see above) for last zone
Example: A 6 field solution file with a total of 3 scalar fields and 3 vector fields = 3 x 1 + 3 x 3 = 12 variables per grid point can be written as a 6 zone function file as follows (IJK dims for all zones are the same:
2 x 3 x 4 = 24 grid points per field):
2 3 4 1
2 3 4 1
2 3 4 3
2 3 4 3
2 3 4 1
2 3 4 3
(...12 x 24 = 288 floating-point values are here...)
The following code fragments can be inserted into your grid or solution generating programs. They will work for .bin or .dat files.
WRITE(IUNIT) IDIM WRITE(IUNIT) (X(I),I=1,IDIM) 2D:
WRITE(IUNIT) IDIM,JDIM WRITE(IUNIT) ((X(I,J),I=1,IDIM),J=1,JDIM), C ((Y(I,J),I=1,IDIM),J=1,JDIM)
3D (WHOLE):
WRITE(IUNIT) IDIM,JDIM,KDIM
WRITE(IUNIT) (((X(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM),
C (((Y(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM),
C (((Z(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM)
3D (PLANES):
WRITE(IUNIT) IDIM,JDIM,KDIM DO 10 K= 1,KDIM WRITE(IUNIT) ((X(I,J,K),I=1,IDIM),J=1,JDIM), C ((Y(I,J,K),I=1,IDIM),J=1,JDIM), C ((Z(I,J,K),I=1,IDIM),J=1,JDIM) 10 CONTINUE
WRITE(IUNIT) IDIM,JDIM,KDIM WRITE(IUNIT) (((X(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM), C (((Y(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM), C (((Z(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM), C (((IBLANK(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM)
3D (PLANES):
WRITE(IUNIT) IDIM,JDIM,KDIM DO 10 K= 1,KDIM WRITE(IUNIT) ((X(I,J,K),I=1,IDIM),J=1,JDIM), C ((Y(I,J,K),I=1,IDIM),J=1,JDIM), C ((Z(I,J,K),I=1,IDIM),J=1,JDIM), C ((IBLANK(I,J,K),I=1,IDIM),J=1,JDIM) 10 CONTINUE
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID),IGRID=1,NGRID) DO 10 IGRID= 1,NGRID WRITE(IUNIT) C (((X(I,J,K), C I=1,IDIM(IGRID)),J=1,JDIM(IGRID)),K=1,KDIM(IGRID)), C (((Y(I,J,K), C I=1,IDIM(IGRID)),J=1,JDIM(IGRID)),K=1,KDIM(IGRID)), C (((Z(I,J,K), C I=1,IDIM(IGRID)),J=1,JDIM(IGRID)),K=1,KDIM(IGRID)) 10 CONTINUE
3D (PLANES):
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID),IGRID=1,NGRID) DO 10 IGRID= 1,NGRID DO 10 K= 1,KDIM(IGRID) WRITE(IUNIT) C ((X(I,J,K),I=1,IDIM(IGRID)),J=1,JDIM(IGRID)), C ((Y(I,J,K),I=1,IDIM(IGRID)),J=1,JDIM(IGRID)), C ((Z(I,J,K),I=1,IDIM(IGRID)),J=1,JDIM(IGRID)) 10 CONTINUE
Freestream Mach number (FSMACH)
Angle-of-attack (ALPHA)
Reynolds number (RE)
Time (TIME)
WRITE(IUNIT) IDIM WRITE(IUNIT) FSMACH,ALPHA,RE,TIME WRITE(IUNIT) ((Q(I,NX),I=1,IDIM),NX=1,3)
2D:
WRITE(IUNIT) IDIM,JDIM WRITE(IUNIT) FSMACH,ALPHA,RE,TIME WRITE(IUNIT) (((Q(I,J,NX),I=1,IDIM),J=1,JDIM),NX=1,4)
3D (WHOLE):
WRITE(IUNIT) IDIM,JDIM,KDIM WRITE(IUNIT) FSMACH,ALPHA,RE,TIME WRITE(IUNIT) ((((Q(I,J,K,NX),I=1,IDIM),J=1,JDIM), C K=1, KDIM),NX=1,5)
3D (PLANES):
WRITE(IUNIT) IDIM,JDIM,KDIM WRITE(IUNIT) FSMACH,ALPHA,RE,TIME DO 10 K= 1,KDIM WRITE(IUNIT) (((Q(I,J,K,NX),I=1,IDIM), C J=1,JDIM),NX=1,5) 10 CONTINUE
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID), C IGRID=1,NGRID) DO 10 IGRID= 1,NGRID WRITE(IUNIT) FSMACH,ALPHA,RE,TIME WRITE(IUNIT) C ((((Q(I,J,K,NX),I=1, C IDIM(IGRID)),J=1,JDIM(IGRID)),K=1,KDIM(IGRID)), C NX=1,5) 10 CONTINUE
3D (PLANES):
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID), C IGRID=1,NGRID) DO 10 IGRID= 1,NGRID WRITE(IUNIT) FSMACH,ALPHA,RE,TIME DO 10 K= 1,KDIM(IGRID) WRITE(IUNIT) (((Q(I,J,K,NX),I=1,IDIM(IGRID)), C J=1,JDIM(IGRID)),NX=1,5) 10 CONTINUE
WRITE(IUNIT) IDIM,NVAR WRITE(IUNIT) ((F(I,NX),I=1,IDIM),NX=1,NVAR) 2D:
WRITE(IUNIT) IDIM,JDIM,NVAR WRITE(IUNIT) (((F(I,J,NX),I=1,IDIM),J=1,JDIM),NX=1,NVAR) 3D (WHOLE):
WRITE(IUNIT) IDIM,JDIM,KDIM,NVAR WRITE(IUNIT) ((((F(I,J,K,NX),I=1,IDIM),J=1,JDIM),K=1,KDIM), C NX=1,NVAR) 3D (PLANES):
WRITE(IUNIT) IDIM,JDIM,KDIM,NVAR DO 10 K= 1,KDIM WRITE(IUNIT) (((F(I,J,K,NX),I=1,IDIM),J=1,JDIM),NX=1,NVAR) 10 CONTINUE
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID),NVAR(IGRID), C IGRID=1,NGRID) DO 10 IGRID= 1,NGRID WRITE(IUNIT) C ((((F(I,J,K,NX), C I=1,IDIM(IGRID)),J=1,JDIM(IGRID)),K=1,KDIM(IGRID)), C NX= 1,NVAR(IGRID)) 10 CONTINUE 3D (PLANES):
WRITE(IUNIT) NGRID WRITE(IUNIT) (IDIM(IGRID),JDIM(IGRID),KDIM(IGRID), C NVAR(IGRID),IGRID=1,NGRID) DO 10 IGRID= 1,NGRID DO 10 K= 1,KDIM(IGRID) WRITE(IUNIT) C (((F(I,J,K,NX),I=1,IDIM(IGRID)),J=1,JDIM(IGRID)), C NX=1,NVAR(IGRID)) 10 CONTINUE
There is a way to get IRIS Unformatted files into and out of a Cray FORTRAN program without file conversion before and after running the program, respectively. It involves the use of the UNICOS assign statement. Before running a program to read or write the file, type on the command line:
assign -F f77 -N ieee filename
**Within the Numerical Aerodynamic Simulation system at NASA Ames, there are several utilities for converting files. A Cray unformatted file can be translated into an Iris binary file using wkconv or itrans, or into an Iris unformatted file using 4Dconv. itrans is located on reynolds in /usr/local/bin. The programs wkconv and 4Dconv are on reynolds in /usr/unsupported/bin. The sources are located in /usr/unsupported/src/bin. The programs were written by Alan Wray.
*4d2cray (see reynolds/usr/unsupported/man) converts an IRIS file into a Cray file.
Environment: Fortran, IRIS-4D, IRIX 3.3, 4.0
Files may be read or written BINARY when opened as follows.
OPEN(UNIT=LUN,FILE='filename',
FORM= 'UNFORMATTED',ACCESS='DIRECT',RECL=1)
To compile, assuming source code is in file 'program.f':
f77 -old_rl -o program program.f
The compile switch "-old_rl" is required. Bytes are retrieved sequentially; the record length of 1 disables the usual checking. Although the file is opened as ACCESS='DIRECT', the keyword REC is not used in the READ statement. This is IRIS-specific code. The use of RECL=1 in conjunction with the "-old_rl" compile flag to access data in a byte stream rather than as fixed-length records is non-standard code.
Read and write as though unformatted, but this will not support partial record read. For example:
READ(LUN) WHATEVER
The top page for this FAST User Guide is
http://science.nas.nasa.gov/Software/FAST/RND-93-010.walatka-clucas/
The FAST home page is
http://science.nas.nasa.gov/Software/FAST
Updated:
August 3, 1999
WebWork: Jean Clucas and
Pam Walatka
NASA Responsible official:
Michael Gerald-Yamasaki