Such events call for better methods of crowd control. The physics community has been looking at this problem for a while now, researchers said.
"For example they have investigated the idea of placing barriers at certain places that would make the flow of crowd easier. It may sound counter intuitive, but it works," he said.
"It is all about streamlining the crowd. It looks like you have placed barricades at certain places, but it helps easing the crowd flow," he added.
The research team, which includes Sumesh P Thampi and Ajinkya Kulkarni, analysed what happens when a dense crowd - about 3-4 people per square metres - fills into a confined space.
They said that in such gatherings the movement of the crowd resembles that of any fluid, and hence laws of fluid dynamics can be applied to predict where disturbances can arise.
"If we look at the areal videos of people circumnavigating the Kaaba in Mecca, it looks exactly like water swirling in a bucket," Mr Panchagnula said.
The researchers tried to capture the simple rules that a person follows to navigate in a crowd in to a mathematical model. The predictions of the model adhered well to experimental observations, they said.
"Let's say a gathering is set to take place in Marina beach. The police will set up baricades to control the crowd. All we need is a drawing of where the barricades are being placed, and what is the size of the expected crowd," Mr Panchagnula said.
"The simulation can predict at which points a stampede is likely to start, and the optimal points where police personnel should be deployed to quickly prevent a stampede," he said.
This would allow the police to design the best strategy for crowd control, with the minimum personnel. The model can also help design a better barricade system, researchers said.
Apart from helping the police personnel place themselves at strategic locations even before an event begins, the algorithm can be incorporated in future drones that can monitor crowds in real time.
"We are getting into an age where we will see more use of drones to monitor crowd motions in these large gatherings. With our model, real time feedback from such drones would be very useful," Mr Panchagnula said.
The researchers are keen to partner with government agencies to develop intelligent crowd management strategies for future religious, political or sporting events.
The cost of implementing the predictive model in a real life scenario is very minimal, say scientists, as it simply informs authorities on how to best use their existing resources.