pfa

Module containing Path Flux Analysis (PFA) reduction method.

pymars.pfa.create_pfa_matrix(state, solution)

Creates PFA adjacency matrix based on direct interaction coefficients

Parameters
  • state (tuple) – Tuple of state with temperature, pressure, and species mass fractions

  • solution (cantera.Solution) – Cantera object of the solution being analyzed

Returns

adjacency_matrix – Adjacency matrix based on calculated direct interaction coefficients

Return type

numpy.ndarray

Search nodal graph and generate list of species to remove

Parameters
  • graph (networkx.DiGraph) – graph representing reaction system

  • target_species (list) – List of target species to search from

Returns

reached_species – List of species reachable from targets in graph

Return type

list of str

pymars.pfa.reduce_pfa(model_file, species_targets, species_safe, threshold, matrices, ignition_conditions, sampled_metrics, phase_name='', previous_model=None, threshold_upper=None, num_threads=1, path='')

Given a threshold and PFA matrix, reduce the model and determine the error.

Parameters
  • model_file (str) – Filename for model being reduced

  • species_targets (list of str) – List of target species names

  • species_safe (list of str) – List of species to always be retained

  • threshold (float) – PFA threshold for trimming graph

  • matrices (list of numpy.ndarray) – List of PFA adjacency matrices determined from thermochemical state data

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

  • sampled_metrics (numpy.ndarray) – Global metrics from original model used to evaluate error

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

  • previous_model (ReducedModel, optional) – Model produced at previous threshold level; used to avoid repeated work.

  • threshold_upper (float, optional) – Optional upper threshold (epsilon^star) used to identify species for further sensitivity analysis

  • 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.

  • path (str, optional) – Optional path for writing files

Returns

Return reduced model and associated metadata

Return type

ReducedModel

pymars.pfa.run_pfa(model_file, ignition_conditions, psr_conditions, flame_conditions, error_limit, species_targets, species_safe, phase_name='', threshold_upper=None, num_threads=1, path='')

Main function for running PFA reduction.

Parameters
  • model_file (str) – Original model file

  • 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.

  • error_limit (float) – Maximum allowable error level for reduced model

  • species_targets (list of str) – List of target species names

  • species_safe (list of str) – List of species names to always be retained

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

  • threshold_upper (float, optional) – Upper threshold (epsilon^*) to identify limbo species for sensitivity analysis

  • 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.

  • path (str, optional) – Optional path for writing files

Returns

Return reduced model and associated metadata

Return type

ReducedModel

pymars.pfa.trim_pfa(matrix, species_names, species_targets, threshold)
Parameters
  • matrix (np.ndarray) – Adjacency matrix representing graph

  • species_names (list of str) – List of all species names

  • species_targets (list of str) – List of target species names

  • threshold (float) – PFA threshold for trimming graph

Returns

species_reached – Names of species reached in graph search

Return type

list of str