The Portuguese pandemic model updated results

After some days of model development and calibration it is now time to see if our work can predict the outbreak in Portugal.

Using yesterday’s data of the Portuguese outbreak we can see if the model can keep up with the outbreak evolution.

The new infections per day report:

The results show that there is a diference from the predicted infections compared to the actual measured infections.

From the graph we can see that the model can still predict the evolution up to now.

From the close up image we can see a horizontal offset. We will need more time to evaluate if this will continue on probably due to mitigation and suppression activities or if it is simply a counting issue.

The way we affect our model may change from a simple decay function to something really messy to represent reality.

Model details can be seen on a previous post:

COVID-19 pandemic growth in Portuguese territory

It takes a virus to make us reflect about our daily comutes. A COVID-19 reflection.

Our daily comute to work, for many of us, is our first morning journey, however some of us travel from point A to point B during work, some of us can traverse many factories, shops and houses as part of our job. Interestingly many eventually will go to the supermarket, some daily, others weekly and others monthly depending on their personal planing, but we all need to eat! Even going beyond the supermarket, one needs to have lunch at work, where many go out of work to eat, use a canteen, eat in workplace or eat at home.

For those that eat in a canteen or go out to eat, a new norm seems to be growing with the COVID-19 pandemic.

• Social distancing will be required for now on,
• Maximum entrance capacity limit (no more crowded rooms),
• Hygiene etiquete

The places we eat or get food are places of gathering, and they seem to be the perfect places to know where any virus lurks and is transmitting.

For these reasons my recommendation is to be cautious in these zones for they will be the zones with high probability of transmission.

As we enter in community spread, active suppression in these zone will have many advantages:

• Stop mass community transmission,
• Segregate positives and their relatives,
• Get to know the transmission circuit

Since resources are limited suppression measures need to be used rationally, however if we get an idea of virus spread we can more actively direct our efforts. Since “feeding” zones are points of convergence it might well be a good starting point to statistically apply suppression methods, for any positive will give valuable information of virus infection state geographical localisation.

COVID-19 pandemic growth in Portuguese territory

All over the world we start to get richer datasets of the pandemic evolution in each country. Portugal is a small country on the western extremity of Europe next to Spain. Let us examine the numbers.

The results are based on the python code shared by: https://scipython.com/book/chapter-8-scipy/additional-examples/the-sir-epidemic-model/

With some modifications to take into account transmission rate and mean recovery time variation through time.

I also have to share some good resources from Stanford University and the Imperial College of London:

On a previous post I introduced the equations:

Why the Western approach to COVID-19 pandemic may be dangerous. Mitigation and Suppression effects seen on the models.

On my model Instead of having a constant β and γ we have time dependent functions B and G based on the decay function:

Measured data was gather from HDX compiled by Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE).

Here we can see the daily infection cases in Portugal which is following an exponential.

And also observe the current pandemic infection count in Portugal:

The resulting B and G estimation curves can be seen bellow:

The model seems to fit well to the measured data at least for now.

Zooming out we get:

And yet another view:

The model predicts the following:

If the prediction is correct we should expect to have at the peek of the crises 331388 reported infection cases. Hopefully less than 2% of these will require a ventilator (6627 ventilators). My concern is that the usage time of ventilators can be greater than the 14 days estimated.

The ability to compensate the model curve based on time dependent factors is efficient to adapt the curve to experimental results.

We can see that the mitigation and suppressive actions have payed off giving a softer but longer epidemic curve.

As we get new measured data, the model precision increases for we refit and generate a new model. If the mitigation actions continue it is expected that the peek value continues to decrease, however time will increase.

My final remarks: there will be no guaranty we can lift the heavy restrictions to contain the spread. Humanity will live in fear and alert until we find a vaccine or get herd immunity.

Be assured there is no containment possible without isolating and testing for COVID-19

At the moment it looks like no one agrees on to whether strong generalised population testing is an effective measure. Some argument that it will create a generalised sensation that there is no need for social distancing, others argument that it is simply bad usage of resources.

However the real data shows that no country a side from those which closed borders, used testing and 14 day quarantine like in Asia (Macau for example) could actually contain the virus from entering inside the population. The countries that hopped to contain it inside their population failed completely. They failed to understand the virus strengths.

As the virus propagates throughout the population, and as we can only pick 20% of infections it is clear that only a combined approach of testing and isolation is possible to regain the upper hand again. One idea is to all of us stay at home and don’t leave for any reason for about 14 days, however this does not seem a good solution. Another option is to isolate enough so that we make the curve linear in some way until it drops. That however can take very long with economic damaging effects.

Testing with isolation can give strong results on small localities where the virus hasn’t propagated in a generalised manner. After a containment fail everywhere I am expecting that eventually there will be a need to deal with the pandemic in an organised manner. How?

• Region based lockdown;
• Test and isolate strategy;
• Re test and free up for commerce.
• Determine how many and where distributed the population that have already built defences agains the pathogen.

When dealing with a complex problem, one needs to divide in simple problems. Each region will not have direct contact with the others, unless for commercial goods distribution which should be disinfected.

Every time one region gets freed from the virus, commercial activities resume but isolation with other maintains. This strong but effect strategy by dividing and conquer method allows to dedicate resources to the active zones, meanwhile maintaining the economy running and releasing steam on some part of the population and local economy, also giving hope to the heat zones that their time will come.

We cannot take effective measures if the virus appears everywhere and at any point in time.

How to make this happen isn’t easy for it may require to reduce population liberties even further, like for instance.

• Population tracking;
• Population forced confinement to an even harsher level;

Tracking would be necessary because if any infected individual traverses the border we lose confidence on our measure and the virus silently propagates.

Every time someone goes out it poses a risk to general community spread.

If done gradually every country can muscle their measures on a step by step approach internally but at a huge social liberty cost.

However this is not enough. Population in general is a sitting duck to this virus. And since the world cannot wait 1 year for a vaccine, all of us need to think how we can take advantage of the virus fast propagation against itself and immunise population to create a barrier to those which cannot defend themselves agains it. Most of the measures so far, are to save lives reducing the burden on the healthcare system but at a cost that can send humanity to an even worst scenario of economic chaos.

Are the infection reports of COVID-19 we see disclosed by governments accurate?

As the pandemic progresses every day, each government reports the number of infected persons per day, the number of deaths and the critical state patients. But how does the the governments get to know the numbers? Basically every time someone reaches the healthcare system, and is a suspect, they will be tested. If positive, he or she we will be counted as a new infection. Also if the healthcare system test individuals without a reason and are positive they will also be counted.

The accuracy of the numbers with this approach will depend on how the pathogen operates. If the infected person detects symptoms before spreading it and contaminating others, or the infected person dies, the numbers will be quite accurate.

However on cases that transmission time is large and asymptomatic most of the infection period, the reported numbers are unrealistic.

The COVID-19 pathogen combines three important behaviours:

1. It may or not produce symptoms;
3. Produces symptoms similar to flue on mild to moderate cases and pneumonia on critical cases.

By the time the healthcare system detects a moderate or critical case, the infected individual has already spread the virus without knowing to many others… So the presented numbers will have a low correlation with the state of the spread.

Although the correlation isn’t the best, it is what’s possible to gather at the moment. I can imagine that the correlation will be higher in places the virus infects people which become moderate to critically sick. On places where the population is young, spread geographically and with an immune system capable to deal with the infection, might even pass unnoticed. The correlation will also improve if we test people as much as possible.

If 80% of the population has mild symptoms, these individuals do not go to the healthcare system and no preventive testing done, only 20% will actually call for help and be registered.

It is possible that values measured for total active cases of infection be 5 to 10 times higher than measured. This will depend on the aggressiveness of the virus and population fitness, considering we catch on the healthcare system 20% to 10% infections.

σ is our estimation ratio of the percentage of infected captured by the Healthcare system.

So multiplying the reported value by a number between 5 and 10 will give you a more accurate infection count.

Why the Western approach to COVID-19 pandemic may be dangerous. Mitigation and Suppression effects seen on the models.

