Сontact problems of the theory of elasticity


I solve the contact problem of the theory of elasticity, the condition in figure 1. Yellow cylinder and a red cube. the Blue highlighted area of contact between cylinder and cube. Сontact type - ‘Bonded’. Figure 2 shows a 3d model in the format *step. The cylinder and cube have different material.

If I import *.step which contains these two models, then there is a problem with the purpose of the material. NGSolve sees two models, but you can only specify one material. So I went the other way, importing the models separately:

geo_1 = LoadOCCGeometry('cyl.step')
grid_mesh_1 = geo_1.GenerateMesh(maxh=0.5)
mesh_1 = Mesh(grid_mesh_1)

geo_2 = LoadOCCGeometry('cub.step')
grid_mesh_2 = geo_2.GenerateMesh(maxh=0.5)
mesh_2 = Mesh(grid_mesh_2)

Then I set the names for the boundary conditions:

for key in range(len(mesh_1.GetBoundaries())):
        grid_mesh_1.SetBCName(key, 'cyl_surface_' + str(key))

for key in range(len(mesh_2.GetBoundaries())):
        grid_mesh_2.SetBCName(key, 'cub_surface_' + str(key))

Ask material:

grid_mesh_1.SetMaterial(1, 'material_1')

grid_mesh_2.SetMaterial(1, 'material_2')

Create a space of finite elements:

cyl = H1(mesh_1, order=1, dim=mesh_1.dim, definedon='material_1')
cub = H1(mesh_2, order=1, dirichlet='cub_surface_6', dim=mesh_2.dim, definedon='material_2')

And then the question arises, how now to ask the contact between the cylinder and the cube?
How to combine H1 spaces for further calculation?
When using

cyl_and_cub = FESpace([cyl, cub])

nothing happens. I think it’s because there is no contact condition and the finite elements intersect.

Files: cyl.step, cub.step, test_1.py


if you import two geometries and mesh them separately, the meshes at the interface do not match. Therefore this won’t work.

Could you please attach the step file with both parts, then I can check what’s happening during the import.


Here’s the file cyl_cub.step

Hi Username,

it depends on your contact algorithm: Does it work for unrelated meshes (using geometric searching), or do you want matching meshes ?


It would be ideal to escape from the condition of contact of type ‘bonded’ and want matching meshes.


here we solve a contact problem …

I used the CSG geometry to setup your model. We generate one model with two materials. The common interface gets the boundary condition label “contact”.

We define two VectorH1 spaces restricted to the two materials (definedon=…). Thus, we have duplicated the variables on the contact interface. I merge the spaces to one CompoundFESpace. Then we define the elastic energies. I use a penalty for the penetration (u1-u2)*n.

I attached a plot of the contact force.

Of course, the example is very much simplified, and it’s easy to add a real material.

Best, Joachim

Attachment: contact_2018-08-22.py

Hi, Joachim,

You’ve helped me a lot, thank you!