diff --git a/cara/models.py b/cara/models.py index 918ca439..12f85c7c 100644 --- a/cara/models.py +++ b/cara/models.py @@ -203,6 +203,9 @@ class WindowOpening(Ventilation): #: used to exchange air (0 <= cd_b <= 1) cd_b: float = 0.6 + #: Minimum difference between inside and outside temperature + min_deltaT: float = 0.1 + def transition_times(self) -> typing.Set[float]: transitions = super().transition_times() transitions.update(self.inside_temp.transition_times) @@ -214,12 +217,17 @@ class WindowOpening(Ventilation): if not self.active.triggered(time): return 0. + # Reminder, no dependence on time in the resulting calculation. inside_temp = self.inside_temp.value(time) outside_temp = self.outside_temp.value(time) - # Reminder, no dependence on time in the resulting calculation. - temp_delta = abs(inside_temp - outside_temp) / outside_temp - root = np.sqrt(9.81 * self.window_height * temp_delta) + # The inside_temperature is forced to be always at least min_deltaT degree + # warmer than the outside_temperature. Further research needed to + # handle the buoyancy driven ventilation when the temperature gradient + # is inverted. + inside_temp = max(inside_temp, outside_temp + self.min_deltaT) + temp_gradient = (inside_temp - outside_temp) / outside_temp + root = np.sqrt(9.81 * self.window_height * temp_gradient) window_area = self.window_height * self.opening_length * self.number_of_windows return (3600 / (3 * room.volume)) * self.cd_b * window_area * root diff --git a/cara/tests/test_known_quantities.py b/cara/tests/test_known_quantities.py index 336751f9..d621f31d 100644 --- a/cara/tests/test_known_quantities.py +++ b/cara/tests/test_known_quantities.py @@ -471,7 +471,7 @@ def build_exposure_model(concentration_model): "month, expected_r0", [ ['Jan', 91.06953], - ['Jun', 99.46692], + ['Jun', 99.995335], ], ) def test_r0_hourly_dep(month,expected_r0): @@ -489,7 +489,7 @@ def test_r0_hourly_dep(month,expected_r0): "month, expected_r0", [ ['Jan', 91.19912], - ['Jun', 99.59226], + ['Jun', 99.997324], ], ) def test_r0_hourly_dep_refined(month,expected_r0):