@@ -28,6 +28,7 @@ def test_few_steps_no_precip(particle_reservoir_depth, plot=False):
28
28
)
29
29
settings .particle_reservoir_depth = particle_reservoir_depth
30
30
settings .t_max = 50 * settings .dt
31
+ settings .condensation_update_thd = True
31
32
simulation = Simulation (settings )
32
33
33
34
# Act
@@ -80,3 +81,38 @@ def mean_profile_over_last_steps(var, smooth=True):
80
81
81
82
assert max (mean_profile_over_last_steps ("ripening rate" )) > 0
82
83
assert max (mean_profile_over_last_steps ("deactivating rate" )) > 0
84
+
85
+
86
+ def test_fixed_thd ():
87
+ # Arrange
88
+ n_sd_per_gridbox = 128
89
+ settings = Settings (
90
+ n_sd_per_gridbox = n_sd_per_gridbox ,
91
+ dt = 30 * si .s ,
92
+ dz = 60 * si .m ,
93
+ precip = False ,
94
+ rho_times_w_1 = 2 * si .m / si .s * si .kg / si .m ** 3 ,
95
+ )
96
+ settings .t_max = 50 * settings .dt
97
+ settings .condensation_update_thd = False
98
+ simulation = Simulation (settings )
99
+
100
+ # Act
101
+ output = simulation .run ().products
102
+
103
+ # Assert
104
+ mean_profile_over_last_steps = lambda var : np .mean (
105
+ output [var ][output ["z" ] >= 0 , - 10 :], axis = 1
106
+ )
107
+ sd_prof = mean_profile_over_last_steps ("super droplet count per gridbox" )
108
+ assert 0.5 * n_sd_per_gridbox < min (sd_prof ) < 1.5 * n_sd_per_gridbox
109
+ assert 0.5 * n_sd_per_gridbox < max (sd_prof ) < 1.5 * n_sd_per_gridbox
110
+
111
+ assert 0.01 < max (mean_profile_over_last_steps ("peak supersaturation" )) < 0.1
112
+ assert min (mean_profile_over_last_steps ("ql" )) < 1e-10
113
+ assert 0.6 < max (mean_profile_over_last_steps ("ql" )) < 0.9
114
+ assert max (mean_profile_over_last_steps ("activating rate" )) == 0
115
+ assert max (mean_profile_over_last_steps ("ripening rate" )) == 0
116
+ assert max (mean_profile_over_last_steps ("deactivating rate" )) == 0
117
+
118
+ assert sum (np .amin (output ["thd" ], axis = 1 )) == sum (np .amax (output ["thd" ], axis = 1 ))
0 commit comments