Contact analysis and TopOpt by the TMC

This self-contained implementation of the TMC method allows modelling frictionless contact for the analysis and topology optimization of nonlinear, hyperelastic structures. The implementation assumes 2D domains and bilinear, uniform quadrilateral discretizations, and builds upon the general principles of the top88 and
top99neo codes.

The software consists of the following routines:

- initializeFEA.m
- assembleKtFi.m
- solveIncrIter.m
- ocUpdate.m
- plotDeformed.m

and of the three main scripts:

1. cshapeTMC --> contact analysis for the C-shape benchmark example
2. topTMC --> TopOpt with contact modelling by the TMC (boundary contact example)
3. topTMC_selfContact --> TopOpt with contact modelling by the TMC (self contact example)

Download the whole package as zip from here: Top_TMC.zip

Details of the implementation are discussed in the paper:
[1] Frederiksen A.H., Sigmund O. & Ferrari F. A Matlab code for analysis and topology optimization with Third Medium Contact.
Structural and Multidisciplinary Optimization (2026).

The ArXive version of the paper can be found here: https://arxiv.org/abs/2512.00133

The whole code can be downloaded here (DOWNLOAD LINK). Save the programs and start Matlab in the same directory and run the programs. The contact analysis for the C-shape geometry can be run by running:

>> cshapeTMC
 

which gives the results shown in Section 2.2 of [1]. Running commands

>> topTMC
 

or 

>> topTMC_selfContact
 

gives the results shown in Sections 3.1 of [1].