.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/thermodynamics/cycles/plot_05_diesel_cycle.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_thermodynamics_cycles_plot_05_diesel_cycle.py: Diesel's compression-ignition cycle (1893) ========================================== Rudolf Diesel's *Theorie und Konstruktion eines rationellen Wärmemotors* (1893) set out to approach Carnot's efficiency by compressing air alone so hard that injected fuel ignites by itself. Because there is no fuel in the cylinder during compression, a diesel cannot knock and can use compression ratios of 15-22. The fuel burns while the piston moves, which the air-standard Diesel cycle idealizes as heat added at constant pressure up to a cutoff ratio :math:`r_c = v_3/v_2` (:func:`~engineeringkit.thermodynamics.diesel_efficiency`). .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.thermodynamics import diesel_efficiency, isentropic_temperature_ratio, otto_efficiency, thermal_efficiency .. GENERATED FROM PYTHON SOURCE LINES 22-27 Four states from the first law ------------------------------ Compression ratio 18, cutoff ratio 2. Heat in is :math:`c_p(T_3 - T_2)` at constant pressure, heat out :math:`c_v(T_4 - T_1)` at constant volume. .. GENERATED FROM PYTHON SOURCE LINES 27-39 .. code-block:: Python R, gamma, r, rc, T1 = 287.0, 1.4, 18.0, 2.0, 300.0 cv, cp = R / (gamma - 1), gamma * R / (gamma - 1) T2 = T1 * r ** (gamma - 1) T3 = T2 * rc T4 = T3 * (rc / r) ** (gamma - 1) eta = thermal_efficiency(cp * (T3 - T2), cv * (T4 - T1)) print(f"T2 = {T2:.0f} K (autoignition), T3 = {T3:.0f} K, T4 = {T4:.0f} K") print(f"efficiency from the states {eta:.4f}, from the formula {diesel_efficiency(r, rc):.4f}") assert np.isclose(eta, diesel_efficiency(r, rc)) assert np.isclose(T2 / T1, isentropic_temperature_ratio(r**gamma, gamma)) .. rst-class:: sphx-glr-script-out .. code-block:: none T2 = 953 K (autoignition), T3 = 1907 K, T4 = 792 K efficiency from the states 0.6316, from the formula 0.6316 .. GENERATED FROM PYTHON SOURCE LINES 40-47 Diesel against Otto ------------------- At the *same* compression ratio the Otto cycle wins: constant-pressure heat addition takes in part of the heat at a lower temperature. A longer cutoff (more fuel, more power) costs efficiency. But a diesel at 18 beats a petrol engine held to 10 by knock. .. GENERATED FROM PYTHON SOURCE LINES 47-62 .. code-block:: Python ratios = np.linspace(5, 24, 96) fig, ax = plt.subplots(figsize=(6, 3.5)) ax.plot(ratios, otto_efficiency(ratios), "k", label="Otto ($r_c$ = 1)") for cutoff in (1.5, 2.0, 3.0): ax.plot(ratios, [diesel_efficiency(x, cutoff) for x in ratios], label=f"Diesel, $r_c$ = {cutoff:g}") ax.plot(10, otto_efficiency(10), "s", color="C3", label="petrol engine limited by knock") ax.plot(r, diesel_efficiency(r, rc), "o", color="C1", label="diesel at r = 18") ax.set(xlabel="compression ratio", ylabel="ideal efficiency", ylim=(0.4, 0.75)) ax.legend(fontsize=8) fig.tight_layout() assert all(diesel_efficiency(x, 2.0) < otto_efficiency(x) for x in ratios) assert diesel_efficiency(r, rc) > otto_efficiency(10) plt.show() .. image-sg:: /api/gallery/thermodynamics/cycles/images/sphx_glr_plot_05_diesel_cycle_001.png :alt: plot 05 diesel cycle :srcset: /api/gallery/thermodynamics/cycles/images/sphx_glr_plot_05_diesel_cycle_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.046 seconds) .. _sphx_glr_download_api_gallery_thermodynamics_cycles_plot_05_diesel_cycle.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/thermodynamics/cycles/plot_05_diesel_cycle.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_diesel_cycle.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_diesel_cycle.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_05_diesel_cycle.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_