
:html_theme.sidebar_secondary.remove:

.. py:currentmodule:: cantera


.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/python/onedim/stagnation_flame.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_python_onedim_stagnation_flame.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_python_onedim_stagnation_flame.py:


Detached flat flame stabilized at a stagnation point
====================================================

This script simulates a lean hydrogen-oxygen flame stabilized in a strained
flowfield at an axisymmetric stagnation point on a non-reacting surface. The
solution begins with a flame attached to the inlet (burner), and the mass flow
rate is progressively increased, causing the flame to detach and move closer
to the surface.

This example illustrates use of the new 'prune' grid refinement parameter,
which allows grid points to be removed if they are no longer required to
resolve the solution. This is important here, since the flamefront moves as
the mass flowrate is increased. Without using 'prune', a large number of grid
points would be concentrated upstream of the flame, where the flamefront had
been previously. (To see this, try setting prune to zero.)

Requires: cantera >= 3.0, matplotlib >= 2.0

.. tags:: Python, combustion, 1D flow, premixed flame, strained flame

.. GENERATED FROM PYTHON SOURCE LINES 22-27

.. code-block:: Python


    from pathlib import Path
    import matplotlib.pyplot as plt
    import cantera as ct








.. GENERATED FROM PYTHON SOURCE LINES 28-30

Parameter Values
----------------

.. GENERATED FROM PYTHON SOURCE LINES 30-52

.. code-block:: Python

    p = 0.05 * ct.one_atm  # pressure
    tburner = 373.0  # burner temperature
    tsurf = 500.0

    # each mdot value will be solved to convergence, with grid refinement, and
    # then that solution will be used for the next mdot
    mdot = [0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12]  # kg/m^2/s

    rxnmech = 'h2o2.yaml'  # reaction mechanism file
    comp = 'H2:1.8, O2:1, AR:7'  # premixed gas composition

    # The solution domain is chosen to be 20 cm
    width = 0.2  # m

    loglevel = 1  # amount of diagnostic output (0 to 5)

    # Grid refinement parameters
    ratio = 3
    slope = 0.1
    curve = 0.2
    prune = 0.06








.. GENERATED FROM PYTHON SOURCE LINES 53-55

Set Up the Problem
------------------

.. GENERATED FROM PYTHON SOURCE LINES 55-77

.. code-block:: Python

    gas = ct.Solution(rxnmech)

    # set state to that of the unburned gas at the burner
    gas.TPX = tburner, p, comp

    # Create the stagnation flow object with a non-reactive surface.  (To make the
    # surface reactive, supply a surface reaction mechanism. See example
    # catalytic_combustion.py for how to do this.)
    sim = ct.ImpingingJet(gas=gas, width=width)

    # set the mass flow rate at the inlet
    sim.inlet.mdot = mdot[0]

    # set the surface state
    sim.surface.T = tsurf

    sim.set_grid_min(1e-4)
    sim.set_refine_criteria(ratio=ratio, slope=slope, curve=curve, prune=prune)

    sim.set_initial_guess(products='equil')  # assume adiabatic equilibrium products
    sim.show()





