bloc.boulder_plugins.spatial_plugin#

Spatial distribution physics calculations for Boulder spatial plugin.

This module contains the core physics calculations for spatial analysis, separated from the UI components in spatial_output_pane.py.

Registration is handled by bloc.boulder_plugins.register.register_plugins() function called via entry point.

Exceptions#

SpatialAnalysisError

Custom exception for spatial analysis errors.

Functions#

calculate_spatial_distribution(reactor_config, length, ...)

Calculate spatial distribution for a reactor.

calculate_flow_velocity(reactor_config, network_config)

Calculate flow velocity from reactor geometry and inlet flows.

calculate_flow_velocity_from_boulder_network(...[, config])

Calculate flow velocity from Boulder network connections.

Module Contents#

exception bloc.boulder_plugins.spatial_plugin.SpatialAnalysisError#

Bases: Exception

Custom exception for spatial analysis errors.

bloc.boulder_plugins.spatial_plugin.calculate_spatial_distribution(reactor_config, length, velocity, n_points, mechanism, boulder_converter=None, network_config=None)#

Calculate spatial distribution for a reactor.

This function performs spatial analysis by integrating a 0-D reactor over time and converting time to spatial position using flow velocity.

Args:

reactor_config: Reactor configuration dictionary with properties length: Reactor length in meters (must be > 0) velocity: Flow velocity in m/s (must be > 0) n_points: Number of spatial points (must be >= 2) mechanism: Cantera mechanism name/path (must be valid)

Returns:

  • Dictionary containing spatial distribution data

  • - positions (np.array of positions (m))

  • - temperatures (np.array of temperatures (K))

  • - pressures (np.array of pressures (Pa))

  • - species_mole_fractions (np.array of mole fractions)

  • - species_names (list of species names)

  • - residence_time (total residence time (s))

  • - velocity (flow velocity (m/s))

  • - length (reactor length (m))

  • - n_points (number of points)

Raises:
bloc.boulder_plugins.spatial_plugin.calculate_flow_velocity(reactor_config, network_config)#

Calculate flow velocity from reactor geometry and inlet flows.

Args:

reactor_config: Reactor configuration with volume and length network_config: Network configuration with connections and flow rates

Return type:

Flow velocity in m/s

Raises:
bloc.boulder_plugins.spatial_plugin.calculate_flow_velocity_from_boulder_network(converter, reactor_id, config=None)#

Calculate flow velocity from Boulder network connections.

This function extracts flow velocity directly from a Boulder DualCanteraConverter by examining the reactor properties and inlet connections.

Args:

converter: DualCanteraConverter instance with built network reactor_id: ID of the target reactor config: Optional original configuration to get reactor properties like length

Return type:

Flow velocity in m/s

Raises: