.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/materials/plot_materials_benchmark.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_plot_materials_benchmark.py: Crack size and fracture threshold ================================= With a fixed tensile stress and geometry factor, stress intensity rises with the square root of crack length. Inverting the toughness threshold recovers the critical crack length. Small-scale yielding is assumed. .. GENERATED FROM PYTHON SOURCE LINES 9-28 .. image-sg:: /api/gallery/materials/images/sphx_glr_plot_materials_benchmark_001.png :alt: plot materials benchmark :srcset: /api/gallery/materials/images/sphx_glr_plot_materials_benchmark_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.materials import critical_crack_length, stress_intensity sigma, Y, Kic = 100e6, 1.12, 50e6 critical = critical_crack_length(Kic, sigma, Y) a = np.linspace(1e-6, 1.5 * critical, 201) K = np.array([stress_intensity(Y, sigma, ai) for ai in a]) assert np.isclose(stress_intensity(Y, sigma, critical), Kic) fig, ax = plt.subplots() ax.plot(a * 1000, K / 1e6) ax.axhline(Kic / 1e6, color="black", linestyle="--", label="toughness") ax.axvline(critical * 1000, color="gray", linestyle=":", label="critical crack") ax.set(xlabel="crack length [mm]", ylabel="stress intensity [MPa sqrt(m)]") ax.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.078 seconds) .. _sphx_glr_download_api_gallery_materials_plot_materials_benchmark.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/plot_materials_benchmark.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_materials_benchmark.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_materials_benchmark.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_materials_benchmark.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_