boulder.download_script_emitter#

Emit standalone Cantera-native download scripts.

The generated file uses module-level reactors, connections, and walls registries, direct ct.* construction, and named network_<stage>.advance(...) calls per stage.

Subclass CanteraScriptEmitter and override _emit_reactor, _emit_download_imports, _emit_post_build_calls, or _network_ctor to inject custom reactor kinds (e.g. plugin-specific types) without modifying this module.

Classes#

CanteraScriptEmitter

Emits a standalone Cantera-native staged-solve script from a config dict.

Functions#

script_lines_for_runner(runner_import, runner_class, ...)

Emit the runner-based staged-solve script block.

emit_cantera_native_script(config[, converter_class])

Return Python source lines for a Cantera-native staged-solve script.

Module Contents#

class boulder.download_script_emitter.CanteraScriptEmitter(converter=None)#

Emits a standalone Cantera-native staged-solve script from a config dict.

Subclass and override _emit_reactor, _emit_download_imports, or _emit_post_build_calls to inject custom behaviour (e.g. Bloc-specific reactor types) without modifying Boulder.

Parameters:

converter – Optional reference to a converter object — reserved for subclass use. The base class stores it as self.converter but does not use it.

converter = None#
nodes_by_id: Dict[str, Any]#
inlet_target_ids: set#
plan: Any = None#
stream_inlet_by_stage: Dict[str, List[Dict[str, Any]]]#
has_mech_switch: bool = False#
mechanism: str = 'gri30.yaml'#
all_node_types: set#
emit(config)#

Return Python source lines for a Cantera-native staged-solve script.

boulder.download_script_emitter.script_lines_for_runner(runner_import, runner_class, config_path, plan, continuation=None, signals_block=None, bindings_block=None)#

Emit the runner-based staged-solve script block.

For each stage the emitted snippet calls runner.solve_stage(), which delegates to the full solver dispatcher (including advance_grid and micro_step loops). After each stage a short human-readable progress summary is printed so the downloaded script gives meaningful output when run standalone.

When continuation is provided the emitted script wraps the stage loop in an outer continuation sweep that mirrors the combustor.py pattern.

Transient stages (advance_grid, micro_step) additionally emit a progress line that shows the time elapsed, making the standalone script more useful as a verification script.

When signals_block and bindings_block are provided the emitted script includes the causal-layer wiring verbatim: from boulder.signals import build_signal_registry from boulder.bindings import apply_bindings_block and wires signals into the built network so the standalone script is fully runnable without manual signal setup.

boulder.download_script_emitter.emit_cantera_native_script(config, converter_class='')#

Return Python source lines for a Cantera-native staged-solve script.

Thin wrapper around CanteraScriptEmitter kept for backward compatibility. The converter_class parameter is accepted but ignored by the base emitter (it is retained here so that existing callers do not need to be updated in this task).