.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/materials/elasticity/plot_02_duhamel_thermal_stress.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_materials_elasticity_plot_02_duhamel_thermal_stress.py: Duhamel's thermal stress (1838) =============================== Jean-Marie Duhamel (1838) added temperature to Navier's equations of elasticity: a change :math:`\Delta T` produces a free strain :math:`\alpha\,\Delta T` (:func:`~engineeringkit.materials.thermal_strain`) that causes no stress if the body can expand, and a stress :math:`-E\alpha\,\Delta T` (:func:`~engineeringkit.materials.constrained_thermal_stress`) if it is held. The stress does not depend on the length of the bar, which is why continuously welded rail must be laid at a chosen neutral temperature. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.materials import constrained_thermal_stress, thermal_strain .. GENERATED FROM PYTHON SOURCE LINES 21-27 Continuously welded rail ------------------------ Rail steel has :math:`E = 210` GPa and :math:`\alpha = 11.5\times10^{-6}`/K. Laid stress-free at 25 °C, it is in compression on hot days and in tension in winter. The total strain, free plus elastic, stays zero. .. GENERATED FROM PYTHON SOURCE LINES 27-34 .. code-block:: Python E, alpha, neutral = 210e9, 11.5e-6, 25.0 T = np.linspace(-20, 60, 81) stress = constrained_thermal_stress(E, alpha, T - neutral) print(f"at 60 C: {stress[-1] / 1e6:.1f} MPa; at -20 C: {stress[0] / 1e6:.1f} MPa") assert np.allclose(thermal_strain(alpha, T - neutral) + stress / E, 0) .. rst-class:: sphx-glr-script-out .. code-block:: none at 60 C: -84.5 MPa; at -20 C: 108.7 MPa .. GENERATED FROM PYTHON SOURCE LINES 35-41 Jointed rail: a gap delays the stress ------------------------------------- Bolted 18 m rails leave a gap of a few millimetres at each joint. The rail expands freely until the gap closes, and only the excess strain is restrained. .. GENERATED FROM PYTHON SOURCE LINES 41-58 .. code-block:: Python length = 18.0 fig, ax = plt.subplots(figsize=(6, 3.8)) ax.plot(T, stress / 1e6, label="welded (no gap)") for gap in (0.003, 0.006): excess = np.maximum(thermal_strain(alpha, T - neutral) - gap / length, 0) jointed = -E * excess closes = neutral + gap / (alpha * length) ax.plot(T, jointed / 1e6, label=f"{1e3 * gap:.0f} mm gap, closes at {closes:.0f} C") assert np.all(jointed[T <= closes] == 0) assert np.allclose(jointed[T > closes], constrained_thermal_stress(E, alpha, T[T > closes] - closes)) ax.axhline(0, color="0.6", lw=0.8) ax.set(xlabel="rail temperature [C]", ylabel="axial stress [MPa]", title="Thermal stress in rail") ax.legend() fig.tight_layout() plt.show() .. image-sg:: /api/gallery/materials/elasticity/images/sphx_glr_plot_02_duhamel_thermal_stress_001.png :alt: Thermal stress in rail :srcset: /api/gallery/materials/elasticity/images/sphx_glr_plot_02_duhamel_thermal_stress_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.034 seconds) .. _sphx_glr_download_api_gallery_materials_elasticity_plot_02_duhamel_thermal_stress.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/materials/elasticity/plot_02_duhamel_thermal_stress.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_duhamel_thermal_stress.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_duhamel_thermal_stress.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_duhamel_thermal_stress.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_