Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
if reactants:
for entry in reactants:
assert reactants[entry] > 0, pre + entry + ' value needs to be a number > 0'
assert entry in gas.species_names, (
pre + 'reactant not in model: ' + entry
)
composition_type = case.get('composition-type', 'mole')
assert composition_type in ['mole', 'mass'], pre + 'composition-type must be "mole" or "mass"'
assert not (composition_type == 'mass' and equiv_ratio), (
pre + 'composition-type: must be mole when specifying equivalence ratio'
)
inputs.append(InputIgnition(
kind, temperature, pressure, end_time,
equiv_ratio, fuel, oxidizer, reactants, composition_type
))
return inputs
from . import soln2cti
from .drgep import run_drgep
from .drg import run_drg
from .pfa import run_pfa
from .sensitivity_analysis import run_sa
from .tools import convert
#: Supported reduction methods
METHODS = ['DRG', 'DRGEP', 'PFA']
class ReductionInputs(NamedTuple):
"""Collects inputs for overall reduction process.
"""
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.1
sensitivity_type: str = 'greedy'
phase_name: str = ''
def parse_inputs(input_dict):
"""Parses and checks dictionary of inputs for consistency and correctness.
Parameters
----------