In concentration model, compute infectious virus removal rate only at time of next state change, to make sure it stays constant
This commit is contained in:
parent
307cf13bfa
commit
b622283206
1 changed files with 12 additions and 1 deletions
|
|
@ -641,7 +641,8 @@ class ConcentrationModel:
|
|||
# Deposition rate (h^-1)
|
||||
k = (vg * 3600) / h
|
||||
|
||||
return k + self.virus.decay_constant + self.ventilation.air_exchange(self.room, time)
|
||||
return k + self.virus.decay_constant + self.ventilation.air_exchange(
|
||||
self.room, self.next_state_change(time))
|
||||
|
||||
@cached()
|
||||
def state_change_times(self):
|
||||
|
|
@ -666,6 +667,16 @@ class ConcentrationModel:
|
|||
return change_time
|
||||
return 0
|
||||
|
||||
def next_state_change(self, time: float):
|
||||
"""
|
||||
Find the nearest future state change.
|
||||
|
||||
"""
|
||||
for change_time in self.state_change_times():
|
||||
if change_time >= time:
|
||||
return change_time
|
||||
return 0
|
||||
|
||||
@cached()
|
||||
def concentration(self, time: float) -> _VectorisedFloat:
|
||||
# Note that time is not vectorised. You can only pass a single float
|
||||
|
|
|
|||
Loading…
Reference in a new issue