handled the case when the removal rate is 0 and changed documentation

This commit is contained in:
Luis Aleixo 2023-01-27 16:47:39 +01:00
parent f880046384
commit eed3629dd5
2 changed files with 8 additions and 1 deletions

View file

@ -317,6 +317,8 @@ The estimate of the concentration of CO\ :sub:`2` in a given room to indicate th
Note that in order to calculate the CO\ :sub:`2` concentration one should use the concentration method defined in the superclass - :meth:`caimira.models._ConcentrationModelBase.concentration` - for a dedicated :class:`caimira.models.CO2ConcentrationModel` scenario.
A fraction of 4.2% of the exhalation rate of the defined activity was considered as the supplied to the room (:meth:`caimira.models.CO2ConcentrationModel.CO2_fraction_exhaled`).
Note still that nothing depends on the aerosol diameter :math:`D` in this case (no particles are involved) - hence in this class all parameters are constant w.r.t :math:`D`.
Since the CO\ :sub:`2` concentration differs from the virus concentration, the specific removal rate, CO\ :sub:`2` atmospheric concentration and normalization factors are respectively defined in :meth:`caimira.models.CO2ConcentrationModel.removal_rate`,
:meth:`caimira.models.CO2ConcentrationModel.min_background_concentration` and :meth:`caimira.models.CO2ConcentrationModel.normalization_factor`.

View file

@ -1085,7 +1085,12 @@ class _ConcentrationModelBase:
return self.min_background_concentration()/self.normalization_factor()
next_state_change_time = self._next_state_change(time)
RR = self.removal_rate(next_state_change_time)
conc_limit = self._normed_concentration_limit(next_state_change_time)
# If RR is 0, conc_limit does not play a role but its computation
# would raise an error -> we set it to zero.
try:
conc_limit = self._normed_concentration_limit(next_state_change_time)
except ZeroDivisionError:
conc_limit = 0.
t_last_state_change = self.last_state_change(time)
conc_at_last_state_change = self._normed_concentration_cached(t_last_state_change)