Pope Francis draws huge crowds -- and it takes science to keep everyone safe. (Patrick Baz/AFP/Getty Images)

There are celebrities who can fill stadiums, and then there are celebrities who can fill an entire metropolitan area's every nook and cranny. Pope Francis seems to be one of the latter. As he makes his way to the United States for his first trip, his visit is being awaited by members of the public eager to get his blessing — or maybe just a sight of the Popemobile — at a variety of parades, Masses and public events. Estimates of the throngs vary from tens of thousands to millions, and all that anticipation is tinged with a bit of worry. What if the pope’s Masses turn into mass chaos?

Crowd safety and risk analysis specialist G. Keith Still isn’t in charge of the papal festivities, but he has plenty of experience with ginormous groups of people. As a consultant at events from SXSW to the 2011 royal wedding, he’s racked up decades of insight into how huge crowds work. In fact, he said, there’s a science behind mass gatherings.

[Pope Francis arrives Tuesday. If you need to come downtown, leave your car at home and add extra time to your trip.]

“It’s all about math, management and psychology,” said Still, who is developing a master’s program in crowd management at Manchester Metropolitan University in Britain. It turns out that crowds are packed not just with people, but with science — and by mastering measurements and simple physics, event planners can be taught to anticipate and manage risk at mass events. After measuring an area’s safe capacity (about four people per square meter), crowd planners can model how people move, determine thresholds for opening or closing public spaces, and analyze a crowd as it progresses.

Thousands of residents and pilgrims lined Pope Francis path as he made his way to a Mass in the capital city of Quito. (Reuters)

As an area gets overcrowded, things get risky. In a religious gathering, it's especially important to mind the paths that people will expect to move in -- the flow of the religious ritual they hope to participate in. “Unless you can facilitate that, you end up creating behaviors that are frustrated,” Still warned — frustration that can lead to crushing and “shock waves” in which people push forward and topple like dominoes.

Many people were disappointed in the seemingly paltry number of tickets available to the pope’s Masses. But inaccurate calculations or the failure to adequately ticket the event can make even peaceful groups turn into panicked ones. After all, said Still, even the biggest shapes “still have finite limits.”

[A visual guide to navigating Pope Francis’s visit]

While old-fashioned geometry is a crowd manager’s best friend, so is human nature. Despite having complex tools like RAMP analyses, density models and theories of crowd causality at his disposal, Still pointed out that they’re nothing without some basic human understanding. “Crowds are dynamic systems,” he said, “but they’re made of people.” Still hoped that crowd management during the pope’s visit is tailored to Catholics — the way they pray and move during a Mass. After all, he spent years studying Islamic culture and religion before making recommendations on ways to make Mecca’s Hajj pilgrimage more safe.

So what’s the worst-case scenario when it comes to managing a Mass-mad crowd? Still, who studies near-misses and historic crowd disasters, said that once too many people flood into an area at one time, it can be too late. He points out that once a situation escalates from crowd management to crowd control, officials often have a real problem on their hands. “It’s like trying to push an egg back into a chicken,” Still warned. “It’s going to hurt, the chicken’s going to end up squawking, and something’s going to break.”

Erin Blakemore (@heroinebook) is a freelance journalist from Boulder, Colo. She is the author of "The Heroine’s Bookshelf" (Harper). 

Read More:

How a Virginia physicist can predict the Tour de France’s outcome from 4,000 miles away

Could Burning Man cause an earthquake? A seismologist weighs in.

Why a coffee is more likely to spill than a latte

You’re surrounded by a cloud of bacteria as unique as a fingerprint