.. rst-class:: sphx-glr-script-out

 .. code-block:: none



    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> inlet <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        Mass Flux:         0.06 kg/m^2/s 
        Temperature:        373 K 
        Mass Fractions: 
                          H2     0.01151 
                          O2      0.1015 
                          AR       0.887 



    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> flame <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        Pressure:        5066 Pa

    -------------------------------------------------------------------------------
              z    velocity  spreadRate           T      Lambda      eField 
    -------------------------------------------------------------------------------
              0       1.142           0         373           0           0 
           0.04      0.9133           0        1559           0           0 
           0.08       0.685           0        2153           0           0 
           0.12      0.4567           0        2153           0           0 
           0.16      0.2283           0        1602           0           0 
            0.2           0           0         500           0           0 

    -------------------------------------------------------------------------------
              z          Uo          H2           H           O          O2 
    -------------------------------------------------------------------------------
              0           0     0.01151           0           0      0.1015 
           0.04           0     0.00408   2.922e-05    0.000304     0.04156 
           0.08           0    0.000365   4.383e-05    0.000456     0.01159 
           0.12           0    0.000365   4.383e-05    0.000456     0.01159 
           0.16           0    0.000365   4.383e-05    0.000456     0.01159 
            0.2           0    0.000365   4.383e-05    0.000456     0.01159 

    -------------------------------------------------------------------------------
              z          OH         H2O         HO2        H2O2          AR 
    -------------------------------------------------------------------------------
              0           0           0           0           0       0.887 
           0.04    0.001912     0.06512   2.517e-07   9.293e-09       0.887 
           0.08    0.002868     0.09768   3.776e-07   1.394e-08       0.887 
           0.12    0.002868     0.09768   3.776e-07   1.394e-08       0.887 
           0.16    0.002868     0.09768   3.776e-07   1.394e-08       0.887 
            0.2    0.002868     0.09768   3.776e-07   1.394e-08       0.887 

    -------------------------------------------------------------------------------
              z          N2 
    -------------------------------------------------------------------------------
              0           0 
           0.04           0 
           0.08           0 
           0.12           0 
           0.16           0 
            0.2           0 


    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> surface <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        Temperature:        500 K 





.. GENERATED FROM PYTHON SOURCE LINES 78-80

Solve the Problem and Write Output
----------------------------------

.. GENERATED FROM PYTHON SOURCE LINES 80-103

.. code-block:: Python

    sim.solve(loglevel, auto=True)

    output_path = Path() / "stagnation_flame_data"
    output_path.mkdir(parents=True, exist_ok=True)

    if "native" in ct.hdf_support():
        output = output_path / "stagnation_flame.h5"
    else:
        output = output_path / "stagnation_flame.yaml"
    output.unlink(missing_ok=True)

    results = []
    for m, md in enumerate(mdot):
        sim.inlet.mdot = md
        sim.solve(loglevel)
        results.append(sim.to_array())
        sim.save(output, name=f"mdot-{m}", description=f"mdot = {md} kg/m2/s")

        # write the velocity, temperature, and mole fractions to a CSV file
        sim.save(output_path / f"stagnation_flame_{m}.csv", basis="mole", overwrite=True)

    sim.show_stats()





