.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorial/extut01_getting_started.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_tutorial_extut01_getting_started.py: Getting Started --------------- .. topic:: Your very first steps with FElupe. * create a meshed cube with hexahedron cells * define a numeric region along with a displacement field * load a Neo-Hookean material formulation * apply a uniaxial loadcase * solve the problem * export the displaced mesh This tutorial covers the essential high-level parts of creating and solving problems with FElupe. As an introductory example, a quarter model of a solid cube with hyperelastic material behaviour is subjected to a uniaxial elongation applied at a clamped end-face. First, let's import FElupe and create a meshed cube out of hexahedron cells with ``n`` points per axis. A numeric region, pre-defined for hexahedrons, is created on the mesh. A vector-valued displacement field is initiated on the region. Next, a field container is created on top of the displacement field. .. GENERATED FROM PYTHON SOURCE LINES 27-35 .. code-block:: Python import felupe as fem mesh = fem.Cube(n=6) region = fem.RegionHexahedron(mesh=mesh) displacement = fem.Field(region=region, dim=3) field = fem.FieldContainer(fields=[displacement]) .. GENERATED FROM PYTHON SOURCE LINES 36-43 A uniaxial load case is applied on the displacement field stored inside the field container. This involves setting up symmetry planes as well as the absolute value of the prescribed displacement at the mesh-points on the right-end face of the cube. The right-end face is *clamped*: only displacements in direction x are allowed. The dict of boundary conditions for this pre-defined load case are returned as ``boundaries`` and the partitioned degrees of freedom as well as the external displacements are stored within the returned dict ``loadcase``. .. GENERATED FROM PYTHON SOURCE LINES 43-51 .. code-block:: Python boundaries, loadcase = fem.dof.uniaxial( field, move=0.2, right=1, clamped=True, return_loadcase=True, ) .. GENERATED FROM PYTHON SOURCE LINES 52-55 The material behaviour is defined through a built-in Neo-Hookean material formulation. The constitutive isotropic hyperelastic material formulation is applied on the displacement field by the definition of a solid body. .. GENERATED FROM PYTHON SOURCE LINES 55-58 .. code-block:: Python umat = fem.NeoHooke(mu=1.0, bulk=2.0) solid = fem.SolidBody(umat=umat, field=field) .. GENERATED FROM PYTHON SOURCE LINES 59-61 The problem is solved by an iterative :func:`Newton-Rhapson ` procedure. A verbosity level of 2 enables a detailed text-based logging. .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python res = fem.newtonrhapson(items=[solid], verbose=2, **loadcase) .. rst-class:: sphx-glr-script-out .. code-block:: none Newton-Rhapson solver ===================== | # | norm(fun) | norm(dx) | |---|-----------|-----------| | 1 | 7.553e-02 | 1.898e+00 | | 2 | 1.310e-03 | 5.091e-02 | | 3 | 3.086e-07 | 6.698e-04 | | 4 | 2.265e-14 | 1.527e-07 | Converged in 4 iterations (Assembly: 0.03021 s, Solve: 0.01224 s). .. GENERATED FROM PYTHON SOURCE LINES 64-65 Results may be viewed in an interactive window. .. GENERATED FROM PYTHON SOURCE LINES 65-66 .. code-block:: Python field.plot("Displacement", component=0).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /tutorial/images/sphx_glr_extut01_getting_started_001.png :alt: extut01 getting started :srcset: /tutorial/images/sphx_glr_extut01_getting_started_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe/checkouts/stable/docs/tutorial/images/sphx_glr_extut01_getting_started_001.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.338 seconds) .. _sphx_glr_download_tutorial_extut01_getting_started.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: extut01_getting_started.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: extut01_getting_started.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: extut01_getting_started.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_