Post · 9 min read· pp. 37–43

History and Solution Output

With v7.0 we have introduced a new way of customizing the output on screen, in the history file and in the visualization files. It is now possible to individually define what you want to have in your output.



Let’s define some terminology first.

  • Screen output : The convergence history printed on the console.
  • History output: The convergence history written to a file.
  • Volume output : Everything written to the visualization and restart files.
  • Output field: A single scalar value for screen and history output or a vector of a scalar quantity at every node in the mesh for the volume output.
  • Output group: A collection of output fields.

Note: You can print all available output fields and groups available for the current solver (set with the SOLVER option) by calling SU2_CFD with the -d flag (dry-run mode), i.e.

text
SU2_CFD -d <your_config_file.cfg>

Restart and Visualization Files

SU2 can output the solution in several file formats. You can specify what files you want to have by setting the option OUTPUT_FILES to a list of files. The valid options are described in the following table:

Option valueDescription
RESTARTNative SU2 binary restart format
RESTART_ASCIINative SU2 ASCII CSV restart format
STL_BINARYbinary mesh in .stl format
STL_ASCIIASCII mesh in .stl format
MESHNative SU2 mesh in .su2 format
CSVASCII CSV restart format (identical to RESTART_ASCII)
PARAVIEW_MULTIBLOCKBinary Paraview .vtm format
PARAVIEWBinary Paraview .vtk format
PARAVIEW_ASCIIASCII Paraview .vtk format
TECPLOTBinary Tecplot .szplt format
TECPLOT_ASCIIASCII Tecplot .dat format
SURFACE_CSVSurface values in CSV format (includes all markers set with MARKER_PLOTTING)
SURFACE_PARAVIEWSurface values in binary Paraview .vtk format (includes all markers set with MARKER_PLOTTING)
SURFACE_PARAVIEW_ASCIISurface values in ASCII Paraview .vtk format (includes all markers set with MARKER_PLOTTING)
SURFACE_TECPLOTSurface values in binary Tecplot .szplt format (includes all markers set with MARKER_PLOTTING)
SURFACE_TECPLOT_ASCIISurface values in ASCII Tecplot .dat format (includes all markers set with MARKER_PLOTTING)

The default value of OUTPUT_FILES is (RESTART, PARAVIEW, SURFACE_PARAVIEW). The output frequencies can be set by using the OUTPUT_WRT_FREQ option. OUTPUT_WRT_FREQ accepts a list of integer values for each of the file types in OUTPUT_FILES. If a single value is given, this value will be used as the writing frequency for all output files. If 2 values are used, the first value is used for the first file type in OUTPUT_FILES, and the second value is used for the other file types in the list. For time-dependent problems, the frequency is based on the time iterations, while for steady-state problems it is based on the outer or inner iterations, depending on whether it is a multi-zone or single-zone problem, respectively.

Note: If you run SU2 in parallel you should always use binary output files to get the best performance.

Setting Output Fields

The VOLUME_OUTPUT option can be used to set fields for the restart and visualization files. Here you have the option to specify either single fields and/or groups.

Option valueDefault valueDescriptionData type
VOLUME_OUTPUTCOORDINATES,SOLUTION,PRIMITIVEfields or groups that will be saved to filelist of keywords

Example

Groups and fields can be combined, e.g.:

VOLUME_OUTPUT= SOLUTION, PRESSURE, DENSITY

will save all field that are in the SOLUTION group. Pressure is in the PRIMITIVE group for the compressible solver and in the SOLUTION group for the incompressible solver. Density on the other hand is in the SOLUTION group for the compressible solver and in the PRIMITIVE group for the incompressible solver. They can be added individually as in the example above, or by simply adding the entire PRIMITIVE group to the list if file size is no issue. Note that keywords that are not valid for the current setup will simply be ignored.

For the compressible Navier-Stokes solver (i.e. SOLVER=NAVIER_STOKES), a non-exhaustive list of possible fields/groups is the following:

