The following explanation describes how to add a new variable to the Tecplot output of FASTEST. Other output formats are not considered here and break if only Tecplot output is treated. Although the procedure described here worked for me it might not be complete and it has not been exhaustively tested.
The process is broken into two parts:
This step comprises allocation of array-space and adding to the list of permitted visual output variables in the id-file. First the parameter nvovar in the file parcom.h is incremented. The parameter nvovar is used to dimension the array lvovar (this happens in dimoutcntrl.h), which keeps track of what to put into the visual output files.
Next we edit the section ### visual output variables in readinp.F. There we need to increment mflag by the same amount as nvovar. Also, the array flag is extended: We assign a keyword, which is used in the id-file to determine if the new variable is included in the visual output. mflag, flag, and nvovar need to correspond.
The Tecplot format for visual output consists of a header part and several vectors containing coordinates and field data.
The header for the visual output is written in the function techdr(), which called from fortec() (see below) and which is defined in techdr.F. First, getnumvars() (also defined in techdr.F) is called to determine the total number of output variables. It is necessary to increment iphi accordingly, e.g. by one for a scalar field or by three for a vector field.
Next we add a label describing the new output field by assigning its name to hdrstr and calling writehdrstr(). This is done iphi times and concludes the changes to the Tecplot header. Please note that the array lvovar is called llvovar in techdr().
We return to the function fortec(), which is responsible for adding the field data to the output file. For each visual output option from the id-file there must be a corresponding element in the lvovar array. fortec() contains a section enclosed in if...endif for each of these. Every write operation to the Tecplot file is done via the array rhelp. Thus, we need to call getvar() to copy the field data from the vector which is used to store it in FASTEST to rhelp. Then a call to writebin() commits the data to the output file.
It is essential to write the headers in the same order as the data fields. Otherwise, the labels will not correspond with the data. The recommended place to add a new output variable into techdr() and fortec() is at the end of the current [l]lvovar sequences.