Skip to content

Commit ad239f4

Browse files
committed
added a comment
1 parent 9450046 commit ad239f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp/models/ide_secir/model.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,18 @@ void Model::initialize(ScalarType dt)
9999
m_populations[Eigen::Index(0)][Eigen::Index(InfectionState::Dead)];
100100
}
101101
else {
102-
103102
// compute Susceptibles at time 0 and m_forceofinfection at time -dt as initial values for discretization scheme
104103
// use m_forceofinfection at -dt to be consistent with further calculations of S (see compute_susceptibles()),
105104
// where also the value of m_forceofinfection for the previous timestep is used
106105
update_forceofinfection(dt, true);
107106
if (m_forceofinfection > 1e-12) {
108107
m_initialization_method = 4;
108+
109+
/* Attention: With an inappropriate combination of parameters and initial conditions, it can happen that S
110+
becomes greater than N when this formula is used. In this case, at least one compartment is initialized
111+
with a number less than zero, so that a log_error is thrown.
112+
However, this initialization method is consistent with the numerical solver of the model equations,
113+
so it may sometimes make sense to use this method. */
109114
m_populations[Eigen::Index(0)][Eigen::Index(InfectionState::Susceptible)] =
110115
m_transitions.get_last_value()[Eigen::Index(InfectionTransition::SusceptibleToExposed)] /
111116
(dt * m_forceofinfection);

0 commit comments

Comments
 (0)