:orphan:

C++ Examples
============

.. seealso::

    For some guidance getting started with the Cantera C++ interface, please see the
    :doc:`C++ Tutorial </userguide/cxx-tutorial>`.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Defines some functions used by kinetics1. ">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_example_utils_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_example_utils.h`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Example utilities</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Calculate the thermodynamic states and efficiency of an open Rankine cycle using a pure substance model for water.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_rankine_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_rankine.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Open Rankine cycle</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Calculate the open-circuit potential of an LiC6 electrode and activity coefficients of each species as a function of the mole fraction of intercalated lithium.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_LiC6_electrode_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_LiC6_electrode.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">LiC6 electrode</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example simulates autoignition of hydrogen in a constant pressure reactor and saves the time history to files that can be used for plotting.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_kinetics1_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_kinetics1.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Autoignition in a homogeneous reactor</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Construct a gas phase Solution object and use it to compute viscosity, thermal conductivity, mixture-averaged diffusion coefficients, and thermal diffusivities for a range of temperatures.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_gas_transport_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_gas_transport.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Gas phase transport properties</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to use OpenMP to run multiple reactor network calculations in parallel by using separate Cantera objects for each thread.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_openmp_ignition_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_openmp_ignition.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Ignition delay calculation with OpenMP</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example solves the Blasius boundary value problem for the velocity profile of a laminar boundary layer over a flat plate. It uses class BoundaryValueProblem, defined in BoundaryValueProblem, which provides a simplified interface to the boundary value problem capabilities of Cantera.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_blasius_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_blasius.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Blasius BVP solver</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This demonstration program builds an object representing a reacting gas mixture, and uses it to compute thermodynamic properties, chemical equilibrium, and transport properties.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_demo_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_demo.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Property calculation demo</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Two separate streams - one pure methane and the other air, both at 300 K and 1 atm flow into an adiabatic combustor where they mix. We are interested in the steady-state burning solution. Since at 300 K no reaction will occur between methane and air, we need to use an &#x27;igniter&#x27; to initiate the chemistry. A simple igniter is a pulsed flow of atomic hydrogen. After the igniter is turned off, the system approaches the steady burning solution.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_combustor_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_combustor.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Adiabatic combustor</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="C++ demo program to compute flame speeds using GRI-Mech.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_flamespeed_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_flamespeed.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Freely-propagating flame</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Calculate derivatives of reaction rates of progress and species production and destruction rates with respect to temperature, pressure, molar concentration, and mole fractions. Time evaluation for different chemical mechanisms.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_derivative_speed_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_derivative_speed.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Benchmark derivative evaluations</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Solve a closed-system constant pressure ignition problem where the governing equations are custom-implemented, using Cantera&#x27;s interface to CVODES to integrate the equations.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_custom_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_custom.cpp`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Custom reactor</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simplified interface to the capabilities provided by Cantera to solve boundary value problems. See blasius for an example using this class.">

.. only:: html

  .. image:: /examples/cxx/images/thumb/sphx_glr_BoundaryValueProblem_thumb.png
    :alt:

  :ref:`sphx_glr_examples_cxx_BoundaryValueProblem.h`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Class BoundaryValueProblem</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /examples/cxx/example_utils
   /examples/cxx/rankine
   /examples/cxx/LiC6_electrode
   /examples/cxx/kinetics1
   /examples/cxx/gas_transport
   /examples/cxx/openmp_ignition
   /examples/cxx/blasius
   /examples/cxx/demo
   /examples/cxx/combustor
   /examples/cxx/flamespeed
   /examples/cxx/derivative_speed
   /examples/cxx/custom
   /examples/cxx/BoundaryValueProblem


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

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

      :download:`Download all examples as source code: cxx.zip </examples/cxx/cxx.zip>`


.. only:: html

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

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