.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_tip_area_models.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_tip_area_models.py: Tip Area Models =============== This example compares projected contact area for a perfect Berkovich tip, an ISO-style calibrated area function, and a spherical tip. .. GENERATED FROM PYTHON SOURCE LINES 8-14 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from micromechanics.indentation import Tip .. GENERATED FROM PYTHON SOURCE LINES 15-18 The projected contact area is evaluated as a function of contact depth. All depths passed to ``areaFunction`` are in micrometers, while the calibrated prefactors are stored in the unit convention used by the indentation package. .. GENERATED FROM PYTHON SOURCE LINES 18-21 .. code-block:: Python contact_depth = np.linspace(0.01, 0.8, 120) .. GENERATED FROM PYTHON SOURCE LINES 22-25 A perfect Berkovich tip is the usual analytical reference. The ISO-style tip uses a polynomial area function, and the spherical model is useful for blunt tips or rounded apex behavior at shallow depth. .. GENERATED FROM PYTHON SOURCE LINES 25-30 .. code-block:: Python perfect = Tip("perfect") iso = Tip(shape=[24.5, 420.0, -30.0]) sphere = Tip(shape=[3.0, 70.3, "sphere"]) .. GENERATED FROM PYTHON SOURCE LINES 31-34 Larger area at a given depth means the same load would produce a lower hardness. Comparing area functions is therefore a direct way to inspect how a tip calibration changes the mechanical result. .. GENERATED FROM PYTHON SOURCE LINES 34-47 .. code-block:: Python area_perfect = perfect.areaFunction(contact_depth.copy()) area_iso = iso.areaFunction(contact_depth.copy()) area_sphere = sphere.areaFunction(contact_depth.copy()) fig, ax = plt.subplots() ax.plot(contact_depth, area_perfect, label="perfect Berkovich") ax.plot(contact_depth, area_iso, label="ISO area function") ax.plot(contact_depth, area_sphere, label="spherical cap") ax.set_xlabel(r"contact depth [$\mathrm{\mu m}$]") ax.set_ylabel(r"projected contact area [$\mathrm{\mu m^2}$]") ax.legend() .. image-sg:: /auto_examples/images/sphx_glr_plot_tip_area_models_001.png :alt: plot tip area models :srcset: /auto_examples/images/sphx_glr_plot_tip_area_models_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 48-49 The inverse area function maps a measured contact area back to contact depth. .. GENERATED FROM PYTHON SOURCE LINES 49-53 .. code-block:: Python known_area = perfect.areaFunction(np.array([0.35])) recovered_depth = perfect.areaFunctionInverse(known_area) print(f"Use initial depth 0.35um and recovered depth for the perfect tip: {recovered_depth[0]:.3f} um") .. rst-class:: sphx-glr-script-out .. code-block:: none Use initial depth 0.35um and recovered depth for the perfect tip: 0.350 um .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.068 seconds) .. _sphx_glr_download_auto_examples_plot_tip_area_models.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_tip_area_models.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_tip_area_models.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_tip_area_models.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_