Sequential Simulations (multirun)ΒΆ

This example shows how to simulate a sequence of steady flames at a range of strain rate values.

example_multirun.py:

#!/usr/bin/python
"""
Lean methane mixture opposing hot equilibrium products in the planar opposed jet
configuration. Demonstration of option to run a select set of strain rates in list
order, using the converged profile from the previous strain rate as the initial
profile for the following strain rate.
"""

from ember import *
import multiprocessing

conf = Config(
    General(nThreads=multiprocessing.cpu_count()),
    Chemistry(kineticsModel='interp',
              transportModel='Approx'),
    Grid(addPointCount=6),
    Paths(outputDir='run/ex_multirun'),
    InitialCondition(fuel='CH4:1.0',
                     equivalenceRatio=0.75),
    StrainParameters(rates=[4800,2400,1200,600,300]))

if __name__ == '__main__':
    conf.run()

The given configuration parameters override default values. The full set of configuration parameters is described in Configuration Options. Specific parameters of interest in this example:

  • General

    • nThreads - By using the multiprocessing.cpu_count()) function, we always use the maximum number of processors available. Note that for systems with hyperthreading enabled, this will use the total number of virtual cores, which may be less efficient than using the number of physical cores.

  • Chemistry - these alternative kinetic and transport models achieve increases in speed at a small cost in accuracy.

  • StrainParameters

    • rates - A list of strain rates to step through. For the supported opposed flow flame (this example), stepping through strain rates from high to low is usually more computationally efficient. For the unsupported or axisymmetric flame, the strain rates should be specified in increasing order, as the flame will extinguish at a sufficiently strain rate. For each strain rate in this list, the solver will generate a steady-state solution.

The output files for this run, saved in the directory specified by Paths.outputDir, will contain the string epsNNNN where NNNN is the strain rate, e.g. a run at a strain rate of 480 1/s will produce conf_eps0480, log-eps0480.txt, out_eps0480.h5, and prof_eps0480.h5.

Integral output data (strain rate, total heat release rate, flame consumption speed, and flame position) for each strain rate will be written to integral.h5.

To try this example, run the following command:

$ python -m ember.examples.example_multirun

Or copy the example_multirun.py file to another directory, make any modifications you desire, then run:

$ python example_multirun.py