.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex03_plasticity.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_ex03_plasticity.py: Plasticity with Isotropic Hardening ----------------------------------- .. topic:: Small-strain Plasticity * linear-elastic plastic material formulation with isotropic hardening * define a body force vector * extract state variables The normal plastic strain due to a body force applied on a solid with a linear-elastic plastic material formulation with isotropic hardening with young's modulus :math:`E=210000`, poisson ratio :math:`\nu=0.3`, isotropic hardening modulus :math:`K=1000`, yield stress :math:`\sigma_y=355`, length :math:`L=3` and cross section area :math:`A=1` is to be evaluated. .. image:: ../../examples/ex03_plasticity_sketch.png First, let's create a meshed cube out of hexahedron cells with ``n=(16, 6, 6)`` points per axis. A three-dimensional vector-valued displacement field is initiated on the numeric region. .. GENERATED FROM PYTHON SOURCE LINES 25-34 .. code-block:: Python import numpy as np import felupe as fem mesh = fem.Cube(b=(3, 1, 1), n=(16, 6, 6)) region = fem.RegionHexahedron(mesh) displacement = fem.Field(region, dim=3) field = fem.FieldContainer([displacement]) .. GENERATED FROM PYTHON SOURCE LINES 35-36 A fixed boundary condition is applied at :math:`x=0`. .. GENERATED FROM PYTHON SOURCE LINES 36-38 .. code-block:: Python boundaries = {"fixed": fem.dof.Boundary(displacement, fx=0)} .. GENERATED FROM PYTHON SOURCE LINES 39-41 The material behaviour is defined through a built-in isotropic linear-elastic plastic material formulation with isotropic hardening. .. GENERATED FROM PYTHON SOURCE LINES 41-44 .. code-block:: Python umat = fem.LinearElasticPlasticIsotropicHardening(E=2.1e5, nu=0.3, sy=355, K=1e3) solid = fem.SolidBody(umat, field) .. GENERATED FROM PYTHON SOURCE LINES 45-50 The body force is created on the field of the solid body. .. math:: \delta W_{ext} = \int_v \delta \boldsymbol{u} \cdot \boldsymbol{b} ~ dv .. GENERATED FROM PYTHON SOURCE LINES 50-53 .. code-block:: Python bodyforce = fem.SolidBodyGravity(field) b = fem.math.linsteps([0, 200], num=10, axis=0, axes=3) .. GENERATED FROM PYTHON SOURCE LINES 54-57 Inside a Newton-Rhapson procedure, the vectors and matrices are assembled for the given *items* and the boundary conditions are incorporated into the equilibrium equations. .. GENERATED FROM PYTHON SOURCE LINES 57-61 .. code-block:: Python step = fem.Step(items=[solid, bodyforce], ramp={bodyforce: b}, boundaries=boundaries) job = fem.Job(steps=[step]).evaluate() .. GENERATED FROM PYTHON SOURCE LINES 62-67 A view on the field-container shows the deformed mesh and the normal plastic strain in direction :math:`x` due to the applied body force. The vector of all state variables, stored as a result in the solid body object, are splitted into separate variables. The plastic strain is stored as the second state variable. The mean-per-cell value of the plastic strain in direction :math:`x` is exported to the view. .. GENERATED FROM PYTHON SOURCE LINES 67-76 .. code-block:: Python def plot(solid, field): "Visualize the final Normal Plastic Strain in direction X." plastic_strain = np.split(solid.results.statevars, umat.statevars_offsets)[1] view = fem.View(field, cell_data={"Plastic Strain": plastic_strain.mean(-2).T}) return view.plot("Plastic Strain", component=0, show_undeformed=False) plot(solid, field).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex03_plasticity_001.png :alt: ex03 plasticity :srcset: /examples/images/sphx_glr_ex03_plasticity_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_ex03_plasticity_001.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.611 seconds) .. _sphx_glr_download_examples_ex03_plasticity.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex03_plasticity.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex03_plasticity.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_