.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    ************ Solving on 6 point grid with energy equation enabled ************

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0001709  log(ss)= 4.892     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [6] point grid(s).
    grid refinement disabled.

    ******************** Solving with grid refinement enabled ********************

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [6] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0002563  log(ss)= 5.119     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.004379   log(ss)= 4.025     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [11] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 5 6 7 8 9 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.931     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [21] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 15 16 17 18 19 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.565     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [30] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 24 25 26 27 28 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [40] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 5 33 34 35 36 37 38 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [52] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 5 6 7 8 48 49 50 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [64] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 62 
        to resolve H2O2 HO2 OH spreadRate 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [70] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 0 1 2 3 4 5 6 
        to resolve H2O2 HO2 OH 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [77] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [77] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [77] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 14 15 16 17 18 26 27 30 31 
        to resolve AR H H2O H2O2 O O2 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [86] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 20 
        to resolve H2O2 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [87] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.361     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.006568   log(ss)= 4.011     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.1122     log(ss)= 1.144     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [87] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 25 26 27 28 29 36 37 38 39 40 41 42 43 44 45 46 47 48 50 78 83 84 85 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T spreadRate velocity 
    ##############################################################################
    refine: discarding point at 0.00015625000000000003
    refine: discarding point at 0.0004687500000000001
    refine: discarding point at 0.0007812500000000002
    refine: discarding point at 0.00109375
    refine: discarding point at 0.0014062500000000004
    refine: discarding point at 0.0017187500000000002
    refine: discarding point at 0.00203125

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [103] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 46 47 48 49 50 51 52 53 54 55 56 57 58 59 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH 
    ##############################################################################
    refine: discarding point at 0.00031250000000000006
    refine: discarding point at 0.0009375000000000002
    refine: discarding point at 0.0015625000000000003
    refine: discarding point at 0.0021875
    refine: discarding point at 0.0025000000000000005
    refine: discarding point at 0.0028125000000000008
    refine: discarding point at 0.0031250000000000006
    refine: discarding point at 0.0040625
    refine: discarding point at 0.004687500000000001
    refine: discarding point at 0.005312500000000001
    refine: discarding point at 0.005937500000000002

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [106] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 39 40 41 42 43 44 48 49 50 51 52 55 56 57 58 59 60 61 62 63 66 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH point 63 
    ##############################################################################
    refine: discarding point at 0.0006250000000000001
    refine: discarding point at 0.0023437500000000003
    refine: discarding point at 0.0032812500000000003
    refine: discarding point at 0.005000000000000001
    refine: discarding point at 0.006250000000000001
    refine: discarding point at 0.006875000000000001
    refine: discarding point at 0.0075000000000000015
    refine: discarding point at 0.00875

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [119] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 43 44 45 56 57 58 73 74 
        to resolve H H2 H2O H2O2 O O2 point 74 
    ##############################################################################
    refine: discarding point at 0.0026562500000000006
    refine: discarding point at 0.0034375000000000005
    refine: discarding point at 0.006562500000000001
    refine: discarding point at 0.009375000000000001
    refine: discarding point at 0.010000000000000002
    refine: discarding point at 0.010625000000000002
    refine: discarding point at 0.011250000000000003

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [120] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 58 59 74 75 76 
        to resolve H2O2 O O2 point 74 
    ##############################################################################
    refine: discarding point at 0.0018750000000000004
    refine: discarding point at 0.0037500000000000007
    refine: discarding point at 0.008125
    refine: discarding point at 0.009687500000000002
    refine: discarding point at 0.011562500000000003
    refine: discarding point at 0.012187500000000004

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [119] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 56 76 
        to resolve H2O2 point 76 
    ##############################################################################
    refine: discarding point at 0.010937500000000003
    refine: discarding point at 0.012500000000000002
    refine: discarding point at 0.013125000000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [118] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 55 
        to resolve H2O2 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [119] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.284     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.006568   log(ss)= 4.056     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.03325    log(ss)= 2.127     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [119] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 62 63 64 65 69 70 71 72 73 74 75 76 77 78 79 80 81 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.013437500000000002
    refine: discarding point at 0.014062500000000002
    refine: discarding point at 0.014687500000000003
    refine: discarding point at 0.015312500000000001
    refine: discarding point at 0.0159375
    refine: discarding point at 0.0165625
    refine: discarding point at 0.0171875
    refine: discarding point at 0.017812500000000002
    refine: discarding point at 0.018437500000000002
    refine: discarding point at 0.019062500000000003
    refine: discarding point at 0.019687500000000004
    refine: discarding point at 0.020312500000000004
    refine: discarding point at 0.020937500000000005
    refine: discarding point at 0.021562500000000005
    refine: discarding point at 0.022187500000000006
    refine: discarding point at 0.022812500000000006
    refine: discarding point at 0.023437500000000007
    refine: discarding point at 0.024062500000000007
    refine: discarding point at 0.024687500000000008
    refine: discarding point at 0.0253125
    refine: discarding point at 0.025937500000000002
    refine: discarding point at 0.026562500000000003
    refine: discarding point at 0.027187500000000003

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [113] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 47 58 59 60 61 62 63 64 65 66 67 68 69 70 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.012812500000000001
    refine: discarding point at 0.014375000000000002
    refine: discarding point at 0.015625
    refine: discarding point at 0.016875
    refine: discarding point at 0.018125000000000002
    refine: discarding point at 0.019375000000000003
    refine: discarding point at 0.020625000000000004
    refine: discarding point at 0.021875000000000006
    refine: discarding point at 0.023125000000000007
    refine: discarding point at 0.024375000000000008
    refine: discarding point at 0.025625000000000002
    refine: discarding point at 0.027500000000000004

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [115] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 
        to resolve AR H H2 H2O H2O2 O O2 
    ##############################################################################
    refine: discarding point at 0.027812500000000004
    refine: discarding point at 0.029375000000000005

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [129] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 69 70 
        to resolve H2O2 
    ##############################################################################
    refine: discarding point at 0.03125
    refine: discarding point at 0.031875

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [129] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 71 79 80 
        to resolve AR H2O2 
    ##############################################################################
    refine: discarding point at 0.030625000000000003
    refine: discarding point at 0.0321875

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [130] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.236     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.006568   log(ss)= 3.98      

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.1122     log(ss)= 1.101     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [130] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 71 72 73 74 75 82 83 84 85 86 87 88 89 90 91 93 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.015000000000000003
    refine: discarding point at 0.0175
    refine: discarding point at 0.020000000000000004
    refine: discarding point at 0.022500000000000006
    refine: discarding point at 0.026250000000000002
    refine: discarding point at 0.028125000000000004
    refine: discarding point at 0.0328125
    refine: discarding point at 0.0334375
    refine: discarding point at 0.0340625
    refine: discarding point at 0.0346875
    refine: discarding point at 0.035312500000000004
    refine: discarding point at 0.035937500000000004
    refine: discarding point at 0.036562500000000005
    refine: discarding point at 0.037187500000000005
    refine: discarding point at 0.037812500000000006
    refine: discarding point at 0.038437500000000006
    refine: discarding point at 0.03906250000000001
    refine: discarding point at 0.03968750000000001
    refine: discarding point at 0.04031250000000001
    refine: discarding point at 0.04093750000000001
    refine: discarding point at 0.04156250000000001
    refine: discarding point at 0.04218750000000001
    refine: discarding point at 0.04281250000000001
    refine: discarding point at 0.04343750000000001
    refine: discarding point at 0.04406250000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [121] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 56 70 71 72 73 74 75 76 77 78 79 80 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.0325
    refine: discarding point at 0.03375
    refine: discarding point at 0.035
    refine: discarding point at 0.036250000000000004
    refine: discarding point at 0.037500000000000006
    refine: discarding point at 0.03875000000000001
    refine: discarding point at 0.04000000000000001
    refine: discarding point at 0.04125000000000001
    refine: discarding point at 0.04250000000000001
    refine: discarding point at 0.04437500000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [123] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 48 69 70 71 72 73 74 75 76 77 78 79 80 
        to resolve AR H H2 H2O H2O2 HO2 O O2 
    ##############################################################################
    refine: discarding point at 0.034375
    refine: discarding point at 0.036875000000000005
    refine: discarding point at 0.03937500000000001
    refine: discarding point at 0.04312500000000001
    refine: discarding point at 0.04500000000000001
    refine: discarding point at 0.04562500000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [130] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 72 
        to resolve H2O2 
    ##############################################################################
    refine: discarding point at 0.04468750000000001
    refine: discarding point at 0.04593750000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [129] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.187     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.006568   log(ss)= 3.85      

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.04988    log(ss)= 2.382     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [129] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 73 74 75 76 77 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 
        to resolve AR H H2 H2O H2O2 HO2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.046562500000000014
    refine: discarding point at 0.047187500000000014
    refine: discarding point at 0.047812500000000015
    refine: discarding point at 0.048437500000000015
    refine: discarding point at 0.049062500000000016
    refine: discarding point at 0.04968750000000001
    refine: discarding point at 0.05031250000000001
    refine: discarding point at 0.050937500000000004
    refine: discarding point at 0.051562500000000004
    refine: discarding point at 0.052187500000000005
    refine: discarding point at 0.052812500000000005
    refine: discarding point at 0.053437500000000006
    refine: discarding point at 0.054062500000000006
    refine: discarding point at 0.05468750000000001
    refine: discarding point at 0.05531250000000001
    refine: discarding point at 0.05593750000000001
    refine: discarding point at 0.05656250000000001
    refine: discarding point at 0.05718750000000001
    refine: discarding point at 0.05781250000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [130] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 80 81 82 83 84 85 86 87 88 89 
        to resolve AR H H2 H2O H2O2 O O2 OH T velocity 
    ##############################################################################
    refine: discarding point at 0.04625000000000001
    refine: discarding point at 0.047500000000000014
    refine: discarding point at 0.048750000000000016
    refine: discarding point at 0.05000000000000001
    refine: discarding point at 0.051250000000000004
    refine: discarding point at 0.052500000000000005
    refine: discarding point at 0.053750000000000006
    refine: discarding point at 0.05500000000000001
    refine: discarding point at 0.05625000000000001
    refine: discarding point at 0.05843750000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [130] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 82 83 84 85 86 87 
        to resolve AR H H2 H2O O O2 
    ##############################################################################
    refine: discarding point at 0.048125000000000015
    refine: discarding point at 0.050625
    refine: discarding point at 0.053125000000000006
    refine: discarding point at 0.05687500000000001

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [132] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 39 50 51 
        to resolve H2O2 HO2 
    ##############################################################################

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [135] point grid(s).
    no new points needed in flame

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.0003844  log(ss)= 4.15      

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve failed.

    Attempt 10 timesteps.
    Final timestep info: dt= 0.006568   log(ss)= 3.794     

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [135] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 77 78 79 80 81 82 83 84 85 86 87 88 93 94 95 96 97 104 
        to resolve AR H H2 H2O H2O2 O O2 OH velocity 
    ##############################################################################
    refine: discarding point at 0.05875000000000001
    refine: discarding point at 0.05937500000000001
    refine: discarding point at 0.06000000000000001
    refine: discarding point at 0.06062500000000001
    refine: discarding point at 0.061250000000000006
    refine: discarding point at 0.061875
    refine: discarding point at 0.0625
    refine: discarding point at 0.063125
    refine: discarding point at 0.06375
    refine: discarding point at 0.064375
    refine: discarding point at 0.065
    refine: discarding point at 0.065625

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [141] point grid(s).
    ##############################################################################
    Refining grid in flame.
        New points inserted after grid points 89 96 97 98 99 100 101 
        to resolve AR H H2 H2O H2O2 O O2 
    ##############################################################################
    refine: discarding point at 0.05812500000000001
    refine: discarding point at 0.05968750000000001
    refine: discarding point at 0.060937500000000006
    refine: discarding point at 0.0621875
    refine: discarding point at 0.06343750000000001
    refine: discarding point at 0.06468750000000001
    refine: discarding point at 0.06625

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [141] point grid(s).
    no new points needed in flame
    refine: discarding point at 0.06031250000000001
    refine: discarding point at 0.0628125

    Attempt Newton solution of steady-state problem.
    Newton steady-state solve succeeded.

    Problem solved on [139] point grid(s).
    no new points needed in flame

    Statistics:

     Grid   Timesteps  Functions      Time  Jacobians      Time
        8           0        226    0.0093          8    0.0118
       13          20        375    0.0282          9    0.0267
       23          10        142    0.0207          4    0.0244
       32          10         86    0.0185          3    0.0262
       42           0         14    0.0041          1    0.0118
       54           0         18    0.0069          1    0.0156
       66           0         10    0.0045          1    0.0195
       72           0          8    0.0039          1    0.0213
       79           0          6    0.0032          1    0.0236
       79           0          2    0.0011          1    0.0237
       79           0         26    0.0142          1    0.0236
       88           0          6    0.0036          1    0.0264
       89           0          4    0.0025          1    0.0266
       89          30        368    0.2257         11    0.2935
      105           0         97    0.0704          4    0.1266
      108           0         31    0.0232          2    0.0655
      121           0         38    0.0317          1    0.0371
      122           0         32    0.0268          1    0.0373
      121           0         32    0.0266          1    0.0370
      120           0         28    0.0234          1    0.0366
      121           0         24    0.0200          1    0.0370
      121          30        367    0.3062         14    0.5196
      115           0         20    0.0161          1    0.0350
      117           0         26    0.0208          1    0.0355
      131           0         28    0.0257          1    0.0401
      131           0         24    0.0221          1    0.0401
      132           0         14    0.0129          1    0.0406
      132          30        343    0.3122         13    0.5303
      123           0         20    0.0170          1    0.0375
      125           0         22    0.0188          1    0.0380
      132           0         26    0.0236          1    0.0401
      131           0         18    0.0160          1    0.0401
      131          30        472    0.4276         17    0.6894
      132           0         16    0.0145          1    0.0403
      132           0         20    0.0184          1    0.0402
      134           0         22    0.0203          1    0.0409
      137           0         18    0.0168          1    0.0420
      137          20        268    0.2517         11    0.4659
      143           0         24    0.0230          1    0.0430
      143           0         20    0.0192          1    0.0431
      141           0          2    0.0019          1    0.0430