Everyone seems to be talking about pandemics now a days, and in all truth the reason is simple life will never come back to what it was for many reasons. The first one is that the world is in a big corner, either we all get immune to the virus or we live in social exclusion until we get immune to the virus. There is a great probability that if we take option two world population will have to decrease or we die either by being killed by some one or of hunger. There seems to be no way out from getting somehow immune to the virus.

Going back to a previous post; models help us understand what will happen if we choose to follow specific scenarios. Contention, mitigation and suppression are the pillar of any pandemic reponse. The contention response is to identify and neutralise all the virus possible whereabouts and is possible and effective at the very first stages of the outbreak. The mitigation response comes into play when the virus whereabouts cannot be determined for it is everywhere and a more broad spectrum of isolation of communities are required to contain the outbreak expansion. The suppression response is defined by an active search of any affected individuals and locations independent of the virus whereabouts. I will focus on the approach of the SIR model defined in: https://scipython.com/book/chapter-8-scipy/additional-examples/the-sir-epidemic-model/

I will not go into many details just cite the model equations that describe the SIR model. And go directly to what the reader wants to know. Where are the variables in the model? What variables can relate to mitigation? What variables relate to suppression? What happens to the simulated outbreak response on any of these two cases?

“The differential equations describing this model were first derived by Kermack and McKendrick [Proc. R. Soc. A, 115, 772 (1927)]:” see link above for original publication.

• S(t) are those susceptible but not yet infected with the disease;
• I(t) is the number of infectious individuals;
• R(t) are those individuals who have recovered from the disease and now have immunity to it;
• β is the effective contact rate of the disease;
• γ is the mean recovery rate where 1/γ is the mean period of time during which an infected individual can pass it on.

The differential equations can be seen below.

The models effective variables are population number N, contact rate β, recovery rate γ and S, I and R initial conditions. Mitigation effects are mostly related to β for the number of people we can influenced is reduced if we stay at home. On the other hand suppressive measures are more related to γ, for we cannot change a virus recovery time without medicine we can only search and isolate contaminated people. Suppressive measures mean we measure everyone and segregate as many times possible until we find all infected. Each time we find a contaminated person before the recovery date we shorten the virus propagation time.

Sending everyone home is a mitigation effect not a suppressive effect because if a contaminated person goes shopping for food there will always be a chance/opportunity to propagate directly and indirectly the infection through out the viral infectious time.

Three experiments were performed to evaluate the efficacy of these approaches:

• Mitigation effect on number of infected β[0.15, 0.2, 0.5] and γ = 14;
• Suppression effect on number of infected γ[7, 14, 21] and β = 0.2;
• Combined effect on number off infected β=0.15 & γ=14, β=0.2 & γ=7 and β=0.15 & γ=7.

Every time we catch an infected subject we reduce the 14 day propagation probability to 1 day if we are lucky and catch really early. Even if we catch the subject on his 7th day of propagation we dramatically impact the pandemic evolution.

So my recommendation is test, test, test, test. The impact is strong!

Hopefully with this simple mathematical demonstration it makes clear that only a combined approach will yield effective and fast results, considering that a vaccine will take some time to be developed. However this is not a solution. The world will have to live in containment until we get some sort of immunity to the infection.

I am completely aware that from theory to practice there is a long and hard way. However I think everyone should be prepared to do what’s necessary to avoid a complete social collapse. On a pandemic scenario we cannot have everyone for them selves because our economic model is a shared model. We base our economy on collective consumption of food, cars, vacations, houses, gadgets, and the list goes on…

Going back to my first post, it makes me be afraid of the Western world approach of Mitigation with not so organised suppression. Western results may not be what everyone expects because this virus can contaminate an individual, spread and not give any symptoms. It seems for this kind of infection suppressive measures combined with mitigation are the correct way to proceed.

Some remarks; although for simplicity I considered staying at home a mitigation effect and active testing a suppressive effect, in reality things are more complicated. If we manage to make an individual stay the 14 days at home with no transmission possibility, all two factors are affected β and γ. In reality population continues to circulate and only time will show, how much we can affect these variables.

