Simulation

members

class pyteck.simulation.PressureRiseProfile(mech_filename, initial_temp, initial_pres, reactants, pressure_rise, time_end)[source]

Set the velocity of reactor moving wall via specified pressure rise.

The initialization and calling of this class are handled by the Func1 interface of Cantera.

The approach used here is based on that discussed by Chaos and Dryer, “Chemical-kinetic modeling of ignition delay: Considerations in interpreting shock tube data”, Int J Chem Kinet 2010 42:143-150, doi:10.1002/kin.20471 <http://dx.doi.org/10.1002/kin.20471. A time-dependent polytropic state change is emulated by determining volume as a function of time, via a constant linear pressure rise \(A\) (given as a percentage of the initial pressure):

\[ \begin{align}\begin{aligned}\begin{split}\frac{dv}{dt} &= -\frac{1}{\gamma} \frac{v(t)}{P(t)} \frac{dP}{dt} \\ v(t) &= \frac{1}{\rho} \left[ \frac{P(t)}{P_0} \right]^{-1 / \gamma}\end{split}\\\begin{split}\frac{dP}{dt} &= A P_0 \\ \therefore P(t) &= P_0 (A t + 1)\end{split}\\\frac{dv}{dt} = -A \frac{1}{\rho \gamma} (A t + 1)^{-1 / \gamma}\end{aligned}\end{align} \]

The expression for \(\frac{dv}{dt}\) can then be used directly for the Wall velocity.

class pyteck.simulation.Simulation(kind, apparatus, meta, properties)[source]

Class for ignition delay simulations.

process_results()[source]

Process integration results to obtain ignition delay.

run_case(restart=False)[source]

Run simulation case set up setup_case.

Parameters

restart (bool) – If True, skip if results file exists.

setup_case(model_file, species_key, path='')[source]

Sets up the simulation case to be run.

Parameters
  • model_file (str) – Filename for Cantera-format model

  • species_key (dict) – Dictionary with species names for model_file

  • path (str) – Path for data file

class pyteck.simulation.VolumeProfile(volume_history)[source]

Set the velocity of reactor moving wall via specified volume profile.

The initialization and calling of this class are handled by the Func1 interface of Cantera.

Based on VolumeProfile implemented in Bryan W. Weber’s CanSen

pyteck.simulation.create_volume_history(mech, temp, pres, reactants, pres_rise, time_end)[source]

Constructs a volume profile based on intiial conditions and pressure rise.

Parameters
  • mech (str) – Cantera-format mechanism file

  • temp (float) – Initial temperature in K

  • pres (float) – Initial pressure in Pa

  • reactants (str) – Reactants composition in mole fraction

  • pres_rise (float) – Pressure rise rate, in s^-1

  • time_end (float) – End time of simulation in s

Returns

List of times and volumes

Return type

list of np.ndarray

pyteck.simulation.first_derivative(x, y)[source]

Evaluates first derivative using second-order finite differences.

Uses (second-order) centeral difference in interior and second-order one-sided difference at boundaries.

Parameters
  • x (np.ndarray) – Independent variable array

  • y (np.ndarray) – Dependent variable array

Returns

First derivative, \(dy/dx\)

Return type

np.ndarray

pyteck.simulation.get_ignition_delay(time, target, target_name, ignition_type)[source]

Identify ignition delay based on time, target, and type of detection.

pyteck.simulation.sample_rising_pressure(time_end, init_pres, freq, pressure_rise_rate)[source]

Samples pressure for particular frequency assuming linear rise.

Parameters
  • time_end (float) – End time of simulation in s

  • init_pres (float) – Initial pressure

  • freq (float) – Frequency of sampling, in Hz

  • pressure_rise_rate (float) – Pressure rise rate, in s^-1

Returns

List of times and pressures

Return type

list of np.ndarray