Contact Element Example#

This example demonstrates how to create contact elements for general contact.

Begin by launching MAPDL.

from ansys.mapdl import core as pymapdl

mapdl = pymapdl.launch_mapdl()

Enter the pre-processor, create a block and mesh it with tetrahedral elements.

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()
contact elements

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.

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()
contact elements

Select all the elements at the intersection between the two blocks and generate contact elements.

mapdl.nsel("s", "loc", "z", 0.5, 0.50001)
mapdl.esln("s")
output = mapdl.gcgen("NEW", splitkey="SPLIT", selopt="SELECT")
print(output)
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

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.

mapdl.esel("S", "SEC", vmin=3, vmax=4)
mapdl.eplot(style="wireframe", line_width=3)
contact elements

Stop mapdl#

mapdl.exit()

Total running time of the script: (0 minutes 2.013 seconds)