.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/materials/elasticity/plot_01_young_modulus.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_01_young_modulus.py: Young's modulus (1807) ====================== Thomas Young's *Lectures on Natural Philosophy* (1807) gave a single number for the stiffness of a material, its "modulus of elasticity". Young expressed it as the height of a column of the material whose weight would compress it to nothing if the law stayed linear; Navier (1826) restated it as the ratio of stress to strain, :math:`E = \sigma/\varepsilon`, the form used today (:func:`~engineeringkit.materials.hooke_stress`). The example reduces a simulated tensile test from load and extension to stress and strain (:func:`~engineeringkit.materials.normal_stress`, :func:`~engineeringkit.materials.normal_strain`), fits the modulus with :class:`~engineeringkit.materials.StressStrainCurve` and measures the energy the bar absorbs. .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.materials import StressStrainCurve, hooke_stress, normal_strain, normal_stress, resilience_modulus .. GENERATED FROM PYTHON SOURCE LINES 25-31 From the testing machine to the stress-strain curve --------------------------------------------------- A 10 mm steel bar with a 50 mm gauge length yields at 250 MPa and then hardens linearly. The machine records force and extension; dividing by the original area and length gives engineering stress and strain. .. GENERATED FROM PYTHON SOURCE LINES 31-44 .. code-block:: Python E, sy, H = 200e9, 250e6, 1.2e9 area, gauge = np.pi * 0.005**2, 0.050 strain_in = np.concatenate((np.linspace(0, sy / E, 8), np.linspace(sy / E, 0.20, 200)[1:])) stress_in = np.where(strain_in <= sy / E, hooke_stress(E, strain_in), sy + H * (strain_in - sy / E)) force, extension = stress_in * area, strain_in * gauge curve = StressStrainCurve(normal_strain(extension, gauge), normal_stress(force, area)) summary = curve.summary() print(f"fitted E = {summary['young_modulus_Pa'] / 1e9:.1f} GPa, ultimate {summary['ultimate_strength_Pa'] / 1e6:.0f} MPa") print(f"toughness {summary['toughness_J_m3'] / 1e6:.1f} MJ/m^3, resilience {resilience_modulus(sy, E) / 1e3:.1f} kJ/m^3") assert np.isclose(summary["young_modulus_Pa"], E) .. rst-class:: sphx-glr-script-out .. code-block:: none fitted E = 200.0 GPa, ultimate 488 MPa toughness 73.5 MJ/m^3, resilience 156.2 kJ/m^3 .. GENERATED FROM PYTHON SOURCE LINES 45-52 Young's "height of the modulus" ------------------------------- Young's own measure was a length, :math:`E/\rho g`. For steel it is thousands of kilometres. The elastic part of the curve stores the modulus of resilience :math:`\sigma_y^2/2E`, the area of the elastic triangle, which is tiny next to the area under the whole curve. .. GENERATED FROM PYTHON SOURCE LINES 52-68 .. code-block:: Python rho, g = 7850.0, 9.81 print(f"height of the modulus of steel: {E / (rho * g) / 1e3:.0f} km") elastic = StressStrainCurve(curve.strain[:8], curve.stress[:8]) assert np.isclose(elastic.toughness(), resilience_modulus(sy, E)) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 3.6)) curve.plot(ax=ax1) ax1.set_title("tensile test") elastic.plot(ax=ax2) ax2.fill_between(elastic.strain, elastic.stress / 1e6, alpha=0.3, label="resilience") ax2.set_title("elastic region") ax2.legend() fig.tight_layout() plt.show() .. image-sg:: /api/gallery/materials/elasticity/images/sphx_glr_plot_01_young_modulus_001.png :alt: tensile test, elastic region :srcset: /api/gallery/materials/elasticity/images/sphx_glr_plot_01_young_modulus_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none height of the modulus of steel: 2597 km .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.045 seconds) .. _sphx_glr_download_api_gallery_materials_elasticity_plot_01_young_modulus.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_01_young_modulus.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_young_modulus.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_young_modulus.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_young_modulus.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_