Simulation Graph¶
The default configuration (data/config/*.msp, see Default YAML) defines the whole simulation
as a graph of operators. A deck fills its hooks; it never needs to rewrite the graph itself.
flowchart LR
A[mpi_comm_world] --> B[init_cuda] --> C[initialize] --> D[compute_loop] --> E[last_output] --> F[checker] --> G[finalize_cuda]
Initialization¶
The initialize batch sets up the full simulation state:
| Operator / hook | Role |
|---|---|
global |
default values of the global slots (see Global Control) |
do_domain (hook) |
domain (MPI decomposition and grid) or read_dump (restart) |
set_lbm_parameters (hook) |
lbm_parameters: physical to lattice units |
print_domain |
prints the domain summary |
build_traversal |
builds the traversal index arrays (Real, Inside, Extend, boundary planes) |
grid_flavor |
define_grid_3dq19: allocates the LBMFields<19> arrays (\(f_i\), \(\rho\), flux, obstacles) |
init_obst |
marks every node as fluid |
set_default_distribution |
rest state \(f_i = w_i\) (skipped on restart) |
set_distributions (hook) |
user initial conditions (skipped on restart) |
setup_obstacles |
init_obstacles then the set_obstacles hook (obstacle registration) |
update_obstacles |
marks the solid nodes of the registered obstacles |
macro_variables |
initial \(\rho\) and \(\mathbf{u}\) |
simulation_state, log |
first log line |
write_paraview_first_timestep |
ParaView file of the initial state if display_paraview_first_timestep |
analysis (hook) |
initial analysis |
Time loop¶
compute_loop repeats, until simulation_end_iteration:
| Operator / hook | Role |
|---|---|
start_iteration (hook) |
user operators at the beginning of the step (nop by default) |
compute_macro_variables (hook) |
\(\rho\) and \(\mathbf{u}\) from the current \(f_i\) (macro_variables) |
collision (hook) |
relaxation towards the equilibrium: bgk (default) or mrt |
pre_stream_bcs (hook) |
conditions applied before streaming: domain-wall bounce-back (if bounce_back_planes), obstacle bounce-back, cavity_z_0/l |
streaming |
propagation of \(f_i\) along the lattice directions, ghost updates |
post_stream_bcs (hook) |
conditions applied after streaming: completion of the domain-wall bounce-back, lid_driven_cavity |
boundary_conditions (hook) |
user conditions: neumann, rho, lid_driven_cavity (nop by default) |
end_iteration |
triggers and runs the ParaView outputs, checkpoints, log and analysis |
next_time_step |
\(t \leftarrow t + \Delta t\) |
The default pre_stream_bcs and post_stream_bcs are:
Warning
To add a condition to pre_stream_bcs or post_stream_bcs, use +pre_stream_bcs: / +post_stream_bcs:. Without
+, the batch is replaced and the automatic bounce-back steps are lost.
Execution graph¶
The figure below shows the operator call graph printed by --debug-graph true for a Poiseuille simulation with
obstacles (older version of the default graph). Operators marked with a red dot (•) modify the fields slot (LBM
distributions). The colour of each block indicates the execution phase: green = initialize, orange = loop,
grey = finalize.
- During initialize, the grid is allocated (
define_grid_3dq19), obstacles are registered (setup_obstacles→register_quadrics×3), distributions are set (set_distribution), and a first ParaView output is written. - During the loop, each iteration runs
macro_variables→bgk→wall_bounce_back→streaming→neumann×2 (viaboundary_conditions), followed by conditional I/O (dump_paraview_if_triggered,print_log_if_triggered) controlled bynth_timesteptriggers. - After the loop, a final
write_paraview,checker, andfinalize_cudaconclude the simulation.