Among other things, my training as a physicist has included numerical modeling of complex systems. My undergraduate thesis was a simulation of stellar evolution in a close binary system. In my more recent research, I have dabbled with heat flow simulations through porous meteoritic materials. While I do not pretend to be a fully skilled programmer, this work has given me a breadth of experience with various computer languages such as C, Fortran, IDL, and Python.
So now here I am, stuck in San Jose, CA where I happened to be when the dreaded coronavirus struck. Like everyone else, I am currently housebound without the usual activities that generally keep me occupied. Like everyone else, the pandemic has presented me with discouragement, boredom, and anxiety. But I am a problem-solver, so one of my ways of coping with the uncertainty of the c-virus is to treat it as a scientific problem.
I went straight to the computer and created a model in Python to better understand virus spread.
First, a DISCLAIMER:
Everything presented below is amateur work. I do not claim to include a realistic model of human behavior. The model does not include such important factors as climate, seasonal behavioral changes, social interaction standards, public transportation, secondary transfer of the virus (through surfaces, etc), and so on. It presents a qualitative result, but I make absolutely no claims about its ability to quantitatively predict the outcome of this current pandemic. If you are looking for meaningful data, I refer all readers to the proper sources: World Health Organization, Centers for Disease Control, etc.
I created a city of 200,000 citizens. Each citizen was assigned a household. Likewise, each citizen was assigned a workplace or school (based on age). Retired citizens or some few work-from-home citizens were assigned their own home as the workplace.
Households contain anywhere from 1 to 10 persons, based on a Poisson distribution centered around 2. Elementary schools hold 100 students each (plus a few teachers). High schools hold 300 students each (plus a few teachers). Each office (workplace) holds 30 people. Each venue was also assigned a physical size that would affect how closely packed together the occupants are.
Each day is divided into three time periods. In the first period, people go to their assigned work places. For those who remain at home, a certain percentage (I used 10%) will choose to visit another home or go out to public venues: shops, restaurants, or entertainment venues. (These each have different occupant capacities and physical sizes.) Any overflow ends up on the street.
In the second time period, everyone goes home from work, but some percentage (20%) will go visit other homes or public venues. Then, for the third time period, everyone goes home for the night.
One person (“patient zero”) was contaminated with the virus on day 0.
For each time period, and for each location, the occupants are randomly assigned coordinates. If a non-exposed person is within 3.5 feet of a contagious carrier, the person has a 14% chance of catching the bug. (I selected the numbers so that the rate of exponential spread mimics the rate of COVID-19 spread in the US in the first half of March.) If the person is near several carriers, then each carrier has a chance of spreading the bug.
Once a person has been exposed, they have two days before they become contagious. After that, they have anywhere from about 2 to 12 days to manifest symptoms (the bounding values are not hard cut-offs). Each sick person might be either mildly sick, very sick, or critical.
Critical cases go to the hospital, if there are sufficient beds to support them. I set the number of beds to be 2 per 1000 occupants (i.e. 400 beds), which is loosely based on the average number of available ventilators in major cities.
For each day, I recorded the cumulative number of cases, the number of active cases, the number of contagious, sick, critical, in hospital, recovered, and dead.
Next, I programmed a number of scenarios in which certain mitigation strategies were invoked. These involve: keep the sick people home from work, keep the sick and their families home from work, close entertainment venues, close schools, close offices, quarantine the sick, quarantine the sick and their households, and finally the State of Emergency. In the State of Emergency, after 0.4% of the population (800 people) falls sick, schools, offices, and entertainment venues are closed, and shops have capacity reduced to only 10 persons each. In addition, during the State of Emergency the population will engage in social distancing, which in this simulation means not going out to other venues. Before running the simulation, I can set the percentage of the population that will comply to the social distancing order.
I focused on two plots: the S-curve for the cumulative number of cases over time, and the plot of critical cases vs. time (i.e. the “flatten the curve” curve). Each mitigation scenario resulted in a different percentage of the population catching the virus, and a different peak for the critical-case curve. However, the only scenarios that really made a significant dent are the ones that involve heavy quarantine and/or social distancing. While closing schools and offices is helpful and important, it only works if people STAY AT HOME.