.. GENERATED FROM PYTHON SOURCE LINES 104-106

Temperature and Heat Release Rate
---------------------------------

.. GENERATED FROM PYTHON SOURCE LINES 106-121

.. code-block:: Python

    fig, ax1 = plt.subplots()
    ax2 = ax1.twinx()
    styles = ['-', '--']
    for n, i in enumerate([1, -1]):
        ax1.plot(results[i].grid, results[i].heat_release_rate / 1e6,
                 linestyle=styles[n], color='C4', label=rf'$\dot m = {mdot[i]:.2f}$ kg/s')
        ax2.plot(results[i].grid, results[i].T,
                 linestyle=styles[n], color='C3', label=rf'$\dot m = {mdot[i]:.2f}$ kg/s')

    ax1.set_ylabel('heat release rate [MW/m³]', color='C4')
    ax1.set(xlabel='distance from inlet [m]')
    ax2.set_ylabel('temperature [K]', color='C3')
    ax2.legend()
    plt.show()




.. image-sg:: /examples/python/onedim/images/sphx_glr_stagnation_flame_001.png
   :alt: stagnation flame
   :srcset: /examples/python/onedim/images/sphx_glr_stagnation_flame_001.png, /examples/python/onedim/images/sphx_glr_stagnation_flame_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 122-124

