pymars

Contains main driver function for pyMARS program.

pymars.pymars.METHODS = ['DRG', 'DRGEP', 'PFA']

Supported reduction methods

class pymars.pymars.ReductionInputs(model: str, error: float, ignition_conditions: List[InputIgnition], psr_conditions: List[InputPSR], flame_conditions: List[InputLaminarFlame], method: str, target_species: List[str], safe_species: List[str] = [], sensitivity_analysis: bool = False, upper_threshold: float = 0.4, sensitivity_type: str = 'greedy', phase_name: str = '', min_flame_speed: float = None)

Collects inputs for overall reduction process.

error: float

Alias for field number 1

flame_conditions: List[InputLaminarFlame]

Alias for field number 4

ignition_conditions: List[InputIgnition]

Alias for field number 2

method: str

Alias for field number 5

min_flame_speed: float

Minimum laminar flame speed (m/s) treated as a real flame; None uses the FlameSimulation default. See laminar-flame-conditions docs.

model: str

Alias for field number 0

phase_name: str

Alias for field number 11

psr_conditions: List[InputPSR]

Alias for field number 3

safe_species: List[str]

Alias for field number 7

sensitivity_analysis: bool

Alias for field number 8

sensitivity_type: str

Alias for field number 10

target_species: List[str]

Alias for field number 6

upper_threshold: float

Alias for field number 9

pymars.pymars.main(model_file, error_limit, ignition_conditions, psr_conditions=[], flame_conditions=[], method=None, target_species=[], safe_species=[], phase_name='', run_sensitivity_analysis=False, upper_threshold=None, sensitivity_type='greedy', path='', num_threads=1, min_flame_speed=None)

Driver function for reducing a chemical kinetic model.

Parameters:
  • model_file (str) – Cantera-format model to be reduced (e.g., ‘mech.yaml’).

  • error_limit (float) – Maximum error percentage for the reduced model.

  • ignition_conditions (list of InputIgnition) – List of autoignition initial conditions.

  • psr_conditions (list of InputPSR, optional) – List of PSR simulation conditions.

  • flame_conditions (list of InputLaminarFlame, optional) – List of laminar flame simulation conditions.

  • method ({'DRG', 'DRGEP', 'PFA'}, optional) – Skeletal reduction method to use.

  • target_species (list of str, optional) – List of target species for graph-based reduction.

  • safe_species (list of str, optional) – List of non-target species to always retain.

  • phase_name (str, optional) – Optional name for phase to load from YAML file (e.g., ‘gas’).

  • run_sensitivity_analysis (bool, optional) – Flag to run sensitivity analysis after completing another method.

  • upper_threshold (float, optional) – Upper threshold (epsilon^*) used to determine species for sensitivity analysis in combination with DRG or DRGEP method

  • sensitivity_type ({'initial', 'greedy'}, optional) – Type of sensitivity analysis

  • path (str) – Path to directory for writing files

  • num_threads (int, optional) – Number of CPU threads to use for performing simulations in parallel. Optional; default = 1, in which the multiprocessing module is not used. If 0, then use the available number of cores minus one. Otherwise, use the specified number of threads.

pymars.pymars.parse_inputs(input_dict)

Parses and checks dictionary of inputs for consistency and correctness.

Parameters:

input_dict (dict) – Inputs for reduction

Returns:

Object with checked inputs

Return type:

ReductionInputs