Skip to main content
SciNet
  • Home
  • All Courses
  • Calendar
  • Certificates
  • SciNet
    Main Site Documentation my.SciNet
  • CCDB
  • More
Close
Toggle search input
English
English Français
You are currently using guest access
Log in
SciNet
Home All Courses Calendar Certificates SciNet Collapse Expand
Main Site Documentation my.SciNet
CCDB
Expand all Collapse all
  1. Dashboard
  2. PHY1610 - Winter 2021
  3. 5. ODE

5. ODE

Completion requirements
Opened: Thursday, 18 February 2021, 12:00 AM
Due: Thursday, 25 February 2021, 11:55 PM

Consider the so-called SEIR model of the spread of an infectious disease (and note: all models are wrong).

In this model, a population is split up into four 'compartments':

  • s is the fraction that is susceptible to the disease,
  • e is the fraction that has been exposed to the disease,
  • i is the fraction that is infectious,
  • r is the fraction that has recovered.

All fractions are between 0 and 1 and the sum of s, e, i, and r is equal to 1.

In the SEIR model without births or deaths, these fractions satisfy the following set of ODEs:

$$\frac{ds}{dt} = -\beta(i(t))\,i(t)\,s(t)$$

$$\frac{de}{dt} = \beta(i(t))\,i(t)\,s(t) - \alpha\, e(t)$$

$$\frac{di}{dt} = \alpha\, e(t) - \gamma\, i(t) $$

$$\frac{dr}{dt} = \gamma\, i(t)$$

where

  • \(\alpha\) is the incubation rate,
  • \(\gamma\) is the recovery rate.
  • \(\beta\) is the infectious rate. In this assignment, it varies to model preventive measures that may have been taken based on the fraction of infectious people in the population. In particular, we will use

    \( \beta(i) = \beta_0 \exp( -i^2/\delta^2)\)

  • \(\delta \) can be viewed as the typical infection fraction at which preventative measures would start to be taken (distancing, masking, stay-at-home, etc.).
For this assignment, the parameter values are

$$\alpha=0.2$$

$$\beta_0 = 2$$

$$\gamma=0.06$$

$$\delta = 0.16$$


You need to write a code numerically solve this four-dimensional ODE with an absolute tolerance of 10-8 over a time T=160 starting from the initial conditions:

$$s(0) = 0.999$$

$$e(0) = 0.001$$

$$ i(0) = 0$$

$$ r(0) = 0$$

Your code should output 161 time points between t=0 and t=160 to a file. Each time point should be a line in this file, with the values of the time, s, e, i, and r, separated by a space.

Use either the GSL library or the BOOST odeint library to accomplish this.

Next, you will profile this code to see where it spends most time. You will notice that the program runs very quickly, which makes profile sampling difficult. Make your code arbitrarily slower by, within the code, doing the same calculation 10,000 times.

Then, profile your code with MAP and with the Performance Reports.

As in previous assignment, you should use git version control for your code, it should be well commented, and have a Makefile.

Submit your git2zip-ed repo, along with the screenshot of the MAP application's analysis of the code and also the html version of the performance report, by midnight Thu February 25th, 2021. The late policy can be found in the syllabus.

Contact site support
You are currently using guest access (Log in)
Data retention summary


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Powered by Moodle