.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex12_foot-bone.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_ex12_foot-bone.py: Voxelized Foot Bone ------------------- .. admonition:: This example requires external packages. :class: hint .. code-block:: pip install pypardiso .. GENERATED FROM PYTHON SOURCE LINES 12-51 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex12_foot-bone_001.png :alt: ex12 foot bone :srcset: /examples/images/sphx_glr_ex12_foot-bone_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/latest/docs/examples/images/sphx_glr_ex12_foot-bone_001.vtksz .. code-block:: Python import numpy as np import pypardiso import pyvista as pv from pyvista import examples import felupe as fem surface = examples.download_foot_bones() voxels = pv.voxelize(surface, density=surface.length / 50) mesh = fem.Mesh( points=voxels.points, cells=voxels.cell_connectivity.reshape(-1, 8), cell_type="hexahedron", ).rotate(90, axis=0) mesh.points *= 25 mesh.update(points=np.vstack([mesh.points, [0, 0, mesh.z.min() - 2]])) region = fem.RegionHexahedron(mesh) field = fem.FieldContainer([fem.Field(region, dim=3)]) boundaries = {"fixed": fem.Boundary(field[0], fx=lambda x: x <= -110)} umat = fem.LinearElastic(E=1000, nu=0.3) solid = fem.SolidBody(umat, field) gravity = fem.SolidBodyGravity(field, gravity=[0, 0, -7e-2]) bottom = fem.MultiPointContact( field, points=np.arange(mesh.npoints), centerpoint=-1, skip=(1, 1, 0) ) step = fem.Step(items=[solid, gravity, bottom], boundaries=boundaries) job = fem.Job(steps=[step]).evaluate(solver=pypardiso.spsolve, parallel=True) plotter = solid.plot( "Principal Values of Cauchy Stress", show_edges=False, show_undeformed=False, clim=[0, 10], ) bottom.plot(plotter=plotter, color="white", opacity=1).show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.837 seconds) .. _sphx_glr_download_examples_ex12_foot-bone.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex12_foot-bone.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex12_foot-bone.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_