Skip to content

Exporting Fields

Dominykas edited this page Sep 16, 2026 · 1 revision

Event Handle

shockFLOW uses an Event Handle to capture moments in time during the simulation. These Events can be used to change flow properties, activate probes, or, primarily, to export "snapshots" of the simulation variables at a given timestep.

There are two Event types: events, and capture events. Events are the primary capture method, and measure time from the simulation start. Capture events behave similarly, but do not measure time until a triger (by, say, a shock passing through) is activated. Both are defined in the configuration file:

events:
  EXT:
    time: 300
capture_events:
  EXT:
    time: 300

Note that both require EXT events to be defined.

Exporting as HDF5

The solver's default export mode is HDF5 (Hierarchical Data Format version 5). To export in this mode, you simply need to define an extra event:

events:
  store_1:
    time: 200
  EXT:
    time: 300
capture_events:
  EXT:
    time: 300

This will export simulation data 200us after simulation start. Data will be stored in a output path directory, named "200.hdf5".

HDF5 File Contents

Each exported .hdf5 file contains a set of global attributes describing the simulation setup, plus a set of field datasets holding the actual simulation variables.

Attributes

Attribute Type Description
nx unsigned long long Number of grid cells in the x-direction
ny unsigned long long Number of grid cells in the y-direction
dx double Grid spacing in the x-direction
dy double Grid spacing in the y-direction
mx double Mach number in the x-direction (config->mx)
px double Reference/freestream pressure ratio (config->px)
res double Domain height / resolution parameter (params.height)
noseX double X-coordinate of the body/nose reference point
noseY double Y-coordinate of the body/nose reference point
P0 double Reference (initial) pressure
T0 double Reference (initial) temperature
rho0 double Reference (initial) density
GasConstant double Specific gas constant used in the simulation
Gamma double Ratio of specific heats (γ)
origin unsigned long long Location/origin index of the simulation domain

Note: dy is currently written from the same source value as dx (params.dx) in the code. If your domain uses non-square cells, double-check this before relying on dy for anisotropic grids.

Fields

Field Units Reference State
density_gradient kg/m⁴
density kg/m³ Normalized against rho0 (×4)
vx m/s Normalized against v_ref
vy m/s Normalized against v_ref
temperature K T0

Exporting as VTK

The solver's second export mode is VTK (Visualization Toolkit). To export in this mode, you simply need to add a vtk flag to your event:

events:
  store_1:
    time: 200
    vtk : true
  EXT:
    time: 300
capture_events:
  EXT:
    time: 300

This will then export in a similar fashion to HDF5, but in VTK format ready to be used in, for example, ParaView. Note that this file format will use more storage space, and, generally, will be a bit slower. In the VTK format, however, attributes are not stored. Instead, raw fields are exported (in SI units):

Fields

Field Units Reference State
density_gradient kg/m⁴ rho0
density kg/m³ rho0 / dx
vx m/s v_ref
vy m/s v_ref
temperature K T0

Where v_ref is the reference sound speed derived from freestream conditions.

shockFLOW Wiki

Home


Getting Started

Simulation Setup

Exporting Results

Logging & Troubleshooting


Links

Clone this wiki locally