My final words:

• We need urgently one central pandemic headquarters – Global;
• We need urgently region epidemic headquarters – Europe – Asia – Africa – America;
• We need to distribute help to the countries that need most;
• We need to distribute fast/updated best practices to everyone;
• We need to find a way to immunise population and have the courage to do it. To wait a year is not an option.
• We need to create virus free zones where we can have more relaxed containment measures to let part of the economy survive.

Novel coronavirus (COVID-19) a World Pandemic where we are now.

I have been following with a bit of apprehension the COVID-19 pandemic evolution around the world, from Asia to pretty much all over the world. Human kind has lived and until now survived many epidemics and pandemics, but this virus seems to have taken everyone by surprise, where even many important nation representatives showed no interest in dealing with the pandemic calling it, a simple flue virus.

The pandemic, initiated in China Hubei Province in Wuhan. After a slow start by the Chinese governement to grasp the scale of the epidemic (at that time) it took tough measures, really going to extremes to contain the virus. It seems that their effort showed results and at this point China controlled the Pandemic in their territory but unfortunately has not solved the problem. Although the number of cases have reduced to zero, or almost there, it is sustained at high control and pressure measures. I can’t see any tourist wait 14 days quarantine to discover China, maybe only a few could afford it. Markets, shops, transportations services that serve millions will have to be limited.

Asian countries took the Pandemic seriously and prepared for the worst, closing borders, testing, isolating contaminated people and preventively reducing human circulation.

Europe on the other hand seems to be the new Pandemic center and Italy, it’s most affected country, having high number of deaths and many new infected cases every day. Throughout all Europe the pandemic seems to be growing without stop. It seems Europe took more time to implement hard measures and seems to be on the defensive side to reduce the number of new cases to avoid overcrowding their health care systems.

In the USA after a dangerous denial period the disease seems to be taking over and forcing many states to take hard measures, which in turn forced their president to declare national emergency. Interesting the UK and Brasil followed the American denial, however the growing numbers of infected people and deaths slowly but surely is changing state representatives opinion, that in turn make their presidents change stance.

In Africa we are starting to see a slow rise in cases, however numbers are expected to explode, in the comming weeks/days, for they do not have the capability that most developed countries have to deal with this pandemic.

This Pandemic, like any other can be dealt with mitigation actions like prophylactic containment and/or by suppression actions, which mainly consists of mass individual testing. The Asian countries and the Western countries are using different tactics to deal with the Pandemic. Asian countries use extreme mitigation actions combined with suppression actions which until now have proven to be effective. Interestingly the Western countries seem to be on the defensive side with mostly mitigation actions, with however not so effective results. A good explanation about this can be seen in the following link: https://www.theatlantic.com/ideas/archive/2020/03/how-we-beat-coronavirus/608389/

Interestingly Italy tried with very good results the usage of suppression actions on the pandemic but on a small scale. The difficulty to implement these actions on large cities with generalised infections is that it requires a great deal of resources and organisation. A good report on this subject can be seen here: https://www.ft.com/content/0dba7ea8-6713-11ea-800d-da70cff6e4d3

Certainly East and West have used models to predict the pandemic evolution, scientists, politics and the general community certainly got shocked when they noticed that doing nothing could yield total chaos. Models predict an insane amount of infected people at the peek of the pandemic.

Models help us understand and predict the behaviour of Pandemics. A good reference to understand what models exist and their boundary conditions can be seen in this article: https://chengjunwang.com/post/en/2013-03-14-learn-basic-epidemic-models-with-python/

The SIR model (S – Susceptible, I – Infected, R- Recovered) can help us understand the severity of our current world situation. For example for a 1 million population, 14 day mean recovery (time during which an infected individual can pass it on) and 0.2 value factor that compensates the rate at which an individual can come in contact with others, gives us a good prediction of what to expected of any epidemic response.

In this demonstration example case, almost all of the population gets infected and we get an infection peek of more than 20% of the population. No health care system can deal with such a wave.

I will end this post with a few questions that are in my mind so far:

