The Cantera interface to MUM-PCE¶
The Cantera model is designed to demonstrate a real-world example of MUM-PCE. Like the toy model, it consists of a set of experimental measurements that will be used to constrain a chemistry model.
Contents
The initialization function¶
The function measurement_initialize_xl()
reads an Excel file to determine the experimental database. The header row gives the name of each column, which will be parsed by measurement_initialize_xl()
. The order of the columns does not matter. Two examples are given below. Other examples are given in the repository.
Tip
The columns can be in any order. If a column is not used by any measurement in the list, it can be omitted. If a column is not used by a particular measurement, it can be left blank; the parser will ignore it.
Example data file¶
Example 1¶
Type | ID | Fuel1 | X_fuel1 | Fuel2 | X_fuel2 | Fuel3 | X_fuel3 | Ox | Dil | Temp | Pres | Model | Exp_val | Exp_unc |
fls | ecl90_b01 | CH4 | 0.5461 | N2 | 0 | N2 | 0 | 2 | Air | 298 | 1 | scheme.uscmech2-base.1atm.cti | 6.76 | 1 |
fls | ecl90_b02 | CH4 | 0.5973 | N2 | 0 | N2 | 0 | 2 | Air | 298 | 1 | scheme.uscmech2-base.1atm.cti | 12.2 | 1 |
fls | ecl90_b03 | CH4 | 0.6948 | N2 | 0 | N2 | 0 | 2 | Air | 298 | 1 | scheme.uscmech2-base.1atm.cti | 20.3 | 1 |
fls | ecl90_b04 | CH4 | 0.7482 | N2 | 0 | N2 | 0 | 2 | Air | 298 | 1 | scheme.uscmech2-base.1atm.cti | 24.3 | 1 |
Example 2¶
Type | ID | Fuel1 | X_fuel1 | Fuel2 | X_fuel2 | Fuel3 | X_fuel3 | Ox | Dil | Temp | Pres | Model | Crit_spec | Sim | Exp_val | Exp_unc |
ign | lif77_1a01 | CH4 | 0.01 | C3H8 | 0 | H2 | 0 | 0.02 | AR | 2020.20202020202 | 10.0 | scheme.uscmech2-base.10atm.cti | OH | crit | 3.69 | 0.1 |
ign | lif77_1a02 | CH4 | 0.01 | C3H8 | 0 | H2 | 0 | 0.02 | AR | 1992.0318725099603 | 10.0 | scheme.uscmech2-base.10atm.cti | OH | crit | 3.68 | 0.1 |
ign | lif77_1a03 | CH4 | 0.01 | C3H8 | 0 | H2 | 0 | 0.02 | AR | 1904.7619047619048 | 10.0 | scheme.uscmech2-base.10atm.cti | OH | crit | 4.24 | 0.1 |
ign | lif77_1a04 | CH4 | 0.01 | C3H8 | 0 | H2 | 0 | 0.02 | AR | 1876.172607879925 | 10.0 | scheme.uscmech2-base.10atm.cti | OH | crit | 4.34 | 0.1 |
Columns of the data file¶
The data file contains the following options. Columns with names marked with an asterisk are required, and all others are optional. Text enclosed in (parentheses) is optional. For instance, the parser will recognize Temp, Temper, and Temperature as valid keywords for specifying the unburned gas temperature.
- Type*: The type of measurement, which determines which Cantera model will be used
- ign: Shock tube,
ShockTube
and its subclasses- pro: Alias for Sim=tau,
ShockTubeConcentration
- pul: Alias for Sim=ratio,
ShockTubeRatio
- fls: Laminar flame,
FlameSpeed
- rxn: Reaction rate measurement,
ReactionRateBase
and its subclasses
- ID*: A free-form text identifier
Note
The ‘name’ of the experiment will be generated from Type and ID
- Reactant definitions*:
Fuel: A text identifier for a reactant species in the unburned gas mixture. This must be a species in the Cantera chemistry model
- X_Fuel: The mole fraction of each reactant species in the unburned gas mixture.
Tip
As seen in the example, any number of Fuel and X_fuel pairs can be used. They can be in any order, but the first Fuel column must correspond to the first X_fuel column. Although the columns are named Fuel1, Fuel2, etc in the example, this is arbitrary and any identifier, or none, can be used.
Ox: The mole fraction of oxygen.
- Dil: The diluent species. The behavior depends on what this is.
- ‘Air’: 3.76 moles of nitrogen is added per mole of oxygen. Ox must be specified
- ‘ArAir’: 3.76 moles of argon is added per mole of oxygen. Ox must be specified
- A species in the Cantera chemistry model: the total mole fractions of all the fuels and oxidizer add to less than unity, then enough of this species will be added to ensure that the mole fractions sum to unity.
Note
At least one substance must be specified somehow by one of these keywords. If Dil=’Air’ or Dil=’ArAir’, Ox be specified.
Temp(erature)*: The temperature of the unburned gas in Kelvins
Pres(sure)*: The pressure of the unburned gas in standard atmospheres
- Model: The Cantera chemistry model used for this measurement.
Tip
The value of
chemistry_model
used in the function call is used as a default for all measurements. If this column is not provided,chemistry_model
is used for all measurements. If this column is provided, a value needs to be specified only for those experiments that use a different modelWarning
Different models for different measurements is only intended to be used if some measurements are conducted under conditions where rate constants may change (e.g. certain kinds of pressure dependencies). All models should have exactly the same reactions and corresponding parameters, although they can take different values.
- Sim(ulation): For
ShockTube
andReactionRateBase
measurements, defines which sub-measurement will be done.
- crit:
ShockTubeDelay
, ignition delay time measured by maximum critical species production- pres:
ShockTubeDelay
, ignition delay time measured by maximum pressure rise- conc:
ShockTubeDelay
, delay time until a certain critical species concentration- tau:
ShockTubeConcentration
, concentration of the critical species after a certain time
- ratio: Behavior depends on whether this is a
ShockTube
orReactionRateBase
ShockTubeRatio
, ratio of two concentrations after a certain timeReactionRateRatioAtCondition
, the ratio of two rate constants- single:
ReactionRateAtCondition
, a single rate constant- ARatio:
ReactionARatio
, the ratio of two reaction rate A factors- ERatio:
ReactionEDiff
, The ratio of two reaction rate activation energiesTime: For
ShockTubeConcentration
andShockTubeRatio
experiments, this is the integration time in microseconds.
- Crit(ical_)spec(ies): The species whose mole fraction is to be tracked. If the value in this column is PRES, then pressure is tracked in the simulation, otherwise it must be a species in the Cantera chemistry model. For
ShockTubeRatio
measurements, this is the species whose concentration appears in the numerator.Note
For backwards compatibility with previous database implementations, Simulation=’crit’ and Critical_species=’PRES’ is equivalent to Simulation=’pres’
Crit(ical_)denom(inator): For
ShockTubeRatio
measurements, this is the species whose concentration appears in the denominator.Crit(ical_)rise: For
ShockTubeDelay
measurements with Simulation=’conc’, this determines if the critical species concentration should be rising or falling through the critical valueCrit(ical_)val(ue): For
ShockTubeDelay
measurements with Simulation=’conc’, this is the critical species mole fraction at which the delay occurs.Reac(tion): For
ReactionRateAtCondition
measurements, the reaction whose rate constant is measured. For other measurements based onReactionRateBase
experiments, the reaction whose rate constant appears in the numerator.Reac(tion_)denom(inator): For other measurements based on
ReactionRateBase
, the reaction whose rate constant appears in the denominator.Exp(erimental_)val(ue): The measured value for this measurement.
- Exp(erimental_)unc(ertainty): The uncertainty in the experimentally-measured value
Warning
If Exp_val is present, Exp_unc must also be preseint
Model classes in the Cantera interface¶
Generic interface¶
The generic chemistry interface for Cantera, CanteraChemistryModel
, defines a number of common methods that are used for all Cantera-based simulations. These methods create and modify Cantera phase objects for sensitivity analysis. It defines all of the methods required by a Model
except for evaluate()
.
Laminar flame speeds¶
This model uses a Cantera cantera.FreeFlame
to determine the propagation speed of a freely-propagating laminar flame.
Shock tubes¶
This class of model uses a Cantera cantera.Reactor
, by default a constant volume reactor, as a surrogate for a shock tube. The StateDefinition
is used as the initial state of the reactor.
Shock tube ignition delay time¶
This model finds the ignition delay time \(\tau_{\text{ign}}\) by finding the maximum pressure rise or species concentration production rate, by solving:
where \(X(t)\) is either the pressure or the mole fraction of the critical species in the reactor. Specified with Type = ‘ign’ and Sim = ‘crit’.
Shock tube species profile concentration¶
This model finds the time \(\tau_{\text{ign}}\) at which the critical species concentration reaches a critical value by solving:
where \(X(t)\) is the mole fraction of the critical species in the reactor and \(X_{\text{crit}}\) is the critical value. There is an additional constraint that \(dX/dt\) must be either positive or negative when this occurs. Specified with Type = ‘ign’ and Sim = ‘conc’.
Shock tube species profile time¶
This model finds the critical species mole fraction \(X_{\text{crit}}\) by solving:
where \(X(t)\) is the mole fraction of the critical species in the reactor and \(\tau_{\text{crit}}\) is the integration time. Specified with Type = ‘pro’.
Shock tube species concentration ratio¶
This model finds the critical species mole fraction ratio \(r_{\text{crit}}\) by solving:
where \(X_{\text{num}}(t)\) and \(X_{\text{denom}}(t)\) are the mole fractions of the numerator and denominator species in the reactor and \(tau_{\text{crit}}\) is the integration time. Specified with Type = ‘pul’.
Reaction rate measurements¶
This class of model will directly query the Cantera model for rate constant values and optimize the rate paramters to match that value. There is no Cantera cantera.Reactor
model, but there is a Cantera cantera.Solution
model that represents the chemistry model.
Reaction rate at specified condition¶
This model specifies the measurement of a rate constant at a particular condition, \(k(T,P,X)\).
Reaction rate at specified condition¶
This model specifies the ratio of two rates at a particular condition, \(k_{num}(T,P,X)/k_{den}(T,P,X)\)
Reaction rate A-factor ratio¶
This model specifies the ratio of two reaction rate A factors, regardless of condition, \(A_{num}/A_{den}\)
Reaction rate activation energy difference¶
This model specifies the difference between two reaction rate activation energies, regardless of condition, \(E_{num} - E_{den}\)
Function summary¶
Generic chemistry model summary¶
CanteraChemistryModel (T, Patm, composition, …) |
A class for Cantera chemistry models. |
CanteraChemistryModel.sensitivity (…[, tq]) |
Evaluates the sensitivity of the model value with respect to the model parameters |
CanteraChemistryModel.get_parameter (parameter_id) |
Retrieves a model parameter’s value. |
CanteraChemistryModel.perturb_parameter (…) |
Replaces a model parameter’s value by a new value. |
CanteraChemistryModel.reset_model () |
Reset all model parameters to their original values |
CanteraChemistryModel.get_model_parameter_info ([…]) |
Gets the list of available parameters for this model |
CanteraChemistryModel.prepare_chemistry ([…]) |
Instantiate the Cantera chemistry model and get information about the reaction model. |
CanteraChemistryModel.initialize_chemistry () |
Create the Cantera phase object and set its initial state |
CanteraChemistryModel.blank_chemistry () |
Erase the Cantera phase object, Cantera reactor object, and Cantera simulation object. |
StateDefinition (T, Patm, composition) |
A top level class for a thermodynamic state definition of an ideal gas |
Laminar flame speed summary¶
FlameSpeed (T, Patm, composition, chemistry_model) |
A model for laminar flame speed |
FlameSpeed.evaluate () |
Compute the laminar flame speed |
FlameSpeed.initialize_reactor () |
Initialize the freely-propagating laminar flame object |
Shock tube summary¶
ShockTube (T, Patm, composition, …[, loglevel]) |
A class for defining shock tube simulations. |
ShockTube.initialize_reactor () |
Initialize the shock tube. |
ShockTube.reset_model () |
Reset all model parameters to their original values |
Shock tube delay summary¶
ShockTubeDelay (T, Patm, composition, …[, …]) |
A model for determining the delay time in shock tube ignition |
ShockTubeDelay.evaluate () |
Finds the ignition delay time |
Shock tube concentration summary¶
ShockTubeConcentration (T, Patm, composition, …) |
A model for determining the concentration of a particular species after a certain integration time. |
ShockTubeConcentration.evaluate () |
Calculates the concentration of the critical species at the specified integration time |
Shock tube concentration ratio summary¶
ShockTubeRatio (T, Patm, composition, …[, …]) |
A model for determining the mole fration ratios of two particular species after a certain integration time. |
ShockTubeRatio.evaluate () |
Compute the concentration of the critical species |
Reaction rate summary¶
Base reaction rate class¶
RxnMeasurement ([name, model, value, …]) |
A special class for optimizing reaction rate measurements. |
RxnMeasurement.make_response () |
Generates a sensitivity_analysis_based response surface for this measurement |
ReactionRateBase (T, Patm, composition, …) |
The base class for optimizing reaction rates. |
ReactionRateBase.sensitivity (perturbation, …) |
Evaluates the sensitivity of the reaction rate with respect to the model parameters |
Reaction rate subclasses¶
ReactionRateAtCondition (T, Patm, …[, …]) |
A class that will specify a rate constant at a particular temperature and pressure. |
ReactionRateRatioAtCondition (T, Patm, …[, …]) |
A class that will specify a ratio of two rate constants at a particular temperature and pressure. |
ReactionARatio (T, Patm, composition, …[, …]) |
A class that will specify the ratio of A-factors for two reactions |
ReactionEDiff (T, Patm, composition, …[, …]) |
A class that will specify the difference between activation energies for two reactions |