Field NameDescriptionGroup NameRemarks
COORD-Xx coordinateCOORDINATES-
COORD-Yy coordinateCOORDINATES-
COORD-Zz coordinateCOORDINATES3D only
DENSITYDensitySOLUTION-
MOMENTUM-XMomentum x-componentSOLUTION-
MOMENTUM-YMomentum y-componentSOLUTION-
MOMENTUM-ZMomentum z-componentSOLUTION3D only
ENERGYEnergySOLUTION-
PRESSUREPressurePRIMITIVE-
TEMPERATURETemperaturePRIMITIVE-
MACHMach NumberPRIMITIVE-
PRESSURE_COEFFPressure CoefficientPRIMITIVE-
LAMINAR_VISCOSITYLaminar viscosityPRIMITIVE-
SKIN_FRICTION-XSkin friction coefficient x-componentPRIMITIVE-
SKIN_FRICTION-YSkin friction coefficient y-componentPRIMITIVE-
SKIN_FRICTION-ZSkin friction coefficient z-componentPRIMITIVE3D only
HEAT_FLUXHeat fluxPRIMITIVE-
Y_PLUSY-PlusPRIMITIVE-

Additionally, for every field in the SOLUTION group, the limiters (group name LIMITER) and residuals (group name RESIDUAL) can be saved by adding RES_ or LIMITER_ in front of the field name.

For the incompressible Navier-Stokes solver (i.e. SOLVER=INC_NAVIER_STOKES), the solution group is different:

Field NameDescriptionGroup NameRemarks
PRESSUREPressureSOLUTION-
VELOCITY-XVelocity x-componentSOLUTION-
VELOCITY-YVelocity y-componentSOLUTION-
VELOCITY-ZVelocity z-componentSOLUTION3D only
TEMPERATUREStatic TemperatureSOLUTIONINC_ENERGY_EQUATION= YES
DENSITYDensityPRIMITIVE-

Turbulence quantities:

Field NameDescriptionGroup NameRemarks
NU_TILDESpalart Allmaras variableSOLUTIONSA models
TKETurbulent kinetic energy kSOLUTIONSST models
DISSIPATIONTurbulent dissipation rate omegaSOLUTIONSST models
EDDY_VISCOSITYTurbulent eddy viscosityPRIMITIVE-

To inspect the mesh quality we additionaly have:

Field NameDescriptionGroup NameRemarks
ORTHOGONALITYOrthogonality angleMESH_QUALITY-
ASPECT_RATIOCV Aspect ratioMESH_QUALITY-
VOLUME_RATIOCV sub-volume ratioMESH_QUALITY-

For moving grids:

Field NameDescriptionGroup NameRemarks
GRID_VELOCITY-XX-component of grid velocity vectorGRID_VELOCITY-
GRID_VELOCITY-YY-component of grid velocity vectorGRID_VELOCITY-
GRID_VELOCITY-ZZ-component of grid velocity vectorGRID_VELOCITY3D only

Customizing the Screen and History Output

Screen Output

You can define the output fields you want to have printed on screen by using the config option SCREEN_OUTPUT.

Option valueDefault valueDescriptionData typeRemark
SCREEN_OUTPUTINNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X,RMS_MOMENTUM-Y, RMS_ENERGYfield or group that will be printed to screenlist of keywordscompressible
SCREEN_OUTPUTINNER_ITER, RMS_PRESSURE, VELOCITY-X,VELOCITY-Yfield or group that will be printed to screenlist of keywordsincompressible

Fields available depend on the solver you are using. Fields available for all solvers are the following:

  • TIME_ITER: Time iteration index
  • OUTER_ITER: Outer (coupling) iteration index (for multi-zone problems only)
  • INNER_ITER: Inner iteration index (pseudo-time iteration)
  • CUR_TIME: Current physical time of your simulation
  • TIME_STEP: Current time step
  • WALL_TIME: Current average wall-clock time for one iteration

If you run a multizone problem, the convergence history of the individual zones (i.e. the convergence of the inner iteration) is disabled by default and only the convergence of the outer iteration is shown. That means SCREEN_OUTPUT in the sub-config files is ignored. You can still print fields from individual zones by using the field name and the zone index. For example in an Fluid-Structure interaction problem the drag in zone 0 and the von-Mises stress in zone 1 can be used as fields by adding DRAG[0] and/or VMS[1] to the screen output in the main config file. It is possible to force the output of the full inner convergence history per zone by setting WRT_ZONE_CONV to YES.

You can also customize the frequency when the convergence history should be written to screen by using SCREEN_WRT_FREQ_INNER, SCREEN_WRT_FREQ_OUTER and SCREEN_WRT_FREQ_TIME.

History Output

The history output can be customized in a similar fashion as the screen output by using the HISTORY_OUTPUT option. In fact, screen and history outputs share all fields which means that everything that can written to screen can be written also to the history file and vice versa.

