Pilgrims usually arrive in Mecca and perform some voluntary rituals in preparation for the mandatory rituals in Masjid-Al-Haram, called Tawaf and Sa’ay. Tawaf is performed in Mata’af, an open-air space, and around the Kaaba and Sa’ay is performed in the Masa’a building, an enclosed space (Fig 1a and b). On the first day of the obligatory ritual, all pilgrims travel to Mina and stay a day in Al-Mashaer inside tents or in open spaces. In the evening, they travel to Muzdalifah and stay there overnight in open spaces (no tents). Pilgrims' travel from Masjid-Al-Haram to Mina, Al-Mashaer, and Muzdalifah are often done through buses, train, minivans, taxis, and cars. Pilgrims stay in Mina for four days. They stay in camps while performing their rituals during the day. There are some trips between Mina and Masjid-Al-Haram during this period to perform Tawaf and Sa’ay. On the last day of their obligatory rituals, pilgrims go back to Masjid-Al-Haram from Mina and perform the last Tawaf and Sa’ay before leaving.
In this study, we focus on rituals that are performed repeatedly in the Masjid-Al-Haram complex (Tawaf in Mata’af and Sa’ay in Masa’a Building). The complex has three floors. while rituals can be performed on all floors, most pilgrims prefer to perform them on the first floor. To limit the scope and computational time, we only consider and simulate the first floor. To perform the Tawaf ritual, the pilgrims circle around Kaaba seven times counterclockwise. After completion of Tawaf, prayer is performed in designated prayer areas around Mata’af. The prayer on the first-floor area is covered but has an open connection to the uncovered Mata’af area. The prayer is followed by the Sa’ay ritual during which pilgrims run or walk seven times between Safa and Marwah points in Masa’a. The maximum Mata’af radius is about 75 m but the Tawaf is often performed in areas near the Kaaba. Tawaf begins from the corner of the Kaaba with the Black Stone and ends up with an average total distance of 1.5 km after the completion of the seven rounds. The open area around the Kaaba on the ground floor is about 15,000 m². The Mata’af and Ottoman constructions around Kaaba can accommodate up to 72,000 people in a praying position . The crowd density in Tawaf during the peak of the Hajj season and also during the month of Ramadan used to reach up to 8 people per square meter . This density varies from 6 to 7 people per square meter near the Kaaba to 1 person per square meter in a distance of about 40 meters from Kaabah . Previous studies and crowd models have shown that the upper limit throughput of the Mata’af area for efficient and safe Tawaf is about 30,000 Tawafs per hour . The distance between the Safa and Marwa is around 450 m, therefore, seven trips back and forth sum up to roughly 3.6 km. This area is divided into two 16 m wide corridors. Recently, the Masjid-Al-Haram has a much higher throughput due to the increased capacity of the Masa’a building . Measurements indicate that the current maximum rate of entrance and exit from the Masjid-Al-Haram can reach up to 55,000 to 65,000 pilgrims per hour in peak seasons . Pilgrim speed in the Mata’af area is a function of the pilgrims' densities, time of the day, and age of pilgrims. There are fluctuations in the speed due to turbulence in the pilgrim flux, and oscillation on the pilgrims' paths caused by shock waves which are affected by the repulsive forces between the pedestrians in the high-density crowd . The average measured speed varies from 0.3 m/s in the higher-density areas to 1.1 m/s in lower-density areas .
In this study, we used a mix of agent-based modeling and discrete events simulation techniques. Agent-based models can be used to model the pedestrians' behaviors in crowds . To simulate the motion of pilgrims in Masjid-Al-Haram, we developed a multiscale simulation model in AnyLogic software (www.anylogic.com). AnyLogic is a multimethod simulation modeling platform that allows simulating pedestrian dynamics. Pedestrian movement in AnyLogic is modeled according to a social force model observing rules of physics. In the social forces model, the mass and dimension of each pedestrian, desired speed of the pedestrian in the absence of interactions, the direction of movement (toward attraction points), the repulsive force between pedestrians or pedestrians and obstacles such as walls or columns are formulated in the momentum equation.
The position and speed of the pedestrian are dynamically calculated over time . Pedestrians in AnyLogic take the shortest route, avoid colliding with other objects and pedestrians by analyzing the current environment, and decide on their next steps at each time step in the model simulation. We created a 3-D form of the geometry of the Masjid-Al-Haram (Fig 1 a and b) for this model. The Kaaba, Place of Abraham, entrance gates, divider walls in Masa’a, and many other details are included in the model. We have simulated pilgrims’ movements in the Masjid-Al-Haram from when pilgrims enter the site up to the point that they finish one complete round of Tawaf and Sa’ay and leave the area. Fig 1c exhibits the simulated paths of pilgrims in Masjid-Al-Haram. It is assumed that pilgrims randomly enter the Masjid from five main gates at a predefined rate. They go to Mata’af (following the cyan color arrows) and are randomly distributed in a distance between 0.5 m and 50 m from the Kaaba in the nearest location to their ingress gate and start circulating around the Kaaba (Tawaf). After seven rounds of circulations (following green color arrows), they leave Mata’af and go to a randomly assigned praying spot outside the Mata’af area (following yellow color arrows). Pilgrims pray there for about five minutes before leaving for Masa’a building using a path outside the Mata’af area (following purple color arrows). Pilgrims enter the Masa’a building near the Safa hill and begin their Sa’ay ritual (following blue color arrows). After seven rounds of Sa’ay, pilgrims leave the Masjid from one of the five main gates (following red color arrows).
To simulate and direct pilgrims’ movements around Kaaba in Mata’af, we first created 36 fifty-meter radial lines around Kaaba, each divided into 100 half-meter segments. Pilgrims had to cross one of these segments when passing the radial lines. Using this high-resolution setting for the path of pilgrims for the Tawaf ritual, it was possible to control the movements of pilgrims in half meters distance ranges perpendicular to Kaaba. This allowed us to set the average radius of each circulation path, the extent of movement perpendicular to the circular motion, and the density of pilgrims in different locations before running the simulation. This also allowed us to implement various movement patterns such as wavy motion, and social distancing perpendicular to the circulation in the Tawaf which had been practiced during the 2020 and 2021 Hajj. Code walkthroughs and time measurements were used to verify the simulations.
According to , the average speed of pilgrims was assumed to be 1.1±0.1 (m/s) in low-density areas. Since the movement of pilgrims was controlled by the embedded social forces method in AnyLogic’s Pedestrian Library, the speed of pilgrims in high-density locations was adapted based on population density. Because of the randomness of movement, different time of entrances, different lengths of circulation on each circle and time of Tawaf, differences in approaching or departing direction of pilgrims that were entering or exiting Tawaf with who were circulating, different densities and consequently various speeds formed in Mata’af. In the model, we set the rate of entrance and path of pilgrims from the entrance gates to the Mata’af, and let pilgrims randomly uniformly were distributed over 100 circles around the Kaaba. All other movements were automatically controlled by the Pedestrian Library which simulates the motion like the real pedestrians. Initial tests of the model showed that using this setting, we can simulate different numbers of populations. At a population of more than 4,000 people, some congestion occurred behind the Place of Abraham near the Kaaba, which was similar to what had been observed in the real world.
The average time that pilgrims spent in Tawaf and Sa’ay was measured for different numbers of the total population. The average time in Tawaf was about 850 seconds (14 minutes and 10 seconds) when the number of pilgrims in tawaf was below 3,000, and around 1,600 seconds (26 minutes and 40 seconds) for 3,000-5,000 pilgrims. As the number of pilgrims increases, congestions start to occur that reduce the average speed of pilgrims further. The average time that pilgrims spent in Masa’a was about 3,100 seconds (51 minutes and 40 seconds). Although a small congestion area in the Masa’a building formed when the total number of pilgrims increased, it did not induce a meaningful change in each pilgrim’s time spent in the Masa’a, for up to 10,000 individuals. These values were consistent with the kinematic motion of pilgrims with the predefined average speed in the length of the path they should pass and the measured times in the Masjid-Al-Haram .
Close contacts are one of the main contributors to COVID-19 disease transmission. The CDC defines a close contact as someone who is within two meters of an infected person for at least 15 minutes within a 24-hour period . We adopted this definition for contact, without specifying the infection status of individuals and considering the duration of contact, to calculate the number of such events taking place. We used two approaches: 1) A Monte Carlo sampling simulation to obtain the potential contacts between individuals in an area one moment in time, and 2) A simplified version of the simulation-based contacts matrix calculator method presented by [23,24].
For the first method, it was assumed that different total numbers of individuals with an area of 0.15 m² were randomly distributed in an area with a certain geometry in a moment. Pairwise distances between all individuals were calculated. Distances less than two meters were taken as a contact. For each number of contacts, the average number of individuals who had at least one contact, and the maximum number of contacts with one other individual were calculated. The generation of the pilgrims and the calculation of distances (New simulation run) were repeated until the simulated number of contacts remains approximately constant. The results of this simulation are estimates of contacts in an area in a time step of a dynamic movement. All calculations were done using a Python script.
In the second method, [23,24]’s methodology was used to calculate the number of contacts. In this model, each pilgrim finds other pilgrims within a two-meter radius of himself/herself (close contact) at every time step. In short, if each close person is not the same as the people that were in close contact in the previous time step, a new contact case is added to the pilgrim's contact memory. These calculations begin when a pilgrim is at the entrance gate and stop when the pilgrim leaves the Masjid-Al-Haram. The contacts are accumulated during the ritual for each pilgrim and averaged over all pilgrims. We calculated the number of contacts in different locations of the Masjid-Al-Haram and normalized it for the total number of pilgrims. In addition, we calculated the unique contacts that each pilgrim experiences during the ritual. This was done by recording the new contacts in the memory of the pilgrim without considering the time of contact.