ContactEngineering / ContactMechanics

Contact mechanics using elastic half-space methods
https://contactengineering.github.io/ContactMechanics/
MIT License
21 stars 5 forks source link

Handling points that are never allowed to contact in the CG #48

Closed sannant closed 2 years ago

sannant commented 2 years ago

For flat punches or spheres we used masked arrays to prevent the points outside the cross section of the indenter to come into contact.

As discussed in this issue we want to go away from masked arrays in contact mechanics simulations and we already do in Adhesion.

However in ContactMechanics, test_flat_punch was still using the mask for defining the flat_punch.

Filling the masked values with - infinity causes problems in the CG algorithm, for example when multiplying the gap with a mask: (c_r * g_r * g_r)[https://github.com/ContactEngineering/ContactMechanics/blob/c734edeae83f5b3369fd9a2bd1c4fc7d00e382f3/ContactMechanics/Optimization/ConstrainedConjugateGradients.py#L234]

0 times the infinite gap gives nan instead of 0.

How should we deal with this ?

sannant commented 2 years ago

3.2 is the easiest fix.

I would aboid 3.1 and 3.3 because masked arrays are buggy and I would like to avoid them completely from the simulations.

sannant commented 2 years ago

After discussion with @pastewka, we decided to keep support for topographies with undefined data in ContactMechanics.

Then we need to fix make NuMPI's reductions compatible with masked arrays again.