Post Processing#

After running a simulation, multiple artifacts are generated from it. These include macroscopics fields exported during simulation, .stl files representing the geometries in the domain, log messages, runtime informations, among many other files. In this section the output folder structure and files will be explained, as how to interact with them.

Output structure#

Each simulation is saved in the folder <save_path>/<simulation_name>/<sim_id>/. This folder is structured as

πŸ“‚ save_path/simulation_name/sim_id
  πŸ“‚ checkpoints
    # Checkpoints saved during simulation, can be used to restart at given step
    πŸ“‚ {time_step}
      # Macroscopics in the given time step required to restart simulation (rho, u, S, omega_LES)
      πŸ“‚ macrs
        πŸ—Ž {file identifier}.vti
      πŸ—Ž macrs.vtm
      # Copy of the simulation's probes folder
      πŸ“‚ probes
        ...
      # Simulation state required to restart simulation
      πŸ—Ž state.json
      # Copy of current log
      πŸ—Ž simulation.log
      # Copy of configuration from simulation
      πŸ—Ž config.yaml
  πŸ“‚ bodies
    πŸ“‚ lnas
      # .lnas is the original file, and transformed 
      # is after all transformations applied
      πŸ—Ž {body name}.lnas
      πŸ—Ž {body name}.transformed.lnas 
    πŸ“‚ nodes
      # Folder for each body, with the IBM nodes positions and their 
      # values exports through simulation
      πŸ“‚ {body_name}
        πŸ—Ž nodes.csv
        πŸ—Ž {time step export}.csv
    πŸ“‚ stls
      # STL files for all geometries, after all transformations
      πŸ—Ž {body name}.stl
      # STL rescaled to `domain_rescale` scale
      πŸ—Ž {body name}.rescaled.stl
  πŸ“‚ code_generated
    # Each program generated for runtime and its compile log
    πŸ—Ž {program name}.cu
    πŸ—Ž {program name}.cu.compile.log
  # Macroscopics fields exported
  πŸ“‚ macrs
    πŸ“‚ instantaneous
      # Each instantaneous key for export has a folder of its own
      πŸ“‚ {export name}
        # Each time step export has a .vtm file and a folder 
        # with the .vti files used by the .vtm
        πŸ“‚ macrs_{time_step}
          πŸ—Ž {file identifier}.vti
        πŸ—Ž macrs_{time step}.vtm
    πŸ“‚ stats
      # Each statistics key for export has a folder of its own
      πŸ“‚ {export name}
        # Each time step export has a .vtm file and a folder 
        # with the .vti files used by the .vtm
        πŸ“‚ macrs_{time_step}
          πŸ—Ž {file identifier}.vti
        πŸ—Ž macrs_{time step}.vtm
  # Monitors exported
  πŸ“‚ monitors
    πŸ“‚ fields
      πŸ—Ž {monitor name}.{macr_name}.csv
      πŸ—Ž {monitor name}.{macr_name}.plot.png 
  πŸ“‚ multiblock
    # File to visualize domain refinement
    πŸ—Ž blocks.obj
  # Probes exported
  πŸ“‚ probes
    πŸ“‚ hist_series
      πŸ“‚ {series name}
        # Files for each type, lines, bodies, csvs, points, etc.
        # Each one with .csv for the points of the 
        # series and a HDF with time series data for each macroscopics
        # The points position are the ones after all transformations
        πŸ—Ž line.{line name}.{macr_name}.h5
        πŸ—Ž line.{line name}.points.csv
        πŸ—Ž bodies.{body name}.{macr_name}.h5
        πŸ—Ž bodies.{body name}.points.csv
        πŸ—Ž points.{point name}.{macr_name}.h5
        πŸ—Ž points.{point name}.points.csv
        πŸ—Ž csvs.{csv name}.{macr_name}.h5
        πŸ—Ž csvs.{csv name}.points.csv
    πŸ“‚ spectrum
      πŸ“‚ {spectrum name}
        # HDF file with the time series values
        πŸ—Ž {spectrum name}.data.h5
        # Point position in the domain
        πŸ—Ž {spectrum name}.points.csv
  # Full configuration for simulation 
  # (not the same as the original configuration file that generated the simulations)
  πŸ—Ž config.yaml
  # Runtime informations for simulation
  πŸ—Ž info.yaml
  # Log file
  πŸ—Ž simulation.log

Series indexing#

There are some specific rules to the historic series indexing that it’s very important to understand to operate with it.

The points are generated using the specification of the generator, then the points outside the domain are filtered out. The idx field of the points are generated using as reference the initial points (the ones not filtered out). So, for example, if the first two points of a line are out of the domain, the first index of the points.csv will be 2.

This is important for when you’re combining the idx of this with other sources of information, such as the LNAS vertices or triangles.

Domain overview#

To have an overview of the domain setup, we recommend using ParaView. It supports all our file extensions and have extensive funcionalities for visualization, process and many other resources.

Below is an example of domain visualization using the multiblock/blocks.obj and the geometry files of the bodies.

Bodies geometry

Visualization of domain refinement and positioned bodies#

It’s also possible to view the points of series in the domain, converting the csv table to points in space

Points historic series

Visualization of points position from historic series#

Macroscopics Fields#

Check the state of the macroscopics fields, such as density or velocity, is a must step to check the quality of a simulation. We also recommend ParaView for this. The macroscopic field can be either exported for instantaneous and statistical values of the macroscopic variables rho, u, S, omega_LES.

The resulting .vtm can be further post processed with Paraview using the calculator tool, as demonstrated below for a statistics field:

Macroscopics field

Post processing of macroscopic fields with Paraview#

In the example above, the the calculator filter from Paraview is used for the calculation of turbulent intensity \(I_{u}\) from averaged fields of velocity and squared velocity sqrt(ux_2nd-(ux^2))/ux. Another frequently performed calculation is to transform the velocity components into a vector, which can be done with iHat*ux + jHat*uy + kHat*uz.

Being a Python based software, Paraview allows the user to apply any of its filters through scripts. This allows the user to write post processing routines that can be performed in any .vtm files that contain the same variable names.

API interaction#

All these files and paths can be accessed through an internal API as well. In this way a program can access the full path of files such as the historic series data or points, macroscopics instataneous path, the .obj file with blocks visualization, and other informations.

Below is a code snippet demonstrating how to use it.

import pathlib
from nassu.cfg.model import ConfigScheme
from nassu.cfg.schemes.simul import SimulationConfigs, SimulationOutput

filename = "tests/validation/cases/08_flow_over_mounted_cube.yaml"

sim_cfgs = ConfigScheme.from_file(pathlib.Path(filename)).load_sim_cfgs()
sim_cfg = sim_cfgs[0]
sim_output: SimulationOutput = sim_cfg.output

cube_stl_path = sim_output.bodies["cube"].stl # Path for stl output file of cube
full_info = sim_output.read_info() # reads info.yaml

To know more about this interface and how to interact with it, check the class nassu.cfg.schemes.simul.SimulationOutput.