pypbomb.thermochem
This module contains functions for performing thermochemical calculations using
cantera
and pypbomb.sd
.
- pypbomb.thermochem.calculate_laminar_flame_speed(initial_temperature, initial_pressure, species, mechanism, phase_specification='', unit_registry=<pint.registry.UnitRegistry object>)
This function uses cantera to calculate the laminar flame speed of a given gas mixture.
- Parameters:
initial_temperature (pint.Quantity) – Mixture initial temperature
initial_pressure (pint.Quantity) – Mixture initial pressure
species (dict or str) – Species definition for cantera
mechanism (str) – String of mechanism to use (e.g.
gri30.yaml
)phase_specification (str, optional) – Phase specification for cantera solution
unit_registry (pint.UnitRegistry, optional) – Unit registry for managing units to prevent conflicts with parent unit registry
- Returns:
Laminar flame speed
- Return type:
pint.Quantity
- pypbomb.thermochem.calculate_reflected_shock_state(initial_temperature, initial_pressure, species_dict, mechanism, unit_registry=<pint.registry.UnitRegistry object>, use_multiprocessing=False)
Calculates the thermodynamic and chemical state of a reflected shock using customized sdtoolbox functions.
- Parameters:
initial_temperature (pint.Quantity or Tuple[float, str]) – Mixture initial temperature
initial_pressure (pint.Quantity or Tuple[float, str]) – Mixture initial pressure
species_dict (dict) – Dictionary of initial reactant mixture
mechanism (str) – Mechanism to use for chemical calculations, e.g.
gri30.yaml
unit_registry (pint.UnitRegistry, optional) – Pint unit registry
use_multiprocessing (bool, optional) – True to use multiprocessing for CJ state calculation, which is faster but requires the function to be run from
__main__
- Returns:
Dictionary containing keys
reflected
andcj
.
Each of these keys corresponds to a dictionary containing the keys
speed
, indicating the related wave speed, andstate
, which is a Cantera gas object at the specified state.
- Return type:
dict
- pypbomb.thermochem.find_mechanisms(return_directory=False)
Figure out which mechanisms the local cantera install has access to.
- Parameters:
return_directory (bool, optional) – Whether to return the location of the mechanism files as well as its contents. Defaults to
False
.- Returns:
Set of available mechanisms in the cantera data directory. If return_directory is set to True, a tuple is returned where the first item is the set of available mechanisms, and the second is the location of the cantera data directory.
- Return type:
set or tuple
- pypbomb.thermochem.get_eq_sound_speed(temperature, pressure, species, mechanism, phase_specification='', unit_registry=<pint.registry.UnitRegistry object>)
Calculates the equilibrium speed of sound in a mixture
- Parameters:
temperature (pint.Quantity or Tuple[float, str]) – Mixture initial temperature
pressure (pint.Quantity or Tuple[float, str]) – Mixture initial pressure
species (dict or str) – Species definition for cantera
mechanism (str) – Desired chemical mechanism
phase_specification (str, optional) – Phase specification for cantera solution
unit_registry (pint.UnitRegistry, optional) – Unit registry for managing units to prevent conflicts with parent unit registry
- Returns:
sound_speed – local speed of sound
- Return type:
pint.Quantity or Tuple[float, str]