.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex11_notch-stress.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_examples_ex11_notch-stress.py: Notch Stress ------------ .. topic:: Three-dimensional linear-elastic analysis. * create a hexahedron mesh * define a linear-elastic solid body * project the linear-elastic stress tensor to the mesh-points * plot the max. principal stress component * evaluate the fatigue life .. admonition:: This example requires external packages. :class: hint .. code-block:: pip install pypardiso A linear-elastic notched plate is subjected to uniaxial tension. The cell-based mean of the stress tensor is projected to the mesh-points and its maximum principal value is plotted. .. GENERATED FROM PYTHON SOURCE LINES 28-73 .. code-block:: Python import pypardiso import felupe as fem meshes = [] radius = fem.mesh.Point(a=-2.5).revolve(n=9, phi=90).translate(5, axis=1) radius = fem.mesh.flip(radius) middle = fem.mesh.Line(a=-7.5, b=0, n=9).expand(n=0) meshes.append(middle.fill_between(radius, n=6)) left = fem.mesh.Line(-7.5, 5, n=11).expand(n=0).rotate(90, axis=2, center=[-7.5, 0]) right = ( fem.mesh.Line(a=-2.5, b=5, n=11) .expand(n=0) .rotate(90, axis=2, center=[-2.5, 0]) .translate(5, axis=1) ) meshes.append(right.fill_between(left, n=6)) meshes.append(fem.Rectangle(a=(-50, 0), b=(-7.5, 12.5), n=(36, 11))) mesh = fem.MeshContainer(meshes, merge=True).stack() mesh = fem.MeshContainer([mesh, mesh.mirror(axis=0)], merge=True, decimals=6).stack() mesh = fem.MeshContainer([mesh, mesh.mirror(axis=1)], merge=True, decimals=6).stack() mesh = mesh.expand(n=3, z=2.5) region = fem.RegionHexahedron(mesh) field = fem.FieldContainer([fem.Field(region, dim=3)]) boundaries = fem.dof.uniaxial( field, clamped=True, sym=False, move=0.02, return_loadcase=False ) solid = fem.SolidBody(umat=fem.LinearElastic(E=2.1e5, nu=0.30), field=field) step = fem.Step(items=[solid], boundaries=boundaries) job = fem.Job(steps=[step]).evaluate(parallel=True, solver=pypardiso.spsolve) solid.plot( "Principal Values of Stress", show_edges=False, view="xy", project=fem.topoints, show_undeformed=False, ).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex11_notch-stress_001.png :alt: ex11 notch stress :srcset: /examples/images/sphx_glr_ex11_notch-stress_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/stable/docs/examples/images/sphx_glr_ex11_notch-stress_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 75-88 The number of maximum endurable cycles between zero and the applied displacement is evaluated with a SN-curve as denoted in Eq. :eq:`sn-curve`. The range of the maximum principal value of the stress tensor is used to evaluate the fatigue life. For simplicity, the stress is evaluated for the total solid body. To consider only stresses on points which lie on the surface of the solid body, the cells on faces :meth:`~felupe.RegionHexahedronBoundary.mesh.cells_faces` must be determined first. .. math:: :label: sn-curve \frac{N}{N_D} = \left( \frac{S}{S_D} \right)^{-k} .. GENERATED FROM PYTHON SOURCE LINES 88-107 .. code-block:: Python S_D = 100 # MPa N_D = 2e6 # cycles k = 5 # slope S = fem.topoints(fem.math.eigvalsh(solid.evaluate.stress())[-1], region) N = N_D * (abs(S) / S_D) ** -k view = solid.view(point_data={"Endurable Cycles": N}) plotter = view.plot( "Endurable Cycles", show_undeformed=False, show_edges=False, log_scale=True, flip_scalars=True, clim=[N.min(), 2e6], above_color="lightgrey", ) plotter.camera.zoom(6) plotter.show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex11_notch-stress_002.png :alt: ex11 notch stress :srcset: /examples/images/sphx_glr_ex11_notch-stress_002.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/stable/docs/examples/images/sphx_glr_ex11_notch-stress_002.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.361 seconds) .. _sphx_glr_download_examples_ex11_notch-stress.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex11_notch-stress.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex11_notch-stress.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex11_notch-stress.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_