TITLE: Virus community spread mathematical modeling
QUESTION [8 upvotes]: What is the basic math behind the Virus community spread mathematical modeling,and how the time variable;(in these models),interacts with knowledge (data)?.
I am not asking about how the virus is transmitted or how it replicates.

REPLY [5 votes]: There is actually a very simple model that works reasonably well over time periods with little change. No model can work across all time periods because various communities (or cities) change their behaviour drastically at certain time points. But for each interval during which the community's behaviour is roughly constant, the following model seems to hold quite well for sufficiently large communities:

$x = a+\frac{n}{2}·\Big(\tanh\big((t-c)·\frac{r}{2}\big)+1\Big)$, where $x$ is the total number of cases and $t$ is time, for some constants $a,n,c,r$.

What do these constants mean? There are two main kinds of drastic behaviour change that marks the start of the current interval.
The first kind introduces new infected people into the community (imported cases) after it has already stabilized, in which case $a$ is the total number of previous cases and $n$ is the total number of new cases that will appear under current conditions (i.e. if the current interval has no endpoint). The second kind changes the connectivity graph (e.g. lockdown) or the susceptibility of people to the virus (e.g. wearing mask), in which case $a = 0$ and $n$ is the total number of cases that will result under current conditions.
$c$ is simply the inflection point at which the rate of growth is maximum in the current interval.
$r$ is the rate parameter for exponential growth from (roughly) the same starting amount. Specifically, both $n·\exp((t-c)·r)$ and $\frac{n}{2}·\Big(\tanh\big((t-c)·\frac{r}{2}\big)+1\Big)$ are asymptotically the same as $t→-∞$, but diverge from one another as $t→∞$.
Why this relation? Well, consider the following differential equation:

$\frac{dy}{dt} = s·y·(n-y)$ where $y=x-a$.

It assumes that the rate of increase in cases is proportional to both the current number $y$ of cases that have been allowed to infect others and the number of cases that would be but have not yet been infected. These are obviously motivated by the fact that the current conditions will lead to some final total and the virus infection rate will be proportional to the number of infected-but-not-isolated cases and the number of to-be-infected cases, and the fact that the infected-but-not-isolated cases is proportional to the allowed-to-infect-others cases.
Solving it gives $\ln(y)-\ln(n-y) = s·t + k$ for some constants $s,k$ and hence we obtain $y = n·\Big(1-\frac1{\exp(s·t+k)+1}\Big) = \frac{n}{2}·\Big(\tanh\big(\frac{1}{2}(s·t+k)\big)+1\Big)$ as desired.