.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/DP_vs_MC.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_DP_vs_MC.py: ============================================================= Plot in 2D the Mohr-Coulomb and Drucker-Prager yield surface ============================================================= The example illustrates in 2D the differences between the Mohr-Coulomb and the Drucker-Prager yield criteria. .. GENERATED FROM PYTHON SOURCE LINES 9-14 .. code-block:: Python from elasticipy.yield_criteria import DruckerPrager, MohrCoulomb c = 2 phi = -20 mc = MohrCoulomb(c, phi) .. GENERATED FROM PYTHON SOURCE LINES 15-18 When expressed in terms of cohesion (c) and friction angle (phi), there are three ways to 'fit' the Drucker-Prager (DP) yield criterion with that of Mohr-Coulomb (see `here `_): .. GENERATED FROM PYTHON SOURCE LINES 18-31 .. code-block:: Python pg1 = DruckerPrager.from_cohesion_friction_angle(c, phi, fit='inside') pg2 = DruckerPrager.from_cohesion_friction_angle(c, phi, fit='middle') pg3 = DruckerPrager.from_cohesion_friction_angle(c, phi, fit='outside') fig, ax = mc.plot2D() fig, ax = pg1.plot2D(fig=fig, ax=ax, label='DP (inside)', color='green', alpha=0., linestyle='dashed') fig, ax = pg2.plot2D(fig=fig, ax=ax, label='DP (middle)', color='blue', alpha=0., linestyle='dotted') fig, ax = pg3.plot2D(fig=fig, ax=ax, label='DP (outside)', color='black', alpha=0., linestyle='dashdot') ax.legend() fig.show() .. image-sg:: /auto_examples/images/sphx_glr_DP_vs_MC_001.png :alt: DP vs MC :srcset: /auto_examples/images/sphx_glr_DP_vs_MC_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.644 seconds) .. _sphx_glr_download_auto_examples_DP_vs_MC.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: DP_vs_MC.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: DP_vs_MC.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: DP_vs_MC.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_