• Will the Western approach of low suppression (reactive to symptomatic patients) and high mitigation be enough?
• Are the models used by scientists taking into account the fact that infected people don’t know they are infected and don’t present symptoms?
• Even if we control the outbreak, how will the economy survive if most of us fear a second wave due to lack of immunity towards the virus?
• How long can the world live in social containment?

Understanding what NetGen is doing!

When using FreeCAD 0.17 it is not that difficult to make a simulation of something pressuring a cube that is fixed to the ground. I’t a simple case where we follow the typical simulation procedure… Make drawing, define boundary conditions, generate mesh, solve and get results.

I can understand that I need boundary conditions since these are the essence of the problem. But the mesh seems out of place. Or not… It is the building block of the finite element method where we describe a complex geometry into multiple small connected elements. The mesher will transform the solid in building blocks that represent the geometry we wish to study. We can use a mirrad of element types (block shapes) and the mathematical formulations they hold. NetGen should not be any different it can have tetrahedrons, hexahedrons, … and each specific nodes required…

But a question which came to my mind was how would the element shape originator and the element formulation originator work. Are they the same?Why I make this question? In freeCAD I generate a mesh with NetGen or Gmsh, however I solve it with Calculix and not the solver from NGSolve or Gmsh.

Before attempting a solution, a mesh is generated and thus the shape of the elements is defined and from the images they look tetrahedrons.

I found an answer to my questions in a paper written by one of the Authors of NetGen: Joachim Schöberl: An advancing front 2D/3D-mesh generator based on abstract rules.

The mesh is generated according to a specific sequence from a geometry. First special points are gathered on the corners of the target geometry, next edges have to be detected to then create a surface mesh that follows specific element shape rules; the final step is to create a volume mesh from the surface mesh and another specific rules necessary for element quality.

The output should be a cloud of nodes, elements and their connectivity to each other. From the paper it looks like it is purely connected to the geometry but then what connects to the differential equations we wish to solve? For instance how do I say a line is a beam? Or how do I create a body shell which basically is a shell with thickness.

Here comes the solver part. In case of calculix with NetGen used in this example all tetrahedrons should have a specific element type which will define the physics involved being structural, thermal, electric. In this case structural.

Indirectly the program gives a hint of the element type suggesting structural loads and forces in the boundary conditions or for a thermal case (not this one), the appropriate thermal boundary conditions.

As an example I am picking a Cube made in FreeCAD using NetGen mesher and Calculix solver. Before entering the solving process I generated the .inp file which contains the mesh, the boundary conditions and the material data to perform the simulation.

Somewhere in the .inp file you will find the following:

TYPE=C3D10

