.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex19_taylor-hood.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_ex19_taylor-hood.py: Mixed-field hyperelasticity with quadratic triangles ---------------------------------------------------- A 90° section of a plane-strain circle is subjected to uniaxial compression by a vertically moved rigid top plate. A mixed-field formulation is used with quadratic triangles. .. GENERATED FROM PYTHON SOURCE LINES 8-15 .. code-block:: Python from functools import partial import numpy as np import felupe as fem .. GENERATED FROM PYTHON SOURCE LINES 17-20 A 90° section of a circle with quadratic triangles is created. The midpoints are shifted to the outer radius. An additional point, used as center- (control-) point, is added to the mesh. .. GENERATED FROM PYTHON SOURCE LINES 20-25 .. code-block:: Python mesh = fem.Circle(n=6, sections=[0]).triangulate().add_midpoints_edges() mask = np.isclose(mesh.x**2 + mesh.y**2, 1, atol=0.05) mesh.points[mask] /= np.linalg.norm(mesh.points[mask], axis=1).reshape(-1, 1) mesh.add_points([0, 1.1]) .. GENERATED FROM PYTHON SOURCE LINES 26-29 Let's create a region for quadratic triangles and a mixed-field container with two dual fields, one for the pressure and another one for the volume ratio. The dual fields are disconnected. .. GENERATED FROM PYTHON SOURCE LINES 29-50 .. code-block:: Python region = fem.RegionQuadraticTriangle(mesh) field = fem.FieldsMixed( region, n=3, values=(0.0, 0.0, 1.0), planestrain=True, disconnect=True ) # create a nearly-incompressible hyperelastic solid body and the rigid top plate umat = fem.NearlyIncompressible(material=fem.NeoHooke(mu=1), bulk=5000) solid = fem.SolidBody(umat=umat, field=field) top = fem.ContactRigidPlane( field=field, points=np.arange(mesh.npoints)[np.isclose(mesh.x**2 + mesh.y**2, 1)], centerpoint=-1, normal=(0, -1), items=[solid], friction=0.5, multiplier=10, # increase contact normal multiplier multiplier_tangential=2, # increase contact tangential multiplier ) kwargs = dict(line_width=5, opacity=1, sym=(True, False), size=2) mesh.plot(nonlinear_subdivision=4, plotter=top.plot(**kwargs)).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex19_taylor-hood_001.png :alt: ex19 taylor hood :srcset: /examples/images/sphx_glr_ex19_taylor-hood_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe-ja/checkouts/latest/felupe/docs/examples/images/sphx_glr_ex19_taylor-hood_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 51-53 A step is used containts the solid body and the rigid top plate as items. The rigid vertical movement of the top plate is applied in a ramped manner. .. GENERATED FROM PYTHON SOURCE LINES 53-60 .. code-block:: Python boundaries = fem.dof.symmetry(field[0]) boundaries["move"] = fem.Boundary(field[0], fy=1.1, skip=(1, 0)) move = fem.math.linsteps([0, -0.4], num=6) ramp = {boundaries["move"]: move} step = fem.Step(items=[solid, top], ramp=ramp, boundaries=boundaries) job = fem.Job(steps=[step]).evaluate() .. GENERATED FROM PYTHON SOURCE LINES 61-63 The maximum principal values of the Cauchy stress tensor are plotted. The cell-based means are projected to the mesh-points. .. GENERATED FROM PYTHON SOURCE LINES 63-69 .. code-block:: Python solid.plot( "Principal Values of Cauchy Stress", nonlinear_subdivision=4, plotter=top.plot(**kwargs), project=partial(fem.project, mean=True), ).show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/images/sphx_glr_ex19_taylor-hood_002.png :alt: ex19 taylor hood :srcset: /examples/images/sphx_glr_ex19_taylor-hood_002.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/felupe-ja/checkouts/latest/felupe/docs/examples/images/sphx_glr_ex19_taylor-hood_002.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.763 seconds) .. _sphx_glr_download_examples_ex19_taylor-hood.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex19_taylor-hood.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex19_taylor-hood.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex19_taylor-hood.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_