The mechanisms of squat formation on train rails