API Reference#

boulder.app.create_app()#

Create and return the Dash app instance for testing purposes.

This function is used by E2E tests to get a fresh app instance. For production use, import the ‘app’ instance directly.

boulder.app.run_server(debug=False, host='0.0.0.0', port=8050, verbose=False)#

Run the Dash server.

Examples

Examples using run_server#

sphx_glr_auto_examples_launch_from_python.py

Launch Boulder from Python (as in run.py).

Command-line interface for Boulder.

Usage:

boulder # Launches the server and opens the interface boulder path/to/file.yaml # Launches with the YAML preloaded

boulder.cli.find_available_port(host, start_port, max_attempts=10)#

Find the next available port starting from start_port.

boulder.cli.is_port_in_use(host, port)#

Check if a port is already in use.

boulder.cli.run_headless_mode(config_path, output_path, verbose=False)#

Run Boulder in headless mode to generate Python code from YAML configuration.

This function provides a command-line interface for generating standalone Python scripts from Boulder YAML configurations without launching the web UI. The generated Python code contains a complete Cantera simulation that can be executed independently.

CLI Usage Examples:#

Basic usage:

boulder config.yaml –headless –download output.py

With verbose output:

boulder config.yaml –headless –download output.py –verbose

Using relative paths:

boulder configs/mix_react_streams.yaml –headless –download simulation.py

Using absolute paths:

boulder C:/path/to/config.yaml –headless –download C:/output/simulation.py

param config_path:

Path to the YAML configuration file containing the reactor network definition. Must follow the Boulder STONE standard format with ‘nodes’, ‘connections’, ‘phases’, and ‘settings’ sections.

type config_path:

str

param output_path:

Path where the generated Python script will be saved. The script will contain all necessary imports, reactor setup, network configuration, and simulation loop.

type output_path:

str

param verbose:

If True, prints detailed progress information during code generation including configuration loading, network building, and simulation execution steps. Default is False.

type verbose:

bool, optional

param Generated Python Code Features:

param ——————————:

param - Complete Cantera imports and mechanism loading:

param - Reactor creation with proper initial conditions:

param - Mass flow controllers and connection setup:

param - Network configuration with solver tolerances:

param - Simulation loop with time advancement:

param - Temperature and state output during simulation:

param - Inline comments explaining each step:

raises FileNotFoundError:

If the specified config_path does not exist

raises ValueError:

If the YAML configuration is invalid or contains unsupported reactor types

raises RuntimeError:

If network building or simulation fails due to numerical issues

Notes

The generated Python script is completely standalone and can be executed with:

python output.py

The script will run the simulation and print time-series data to the console. For advanced post-processing, users can modify the generated script to save data to files or create custom plots.

Examples