.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/00-mapdl-examples/contact_elements.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_gallery_examples_00-mapdl-examples_contact_elements.py: .. _ref_contact_example: Contact Element Example ~~~~~~~~~~~~~~~~~~~~~~~ This example demonstrates how to create contact elements for general contact. Begin by launching MAPDL. .. GENERATED FROM PYTHON SOURCE LINES 35-39 .. code-block:: Python from ansys.mapdl import core as pymapdl mapdl = pymapdl.launch_mapdl() .. GENERATED FROM PYTHON SOURCE LINES 40-43 Enter the pre-processor, create a block and mesh it with tetrahedral elements. .. GENERATED FROM PYTHON SOURCE LINES 43-53 .. code-block:: Python mapdl.prep7() vnum0 = mapdl.block(0, 1, 0, 1, 0, 0.5) mapdl.et(1, 187) mapdl.esize(0.1) mapdl.vmesh(vnum0) mapdl.eplot() .. image-sg:: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_001.png :alt: contact elements :srcset: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 54-59 Second a volume block above the existing block and mesh it with quadratic hexahedral elements. Ensure that these blocks do not touch by starting it slightly higher than the existing block. Note how these two blocks do not touch and the mesh is non-conformal. .. GENERATED FROM PYTHON SOURCE LINES 59-68 .. code-block:: Python mapdl.esize(0.09) mapdl.et(2, 186) mapdl.type(2) vnum1 = mapdl.block(0, 1, 0, 1, 0.50001, 1) mapdl.vmesh(vnum1) mapdl.eplot() .. image-sg:: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_002.png :alt: contact elements :srcset: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 69-71 Select all the elements at the intersection between the two blocks and generate contact elements. .. GENERATED FROM PYTHON SOURCE LINES 71-77 .. code-block:: Python mapdl.nsel("s", "loc", "z", 0.5, 0.50001) mapdl.esln("s") output = mapdl.gcgen("NEW", splitkey="SPLIT", selopt="SELECT") print(output) .. rst-class:: sphx-glr-script-out .. code-block:: none GENERATE GENERAL CONTACT ELEMENTS FEATURE ANGLE FOR SURFACE SPLITTING = 42.0 DEGREES ASSIGN SECNUM BASED ON SPLIT SURFACES USE EXTERIOR FACES OF SELECTED ELEMENTS ONLY Number of general CONTA174 elements created = 366 on exterior faces of 3D solid base elements New general contact elements have Section ID from 3 to 4 .. GENERATED FROM PYTHON SOURCE LINES 78-83 Plot the contact element pairs. Note from the command output above that the section IDs are 5 and 6. Here, we plot the element mesh as a wire-frame to show that the contact pairs overlap. .. GENERATED FROM PYTHON SOURCE LINES 83-87 .. code-block:: Python mapdl.esel("S", "SEC", vmin=3, vmax=4) mapdl.eplot(style="wireframe", line_width=3) .. image-sg:: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_003.png :alt: contact elements :srcset: /examples/gallery_examples/00-mapdl-examples/images/sphx_glr_contact_elements_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 88-91 Stop mapdl ~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 91-92 .. code-block:: Python mapdl.exit() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.013 seconds) .. _sphx_glr_download_examples_gallery_examples_00-mapdl-examples_contact_elements.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: contact_elements.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: contact_elements.py `