# What Is a Computer Simulation and How Does It Work? A Deep Dive.

Whether it’s predicting how viruses spread or forecasting weather conditions, computer simulations replicate real-world events so we can plan for the future.

Written by Mike Thomas
Image: Shutterstock
UPDATED BY
Jessica Powers | Jan 12, 2023

Computer simulations are programs that run various mathematical scenarios to determine the potential scope or impact that a particular scenario could have.

For example, simulations help car manufacturers to virtually crash test their new lines of vehicles. Instead of physically crashing dozens of new cars, researchers run simulations to see all possible scenarios that could occur to both the vehicle and passengers in a multitude of accidents. These simulations determine if the car is safe enough to drive.

The idea is that computer simulations allow researchers to replicate possible real-world events — ranging from the spread of infectious diseases to impending hurricanes — so we can save time and money planning for the future.

## What Is a Computer Simulation?

Put simply, computer simulations are computer programs that model a real-life scenario or product and test many possible outcomes against it.

“If it’s too large-scale, too expensive or too risky to work with the real system itself — that’s why we use computer simulation,” Barry Nelson, a professor of engineering at Northwestern University, said. “Simulation allows you to create data or systems that are conceptual, that people want to build, want to consider or want to change. I sometimes say that simulation is data analytics for systems that don’t yet exist.”

## Computer Simulation Definition

A computer simulation uses mathematical equations to model possible real-world scenarios, products or settings and create various responses to them. It works by duplicating the real-life model and its functions, and once the simulation is up and running, the simulation creates a record of what is being modeled and its responses which is translated into data.

Although computer simulations are typically used to test potential real-world scenarios, they can be more theoretical too. In 2016, scientists at Argonne National Laboratory near Chicago, Illinois concluded that it would take only a couple of months for zombies to overrun the city and wipe out its population.

Fortunately, we now have “the knowledge to develop an actionable program to train the population to both better defend themselves against zombies and also take offensive actions that are the most effective,” Chick Macal, an Argonne senior systems engineer, told Built In. Phew.

Zombies aren’t real, but infectious diseases are. Macal and his co-researchers wanted to predict how more plausible infectious diseases might spread, and to determine the most effective methods of intervention and policy action. Their research relied on what’s called agent-based computer modeling and simulation. This method has allowed researchers in all types of academic disciplines and commercial industries to figure out how things (equipment, viruses, etc.) would function or act in certain environments without having to physically replicate those conditions. In the case of Macal and his cohorts, that means no humans living — or undead — were harmed in the course of their work.

Macal’s colleague, computational scientist Jonathan Ozik, described this part of their work as the “computational discovery of effective interventions,” and it’s especially good at working with a particular population of people. An added benefit, he said, is that “we can do these experiments without worrying about the cost of experiments or even ethical and privacy considerations,” because the populations they study are synthetic, mathematical representations, not the real thing.

Read Next: What Is Quantum Computing?

## How Do Computer Simulations Work?

Computer simulation is a step-by-step process in which a computer simulation program is modeled after a real-world system (a system can be a car, a building or even a tumor). In order to replicate the system and possible outcomes, the simulation uses mathematical equations to create an algorithm that defines the system’s state, or the combination of different possible variables.

If you’re simulating a car crash, for example, the simulation’s algorithm can be used to test what would happen if there was a storm during the crash against what happens when the weather is more mild.

The simulation calculates the system’s state at a given time (t), then it moves to t+1 and so on. Once the simulation is complete, the sequence of variables are saved as large datasets, which can then be translated into a visualization.

“We’re not interested in simply extrapolating into the future,” Macal said. “We’re interested in looking at all the uncertainties as well as different parameters that characterize the model, and doing thousands or millions of simulations of all the different possibilities and trying to understand which interventions would be most robust. And this is where high-performance computing comes in.”

Thanks to the robust data-crunching powers of supercomputers, simulation is more advanced than ever — and evolving at a rapid pace.

The computational resources at their disposal, Ozik said, allow researchers “to fully explore the behaviors that these models can exhibit rather than just applying ad hoc approaches to find certain interesting behaviors that might reflect some aspect of reality.”

Which is to say, the simulations are much broader, and therefore even more realistic — at least from a hypothetical perspective.

### Computer Simulations in the Real World

Plenty of simulations are done with far less computing power than Argonne possesses. Alison Bridger, department chair of meteorology and climate science at San Jose State University in California, said on-site cluster computers are strong enough to run the climate simulation models she builds. Cloud computing services like those offered by Amazon (AWS) and Microsoft (Azure) are gradually gaining a foothold in the space as well.

