Examples#
This section shows how to use PyChemkin utilities and reactor models to perform different types of simulations. Early examples demonstrate how to perform essential operations, such as loading and preprocessing the chemistry set. Later examples explain how to tackle more complex simulations, such as running an ignition delay parameter study. Thus, you should go through the examples in the order listed.
Chemistry#
PyChemkin examples to demonstrate basic operations for instantiating Chemistry Set from the gas-phase mechanism and the thermodynamic/transport data files.
The examples walk through the steps about how to pre-process the Chemistry Set, retrieve mechanism information and the species properties, as well as how to handle multiple Chemistry Sets in a Python Chemkin project.
Mixture#
Mixture is the “core” token in PyChemkin. It represents a gas-phase mixture by storing its pressure, temperature, and species composition. Stream is an extended “Class” of Mixture with the additional attribute of “mass/volumetric flow rate”. Mixture and Stream include utilities that can be used to evaluate the mixture properties (density, mixture enthalpy, mixture viscosity, …) and the reaction rates. There are also methods to manipulate the Mixture/Stream such as merging two mixtures adiabatically.
The examples demonstrate how to instantiate the Mixture/Stream objects, how to extract information and properties of a Mixture/Stream, and how to manipulate Mixture/Stream objects.
Estimate the adiabatic flame temperature of a gas mixture
Calculate the detonation wave speed of a real-gas mixture
Estimate the steady-state NO emission level of a complete burned fuel-air mixture
Batch reactor#
The batch reactor is an idealized 0-D transient closed reactor model in which the gas inside the reactor is assumed to be homogeneous. When the pressure of the batch reactor is constrained, the reactor volume would vary to conserve the total gas mass. Likewise, the reactor pressure might change when the reactor volume is “given”. The gas temperature can be “given” by piecewise linear profile data or solved by the energy equation.
The examples consist of projects that utilize the batch reactor model to perform simulations of various complexities, from tracking the evolution of the mixture properties to the A-factor sensitivity analysis.
Simulate hydrogen combustion in a constant-pressure reactor
Predict the ignition delay time of a combustible mixture
0-D engine models#
PyChemkin offers two types of 0-D engine models: the Homogeneous Charged Compression Ignition (HCCI) engine model and the Spark Ignition (SI) engine model. These 0-D engine models simulate the combustion process (or the lack of, in case of a misfire) inside an engine cylinder between the Intake Valve Close (IVC) and the Exhaust Valve Open (EVO) when the cylinder is considered as a closed system. The Chemkin Theory manual has detailed descriptions of these 0-D engine models.
The examples show the steps of setting up simulations with different Chemkin engine models.
Perfectly stirred reactor#
The perfectly Stirred reactor (PSR) model is a 0-D steady-state reactor. This ideal reactor model assumes the gas mixture inside is uniform and the properties of the outlet stream are exactly the same as the gas properties inside the reactor. A PSR can have either its pressure or its volume “specified”, and the reactor temperature can either be solved from the energy equation or be “given” as an input parameter.
The examples will show the procedures of setting up single PSR simulations with different constraints and with multiple inlet streams.
Set up a PSR parameter study for the inlet stream equivalence ratio
Determine the impact of residence time on combustion in a PSR
Plug-flow reactor#
Plug-Flow Reactor (PFR) model is an idealized 1-D steady-state flow reactor model with single inlet stream. The reactor pressure is assumed to be given, and the mass (flow rate) conservation is maintained by the velocity change. The gas temperature along the reactor can be either specified or solved by the energy equation.
PSR network#
PyChemkin can be used to create an Equivalence Reactor Network (ERN) as a reduced-order (in geometry) model for complex combustion applications such as gas turbine combustor. Each reactor in the network represents a sub-region (zone) in the actual equipment. Normally these zones are created according to specific criteria such as temperature, equivalence ratio, or location; and the gas flow (mean, turbulent, and diffusive) between the zones becomes the internal streams between the reactors.
There are several ways to build an ERN in PyChemkin. The first method is to create and solve the reactors one-by-one starting from the most upstream (first) reactor. Adjust/manipulate the external and outlet streams from connected reactors (that is, solutions from the reactors) using the Mixture/Stream utilities and apply the desired stream as the inlet for the downstream reactors. The second method takes advantage of the hybridreactornetwork “model” of PyChemkin. Simply defined the reactors with the associated external inlets and add the reactors to the hybridreactornetwork. If there are recycling streams from the downstream reactor to the upstream ones, the hybridreactornetwork will solve the entire ERN iteratively. In this case, a tear point must be explicitly specified. The last method, the coupled method, is to create the network and its connectivity first, and the entire ERN will be solved in a coupled manner. This method is the default method in Chemkin GUI and is available as the PSRCluster “model” in PyChemkin.
- Chemkin ERN has a few limitations:
The first reactor of the reactor network must have at least one external inlet.
when using the coupled model, the entire reactor network can have only one outlet to the surroundings, and the outlet must be attached to the last reactor in the network.
PSR is the only reactor model allowed in the PSRCluster and the hybridreactornetwork reactor networks.
The PSRChain_xxx examples show the two methods to build and run a series of linked PSRs (no stream recycling) can be modeled in PyChemkin. The PSRnetwork example goes over the steps of creating and running an ERN with recycling streams by using the hybridreactornetwork method. The PSRnetwork_coupled example solves the same ERN as the PSRnetwork example but utilizes the coupled method. Because the sole outlet from the coupled ERN must be attached to the last reactor, the order of the downstream zones is different from the PSRnetwork example.
Use a chain of individual reactors to model a gas combustor
Use a chain reactor network to model a gas combustor
Simulate a combustor using an equivalent reactor network with stream recycling
Premixed flame models#
The Premixed Flame model is a 1-D steady-state application, and it contains two sub-models: “flame speed calculator” (or the freely propagating flame model) and “flat flame” model. The flame speed calculator is commonly used to calculate the laminar flame speed of a premixed fuel-oxidizer mixture. The predicted/computed flame speeds can be used to validate a combustion mechanism or can serve as a prre-processor to construct a “flame speed table” or a “combustion progress table” for other applications. The flat flame burner-stablized model is primarily used to study the flame chemistry in conjunction with the flat flame experiments.
The examples show different ways to perform the “premixed flame” calculations.
Compute the laminar flame speed of diluted hydrogen at low pressure
Construct atmospheric methane-air flame speed versus equivalence ratio table