.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/Young_3D.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_Young_3D.py: =========================================================== Plot Young modulus as a 3D surface =========================================================== This example shows how to plot the directional dependence of the Young modulus as a 3D surface. .. GENERATED FROM PYTHON SOURCE LINES 9-14 Define the stiffness tensor for NiTi ------------------------------------- We define the stiffness tensor for a monoclinic NiTi material using its elastic constants. They are taken from the `Materials Project (mp-1048) `_. .. GENERATED FROM PYTHON SOURCE LINES 14-24 .. code-block:: Python from elasticipy.tensors.elasticity import StiffnessTensor C = StiffnessTensor.monoclinic( phase_name='TiNi', C11=231, C12=127, C13=104, C22=240, C23=131, C33=175, C44=81, C55=11, C66=85, C15=-18, C25=1, C35=-3, C46=3 ) print(C) .. rst-class:: sphx-glr-script-out .. code-block:: none Stiffness tensor (in Voigt mapping): [[231. 127. 104. 0. -18. 0.] [127. 240. 131. 0. 1. 0.] [104. 131. 175. 0. -3. 0.] [ 0. 0. 0. 81. 0. 3.] [-18. 1. -3. 0. 11. 0.] [ 0. 0. 0. 3. 0. 85.]] Phase: TiNi .. GENERATED FROM PYTHON SOURCE LINES 25-27 Get the Young modulus from the stiffness tensor ------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 27-31 .. code-block:: Python E = C.Young_modulus print("Young's modulus:") print(E) .. rst-class:: sphx-glr-script-out .. code-block:: none Young's modulus: Spherical function Min=26.28357770763925, Max=191.396591469876 .. GENERATED FROM PYTHON SOURCE LINES 32-34 Plot it as a 3D surface -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 34-36 .. code-block:: Python E.plot3D() .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 37-41 Use Matplotlib instead of Plotly -------------------------------- By default, elasticipy uses `Plotly `_ to render the surface, allowing interactive plot (see above). Matplolib can be used instead: .. GENERATED FROM PYTHON SOURCE LINES 41-44 .. code-block:: Python E.plot3D(backend='matplotlib') .. image-sg:: /auto_examples/images/sphx_glr_Young_3D_001.png :alt: Young 3D :srcset: /auto_examples/images/sphx_glr_Young_3D_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.417 seconds) .. _sphx_glr_download_auto_examples_Young_3D.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Young_3D.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Young_3D.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Young_3D.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_