Along with nuclear physics, meteorology was one of the first disciplines to make use of computer simulation after World War II. And climate modeling, Bridger said, “is like a close cousin of weather forecasting. Back in the 1960s, people used early weather forecasting models to predict the climate. Before you can predict the weather, you have to be able to properly reproduce it with your model.”

Bridger’s work employs a widely used “local scale” model called WRF, which stands for Weather, Research and Forecasting and can produce “reasonably good simulations of weather on the scale of, say, Northern Illinois — so Chicago up to Green Bay and down into the central part of the state. It will forecast things like high and low temperatures, rain and so forth. And it’s typically only run to simulate 24, 48 or 72 hours of weather.”

In further explaining her process, Bridger employs the imagery of a cube centered over Chicago that’s roughly a kilometer east-west by a kilometer north-south. The goal is to predict the temperature in the cube’s center and extrapolate that reading to the entire thing. There are also, in her telling, additional cubes surrounding the initial one “stacked up all the way to the top of the atmosphere” whose future temperatures will be predicted in various time increments — in an hour, in 12 hours, in one day, in three days and so on.

Next, temperature-affecting variables are added to the mix, such as amount of sunshine, cloud cover, natural disasters like wildfires and manmade pollution. It’s then a matter of applying the laws of physics to determine a variety of weather-related events: rising and falling temperatures, amount of wind and rain.

Computer simulations can be used for much more than climate and weather predictions.

## 6 Examples of Computer Simulations

Whether scientists want to better understand healthcare responses or even explore blackholes, computer simulation allows for important research opportunities. Here are six that stand out:

### 1. Responding To Pandemics

Along with Ozik and their fellow researcher Nick Collier, Macal also worked on a modeling and simulation project that determined what might happen if the deadly Ebola virus — which initially spread through West Africa in 2013 through 2016, with devastating effects — would impact the U.S. population. Part of that process involved visiting Chicago hospitals to learn about Ebola-related procedures, then incorporating those procedures into their models.

### 2. Improving Cancer Treatment

Other Argonne scientists have used modeling and simulation to improve cancer treatment through predictive medicine, finding out how various patients and tumors respond to different drugs.

And one 2019 study found positive results in simulating breast cancer tumors. For the study, researchers built a computer simulation that modeled tumors from four different patients under 12-week therapy treatments. After two of the simulated tumors didn’t respond to treatment, they concluded that more frequent, lower doses of chemotherapy could reduce a low proliferative tumor, while lower doses of antiangiogenic agents helped poorly perfused tumors respond to drug treatment better.

### 3. Predicting Health Code Violations

In Chicago, the city’s Department of Public Health uses computer modeling and simulation to predict where critical violations might pop up first. Those restaurants are then bumped to the top of a 15,000-establishment list that’s overseen by only three dozen inspectors. And apparently it’s working: One simulation yielded 14 percent more violations, which ideally means earlier inspection and a lower chance of patrons getting sick from poorly refrigerated fish.

### 4. Understanding Our Relationship with Religion and Crisis

Computer simulation is being used in interesting ways at the University of Boston. Wesley Wildman, a professor of philosophy, theology and ethics, uses computer simulation to study — as he put it in an article for The Conversation — “how religion interacts with complex human minds, including in processes such as managing reactions to terrifying events.”

In order to do so, he and his team designed a world and filled it with computer-controlled characters, or “agents,” that are “programmed to follow rules and tendencies identified in humans through psychological experiments, ethnographic observation and social analysis.”

Then they observed what happened when their agents were tested against real-world examples like a massive earthquake that struck Christchurch, New Zealand in 2011.

“The better our agents mimic the behavior of real humans in those sorts of circumstances,” Wildman said, “the more closely aligned the model is with reality, and the more comfortable we are saying humans are likely to behave the way the agents did in new and unexplored situations.”

### 5. Researching Earthquakes

In Germany, a team at the Leibniz Supercomputing Centre performed earthquake simulations using the devastating Indian Ocean earthquake of 2004, which spurred a massive tsunami, as their point of origin.

According to Professor Michael Bader of Germany’s Institut für Informatik, they wanted to “better understand the entire process of why some earthquakes and resulting tsunamis are so much bigger than others. Sometimes we see relatively small tsunamis when earthquakes are large, or surprisingly large tsunamis connected with relatively small earthquakes. Simulation is one of the tools to get insight into these events.”

But it’s far from perfect. New York Times reporter Sheri Fink detailed how a Seattle-based disaster response startup called One Concern developed an earthquake simulation that failed to include many densely populated commercial structures in its test-runs “because damage calculations relied largely on residential census data.” The potential real-world result of this faulty predictive model: Rescuers might not have known the location of many victims in need.

