ContactEngineering / ContactMechanics

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

Contact mechanics example file vs contact.engineering giving different results #87

Open sitangshugk95 opened 1 year ago

sitangshugk95 commented 1 year ago

I am using the example code easy_hardwall_simulation to run a simulation on my own [surface topography](Sitangshu Chatterjee. (2022). contact.engineering. Randomly Rough surface (Version 1). https://doi.org/10.57703/ce-nyq38) published on contact.engineering. However, I am getting different results for the relative contact area - they are off by an order of magnitude (images attached): Screenshot from 2022-11-16 12-59-19 Screenshot from 2022-11-16 13-00-42

The only change I have made to the code is change the address that the container reads, as shown below: Screenshot from 2022-11-16 13-06-02

Why does the website and the code give different results?

sitangshugk95 commented 1 year ago

@sannant

sannant commented 1 year ago

This is a mistake in the example notebook, the formulation in the docstring is ambiguous.

The "total contact area" is already the fractional contact area.

Replacing

ax.loglog(mean_pressure, total_contact_area / np.prod(t.physical_sizes), "+")

by

ax.loglog(mean_pressure, total_contact_area / np.prod(t.physical_sizes), "+")

should fix the problem:w

sannant commented 1 year ago

@pastewka , why did you call this variable like this ?

total_contact_area = (force_xy > 0).sum() / np.prod(topography.nb_grid_pts)

https://github.com/ContactEngineering/ContactMechanics/blob/c2d51d686f11b987719fc2d0bd1d3dfcca4f6a40/ContactMechanics/PipelineFunction.py#L98