Skip to content

Getting Started

Dominykas edited this page Sep 14, 2026 · 2 revisions

Workflow for a custom simulation

This page describes the typical workflow for running a custom flow example, from setting up the required files to launching the simulation in Python.

Steps

  1. Create a settings file — tells the solver which configuration to run. See Settings File.
  2. Create a configuration file — specifies the physics, flow type, freestream conditions, and output behavior:
    • When to export fields in HDF5 format
    • What fields to rasterize into MP4
    • How long to run the simulation See Configuration File.
  3. (Optional) Create a boundary file — defines the geometry the flow interacts with. This can be generated in Python (see example below) or supplied manually.
  4. Set up and run the simulation in Python, using the shockFLOW package.

Example: Setting Up and Running a Simulation

import shockFLOW.nozzle   as nc
import shockFLOW.utils    as helpers
import shockFLOW.solver   as flow
import os
 
module_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(os.path.abspath(__file__)))
 
#create directories for Videos and Logs
os.makedirs("Videos", exist_ok=True)
os.makedirs("Logs", exist_ok=True)
 
path_run = os.getcwd()
output_dir = os.getcwd() + "/Videos/"
 
dimx = 4000
dimy = 2000
radius = 100
exit_time = 300 #us
 
#generating your boundary file (in this case, a rectangle)
rectangle_width = 100
rectangle_height = 100
nc.create_rectangle_bc(dimx, dimy, path_run + "/", rectangle_width, rectangle_height)
 
config = "impact.yaml"
settings = "settings.yaml"
 
#helpers write custom settings to the yaml files => this can be of course done manually in the config and settings files
helpers.set_simulation_domain(config, dimx, dimy, 1)
helpers.set_logging_folder(settings, path_run + "/Logs")
helpers.set_ext_event_times(config, exit_time)
helpers.set_ffmpeg_output_path(settings, output_dir)
helpers.set_boundary_files(config, path_run + "/rect.bin", path_run + "/rectn.bin")
 
 
print("Starting Simulation", flush=True)
 
#run the solver with custom settings, config.
flow.custom(settings, config, path_run)

What This Example Does

Step Description
os.chdir(...) Moves the working directory to the script's location, so relative paths (config, settings, outputs) resolve consistently.
os.makedirs("Videos"), os.makedirs("Logs") Creates the output directories for rendered videos and log files.
nc.create_rectangle_bc(...) Generates a rectangular boundary file (geometry + normals) sized to the domain, in place of manually supplying boundary_files in the configuration file.
helpers.set_simulation_domain(config, dimx, dimy, 1) Writes simulation.domain.Nx, Ny, Nz into the config file.
helpers.set_logging_folder(settings, ...) Writes runtime.logging.logging_folder into the settings file.
helpers.set_ext_event_times(config, exit_time) Writes the EXT event time (in µs) into the config file.
helpers.set_ffmpeg_output_path(settings, output_dir) Writes the FFMPEG/video output path into the settings file.
helpers.set_boundary_files(config, ...) Writes the boundary_files.boundary and boundary_files.normals paths into the config file.
flow.custom(settings, config, path_run) Launches the solver using the given settings file, config file, and run directory.

Notes

  • The helpers.* functions are a convenience layer for programmatically editing the YAML files — everything they do can also be done by editing the configuration and settings files by hand.
  • Boundary files (geometry + normals) can either be generated with helpers like nc.create_rectangle_bc(...), or supplied directly by setting boundary_files.boundary / boundary_files.normals in the configuration file.
  • See the Configuration File Reference and Settings File Reference pages for the full set of fields these files support.

shockFLOW Wiki

Home


Getting Started

Simulation Setup

Exporting Results

Logging & Troubleshooting


Links

Clone this wiki locally