If you run a multizone problem, in addition to the history files per zone, a file (default: history_multizone.dat) will be created where the convergence history of the outer iteration is stored. Groups for this output can be set by using the HISTORY_OUTPUT option in the main config file.

You can also customize the frequency when the convergence history should be written to the history file by using HISTORY_WRT_FREQ_INNER, HISTORY_WRT_FREQ_OUTER and HISTORY_WRT_FREQ_TIME.

Example

For the compressible Navier-Stokes solver (i.e. SOLVER=NAVIER_STOKES), a non-exhaustive list of possible fields/groups is the following:

Field NameDescriptionGroup Name
TIME_ITERTime iteration indexITER
OUTER_ITEROuter (coupling) iteration index.ITER
INNER_ITERInner iteration index (pseudo-time iteration).ITER
CUR_TIMECurrent physical time of your simulation.TIME_DOMAIN
TIME_STEPCurrent time step.TIME_DOMAIN
WALL_TIMECurrent average wall-clock time for one iteration.WALL_TIME
RMS_DENSITYRoot-mean square residual of the density.RMS_RES
RMS_MOMENTUM-XRoot-mean square residual of the momentum x-component.RMS_RES
RMS_MOMENTUM-YRoot-mean square residual of the momentum y-component.RMS_RES
RMS_MOMENTUM-ZRoot-mean square residual of the momentum z-component.RMS_RES
RMS_ENERGYRoot-mean square residual of the energy.RMS_RES
DRAGTotal Drag coefficient.AERO_COEFF
LIFTTotal Lift coefficientAERO_COEFF
SIDEFORCETotal Sideforce coefficient.AERO_COEFF
MOMENT_XTotal Moment around the x-axis.AERO_COEFF
MOMENT_YTotal Moment around the y-axis.AERO_COEFF
MOMENT_ZTotal Moment around the z-axis.AERO_COEFF
FORCE_XTotal Force in x direction.AERO_COEFF
FORCE_YTotal Force in y direction.AERO_COEFF
FORCE_ZTotal Force in z direction.AERO_COEFF
EFFICIENCYTotal Lift-to-drag ratio.AERO_COEFF

User Defined Functions

From version 7.4.0 it is possible for users to create custom outputs via math expressions of solver variables and built-in outputs. All custom outputs are specified via the config option CUSTOM_OUTPUTS, in general the syntax to define a custom output is name : type{expression}[markers]; (note the use of ; to separate different outputs). Where ‘name’ is the identifier that can be used to request output to screen or history file, and also to reference the output in other custom outputs (he group name for all custom outputs is CUSTOM).

The available types are:

  • Macro: Introduces a new field that can only be used in other expressions, it is not an output by itself (note the “$” symbol to reference macros in the example below).
  • Function: Introduces a new scalar output that is a function of other scalar outputs, it cannot reference fields (e.g. velocity).
  • AreaAvg and AreaInt: Computes an area average or integral of a field (the expression) over the list of markers.
  • MassFlowAvg and MassFlowInt: Computes a mass flow average or integral.
  • Probe: Evaluates the expression using the values of the mesh point closest to the coordinates specified inside “[]”, [x, y] or [x, y, z] (2 or 3D).

Note: Each custom output can only use one type, e.g. it is not possible to write p_drop : AreaAvg{PRESSURE}[inlet] - AreaAvg{PRESSURE}[outlet]. This would need to be separated into two AreaAvg outputs and one Function to compute their difference.

Example:

text
CUSTOM_OUTPUTS= 'velocity : Macro{sqrt(pow(VELOCITY_X, 2) + pow(VELOCITY_Y, 2) + pow(VELOCITY_Z, 2))};\
                 avg_vel : AreaAvg{$velocity}[z_minus, z_plus];\
                 var_vel : AreaAvg{pow($velocity - avg_vel, 2)}[z_minus, z_plus];\
                 dev_vel : Function{sqrt(var_vel) / avg_vel};\
                 probe1 : Probe{$velocity}[0.005, 0.005, 0.05]'

To obtain the list of solver variables that can be used, write an invalid expression (e.g. ‘x : AreaAvg{INVALID}[]’) and run SU2.

To use a custom output as the objective function of the discrete adjoint solver, use OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC and set CUSTOM_OBJFUNC appropriately, for example:

text
CUSTOM_OBJFUNC= 'LIFT + dev_vel'

For more details see the example test case.