The element type name used is C3D10, as expected expected since normally the solver has a ton of element types, and there should also be in the Calculix solver a similar variety like for instance Ansys with Solid187 (https://www.sharcnet.ca/Software/Ansys/17.0/en-us/help/ans_elem/Hlp_E_SOLID187.html), Solid186 or Solid226; for a list see this reference:

https://www.sharcnet.ca/Software/Ansys/17.0/en-us/help/ans_elem/

More details about C3D10 element can be seen in:

http://web.mit.edu/calculix_v2.7/CalculiX/ccx_2.7/doc/ccx/node33.html

And a list off all Calculix elements can be seen here:

http://web.mit.edu/calculix_v2.7/CalculiX/ccx_2.7/doc/ccx/node25.html

** written by FreeCAD inp file writer for CalculiX,Abaqus meshes

** Nodes
*Node, NSET=Nall
1, 10, 10, 0
2, 10, 10, 10
3, 10, 0, 0
4, 10, 0, 10
5, 0, 10, 0
6, 0, 10, 10
7, 0, 0, 0
8, 0, 0, 10
9, 0, 5, 10
10, 5, 10, 10
11, 10, 5, 10
12, 5, 0, 10
13, 0, 5, 0
14, 5, 10, 0
15, 10, 5, 0
16, 5, 0, 0
17, 10, 10, 5
18, 0, 10, 5
19, 10, 0, 5
20, 0, 0, 5
21, 5, 5, 10
22, 5, 5, 0
23, 5, 10, 5
24, 5, 0, 5
25, 10, 5, 5
26, 0, 5, 5

** Volume elements
<span style="color: #0000ff;"><strong>*Element, TYPE=C3D10, ELSET=Evolumes</strong></span>
25, 7, 4, 6, 8, 24, 21, 26, 20, 12, 9
26, 7, 6, 4, 1, 26, 21, 24, 22, 23, 25
27, 5, 7, 1, 6, 13, 22, 14, 18, 26, 23
28, 4, 7, 1, 3, 24, 22, 25, 19, 16, 15
29, 4, 2, 1, 6, 11, 17, 25, 21, 10, 23

** Define element set Eall
*ELSET, ELSET=Eall
Evolumes

***********************************************************
** Element sets for materials and FEM element type (solid, shell, beam, fluid)
** written by write_element_sets_material_and_femelement_type function
*ELSET,ELSET=SolidMaterialSolid
Evolumes

***********************************************************
** Node sets for fixed constraint
** written by write_node_sets_constraints_fixed function
** FemConstraintFixed
*NSET,NSET=FemConstraintFixed
3,
4,
7,
8,
12,
16,
19,
20,
24,

***********************************************************
** Materials
** written by write_materials function
** Young's modulus unit is MPa = N/mm2
** SolidMaterial
*MATERIAL, NAME=SolidMaterial
*ELASTIC
210000, 0.300

***********************************************************
** Sections
** written by write_femelementsets function
*SOLID SECTION, ELSET=SolidMaterialSolid, MATERIAL=SolidMaterial

***********************************************************
** At least one step is needed to run an CalculiX analysis of FreeCAD
** written by write_step_begin function
*STEP
*STATIC

***********************************************************
** Fixed Constraints
** written by write_constraints_fixed function
** FemConstraintFixed
*BOUNDARY
FemConstraintFixed,1
FemConstraintFixed,2
FemConstraintFixed,3

***********************************************************
** written by write_constraints_force function
** FemConstraintForce
** node loads on shape: Box:Face4
1,2,-0.0000000000000E+00
2,2,-0.0000000000000E+00
5,2,-0.0000000000000E+00
6,2,-0.0000000000000E+00
10,2,-1.6666666666667E+02
14,2,-1.6666666666667E+02
17,2,-1.6666666666667E+02
18,2,-1.6666666666667E+02
23,2,-3.3333333333333E+02

***********************************************************
** Outputs --&amp;gt; frd file
** written by write_outputs_types function
*NODE FILE
U
*EL FILE
S, E
** outputs --&amp;gt; dat file
*NODE PRINT , NSET=Nall
U
*EL PRINT , ELSET=Eall
S

***********************************************************
** written by write_step_end function
*END STEP

***********************************************************
** CalculiX Input file
** written by write_footer function
** written by --&amp;gt; FreeCAD 0.17.12321 (Git)
** written on --&amp;gt; Sun Oct 8 21:43:43 2017
** file name --&amp;gt;
** analysis name --&amp;gt; Analysis
**
**
**
** Units
**
** Geometry (mesh data) --&amp;gt; mm
** Materials (Young's modulus) --&amp;gt; N/mm2 = MPa
**


The Paper Clip

A paper clip as simple as it is. It always is handy when we need to join paper sheets together. A soft metal wire is bended in such a way that when we insert a few paper sheets in-between the bended profile, it will act as a spring load pressing the paper sheets together.

The mesher used in this case was NetGen with standard options:

Max Size: 1000
Growth Rate: 0.3
Nbr. Segments per Edge: 1

Resulting Mesh:

Node count: 80181
Triangle count: 25166
Tetrahedron count: 39417

But what did NetGen actually do? It did a mesh but many questions should now start to appear. Some questions came to my mind, like what elements did it used, what is the general quality of the elements like for instance:

• Element quality criteria;
• Aspect ratio
• Jacobean
• Warping factor
• Maximum corner angle
• Skewness
• Orthogonal quality

Also I wonder what element types are used and where can I find documentation. I will try to understand this better in my next posts…