Major Species Profiles
----------------------

.. GENERATED FROM PYTHON SOURCE LINES 124-138

.. code-block:: Python

    fig, ax = plt.subplots()
    major = ('O2', 'H2', 'H2O')
    states = sim.to_array()
    handles = []
    for n, i in enumerate([1, -1]):
        for k, spec in enumerate(major):
            h = ax.plot(results[i].grid, results[i](spec).X,
                        linestyle=styles[n], color=f'C{k}',
                        label=rf'{spec}, $\dot m = {mdot[i]}$ kg/s')

    ax.set(xlabel='distance from inlet [m]', ylabel='mole fractions')
    ax.legend()
    plt.show()




.. image-sg:: /examples/python/onedim/images/sphx_glr_stagnation_flame_002.png
   :alt: stagnation flame
   :srcset: /examples/python/onedim/images/sphx_glr_stagnation_flame_002.png, /examples/python/onedim/images/sphx_glr_stagnation_flame_002_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 139-141

Minor Species Profiles
----------------------

.. GENERATED FROM PYTHON SOURCE LINES 141-154

.. code-block:: Python

    fig, ax = plt.subplots()
    minor = ('OH', 'H', 'O')
    states = sim.to_array()
    handles = []
    for n, i in enumerate([1, -1]):
        for k, spec in enumerate(minor):
            h = ax.plot(results[i].grid, results[i](spec).X,
                        linestyle=styles[n], color=f'C{k+5}',
                        label=rf'{spec}, $\dot m = {mdot[i]}$ kg/s')

    ax.set(xlabel='distance from inlet [m]', ylabel='mole fractions')
    ax.legend()
    plt.show()



.. image-sg:: /examples/python/onedim/images/sphx_glr_stagnation_flame_003.png
   :alt: stagnation flame
   :srcset: /examples/python/onedim/images/sphx_glr_stagnation_flame_003.png, /examples/python/onedim/images/sphx_glr_stagnation_flame_003_2_00x.png 2.00x
   :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 8.856 seconds)


.. _sphx_glr_download_examples_python_onedim_stagnation_flame.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: stagnation_flame.ipynb <stagnation_flame.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: stagnation_flame.py <stagnation_flame.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: stagnation_flame.zip <stagnation_flame.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
