.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex01_beam.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_ex01_beam.py: Cantilever beam under gravity ----------------------------- .. topic:: Apply a gravity load on a solid body. * create a solid body and apply the gravity load * linear-elastic analysis The displacement due to gravity of a cantilever beam with young's modulus :math:`E=206000` MPa, poisson ratio :math:`\nu=0.3`, length :math:`L=2000` mm and cross section area :math:`A=a \cdot a` with :math:`a=100` mm is to be evaluated within a linear-elastic analysis [1]_. .. image:: ../../examples/ex01_beam_sketch.png First, let's create a meshed cube out of hexahedron cells with ``n=(181, 9, 9)`` points per axis. A numeric region created on the mesh represents the cantilever beam. A three- dimensional vector-valued displacement field is initiated on the region. .. GENERATED FROM PYTHON SOURCE LINES 22-29 .. code-block:: Python import felupe as fem cube = fem.Cube(a=(0, 0, 0), b=(2000, 100, 100), n=(101, 6, 6)) region = fem.RegionHexahedron(cube) displacement = fem.Field(region, dim=3) field = fem.FieldContainer([displacement]) .. GENERATED FROM PYTHON SOURCE LINES 30-31 A fixed boundary condition is applied on the left end of the beam. .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: Python boundaries = {"fixed": fem.dof.Boundary(displacement, fx=0)} .. GENERATED FROM PYTHON SOURCE LINES 34-36 The material behaviour is defined through a built-in isotropic linear-elastic material formulation. .. GENERATED FROM PYTHON SOURCE LINES 36-39 .. code-block:: Python umat = fem.LinearElastic(E=206000, nu=0.3) solid = fem.SolidBody(umat=umat, field=field) .. GENERATED FROM PYTHON SOURCE LINES 40-44 The body force is defined by a (constant) gravity field on a solid body. .. math:: \delta W_{ext} = \int_v \delta \boldsymbol{u} \cdot \rho \boldsymbol{g} ~ dv .. GENERATED FROM PYTHON SOURCE LINES 44-46 .. code-block:: Python gravity = fem.SolidBodyGravity(field, gravity=[0, 0, 9810], density=7850 * 1e-12) .. GENERATED FROM PYTHON SOURCE LINES 47-50 Inside a Newton-Rhapson procedure, the weak form of linear elasticity is assembled into the stiffness matrix and the applied gravity field is assembled into the body force vector. .. GENERATED FROM PYTHON SOURCE LINES 50-53 .. code-block:: Python step = fem.Step(items=[solid, gravity], boundaries=boundaries) job = fem.Job(steps=[step]).evaluate() .. GENERATED FROM PYTHON SOURCE LINES 54-56 The magnitude of the displacement field are plotted on a 300x scaled deformed configuration. .. GENERATED FROM PYTHON SOURCE LINES 56-58 .. code-block:: Python field.plot("Displacement", component=None, factor=300).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex01_beam_001.png :alt: ex01 beam :srcset: /examples/images/sphx_glr_ex01_beam_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_ex01_beam_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 59-67 References ~~~~~~~~~~ .. [1] Glenk C. et al., *Consideration of Body Forces within Finite Element Analysis*, Strojniški vestnik - Journal of Mechanical Engineering, Faculty of Mechanical Engineering, 2018, |DOI|. .. |DOI| image:: https://zenodo.org/badge/DOI/10.5545/sv-jme.2017.5081.svg :target: https://www.doi.org/10.5545/sv-jme.2017.5081 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.378 seconds) .. _sphx_glr_download_examples_ex01_beam.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex01_beam.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex01_beam.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_