### 6. Exploring Black Holes

In 2022, researchers built a black hole simulation by modeling a single-file chain of atoms to create the event horizon of a black hole. This led to the team observing Hawking radiation, the hypothetical theory that particles formed by the edge of a black hole create temperatures that are inversely proportional to a black hole’s mass.

Although the research is still in its early stages, this could potentially help scientists understand and resolve the differences between the general theory of relativity and quantum mechanics.

## Uses of Computer Simulation in Different Industries

In the past 75 years, computer modeling and simulation has evolved from a primarily scientific tool to something industry has embraced for the purposes of optimization and profitability.

“Industry is embracing simulation at a faster rate than ever before and connecting it to what I would call data analytics for things like scheduling and supply chain management,” Macal said. “Industry is trying to simulate everything they do because they realize it’s cheaper and quicker than actually building a prototype system.”

When Northwestern’s Nelson spoke with Built In, he had recently returned from the annual Applied Probability Conference. There, the simulation applications discussed included but weren’t limited to the following: aviation modeling, cybersecurity, environmental sustainability and risk, financial risk management, healthcare, logistics, supply chain and transportation, semiconductor manufacturing, military applications, networking communications, project management and construction.

Find out who's hiring.
See jobs at top tech companies & startups

“Frequently, companies that use simulation want to optimize system performance in some sense,” Nelson said, using a car company that wants to build a new assembly plant or decide what vehicles to bring to market as an example.

“So optimization is a key to lots of business in industry, but optimal solutions are often brittle,” he continued. “By which I mean, if small issues about the assumptions or the modeling approximations you made are wrong, then suddenly something that appeared to be optimal in your model can be catastrophically bad.”

Nelson added: “When people build mathematical and computer models, even though the model may have been built from data, they treat it as if the model is correct and therefore the solution that [results] is optimal. What we try to do is continue to incorporate in the model the uncertainty that was created when we built it.”

The financial crisis of 2008, Nelson said, is one instance where model risk was detrimentally downplayed.

“The financial industry uses a tremendous number of very sophisticated mathematical computer modeling [methods],” he said. “And it’s quite clear that the correlations among various financial instruments and securities and so on were kind of ignored, so we got cascading failures.”

Such cautionary tales, however, don’t mean that those who create the mathematical and computer models on which simulations are based must strive for perfection, because no model is perfect and models drive progress. Demanding perfection, Nelson said, “would paralyze us. But as we start to make more life-critical decisions based on models, then it does become more important to account for risks.”

Related Reading: 17 High-Performance Computing Applications and Examples

## The Future of Computer Simulations

Imagine this: It’s years from now and someone you know has been diagnosed with a cancerous tumor. But instead of immediately bombarding them with radiation and highly toxic chemotherapy drugs and hoping for the best, doctors instead perform tests from which they create a mathematical, virtual twin of that person’s malignant growth. The digital replica is then subjected to computational interventions in the form of millions or even billions of simulations that quickly determine the most effective form of treatment.

It’s less fantastical than it sounds.

“Recent developments in cancer-specific ‘big data’ and experimental technologies, coupled with advances in data analysis and high-performance computational capabilities, are creating unprecedented opportunities to advance understanding of cancer at greater and more precise scales,” the National Cancer Institute reported.

Find out who's hiring.
See jobs at top tech companies & startups

Other revolutionary developments with far-reaching impact are already being implemented.

As Los Alamos National Laboratory physicist Justin Smith told Science Daily, “we can now model materials and molecular dynamics billions of times faster compared to conventional quantum methods, while retaining the same level of accuracy.”

That’s good news for drug developers, whose researchers study molecular movement in order to see what’s suitable for use in pharmaceutical manufacturing, as well as patients who are all too often caught up in a detrimental guessing game when it comes to treatment.

Penn State researchers working in tandem with colleagues at the University of Almeria in Spain developed “a computer model that can help forecasters recognize potential severe storms more quickly and accurately.” As Steve Wistar, a senior forensic meteorologist at AccuWeather, explained, the tool could lead to better forecasts because he and his fellow forecasters will have “a snapshot of the most complete look of the atmosphere.”

And so, while we may or may not be living in a computer-simulated world, the world is being transformed by computer simulation. As computers get faster and research methods more refined, there’s no telling where it might lead.

Mudi Yang, a cosmos-simulating high school senior from Nashville, put it eloquently when he said, “Computer simulations gave us the ability to create virtual worlds, and those virtual worlds allowed us to better understand our real one.”

### Recent Hardware Articles

What Is LiFi?
What Is Nanotechnology?
What Is LiDAR?