.. 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. 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 21-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, uniform=True) displacement = fem.Field(region, dim=3) field = fem.FieldContainer([displacement]) .. GENERATED FROM PYTHON SOURCE LINES 31-32 A fixed boundary condition is applied on the left end of the beam. .. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: Python boundaries = fem.BoundaryDict(fixed=fem.dof.Boundary(displacement, fx=0)) boundaries.plot().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/stable/docs/examples/images/sphx_glr_ex01_beam_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 36-38 The material behaviour is defined through a built-in isotropic linear-elastic material formulation. .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python umat = fem.LinearElastic(E=206000, nu=0.3) solid = fem.SolidBody(umat=umat, field=field) .. GENERATED FROM PYTHON SOURCE LINES 42-46 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 46-50 .. code-block:: Python density = 7850 * 1e-12 gravity = [0, 0, 9810] force = fem.SolidBodyForce(field, values=gravity, scale=density) .. GENERATED FROM PYTHON SOURCE LINES 51-54 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 54-57 .. code-block:: Python step = fem.Step(items=[solid, force], boundaries=boundaries) job = fem.Job(steps=[step]).evaluate() .. GENERATED FROM PYTHON SOURCE LINES 58-60 The magnitude of the displacement field are plotted on a 300x scaled deformed configuration. .. GENERATED FROM PYTHON SOURCE LINES 60-62 .. 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_002.png :alt: ex01 beam :srcset: /examples/images/sphx_glr_ex01_beam_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_ex01_beam_002.vtksz .. GENERATED FROM PYTHON SOURCE LINES 63-71 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 3.807 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 ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex01_beam.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_