23 real(kind=
dp) :: t_max
25 real(kind=
dp) :: del_t
27 real(kind=
dp) :: t_output
29 real(kind=
dp) :: t_progress
31 character(len=300) :: prefix
33 logical :: do_camp_chem
37 logical :: do_coagulation
39 logical :: do_condensation
45 logical :: do_nucleation
47 logical :: do_immersion_freezing
49 character(len=PMC_UUID_LEN) :: uuid
57 subroutine run_modal(aero_data, aero_dist, scenario, env_state, &
58 gas_data, bin_grid, run_modal_opt)
79 real(kind=
dp) time, last_output_time, last_progress_time
81 integer i_time, n_time, i_summary
82 logical do_output, do_progress
85 "del_t", run_modal_opt%del_t)
87 "del_t", run_modal_opt%del_t)
89 "del_t", run_modal_opt%del_t)
92 call die_msg(927384615,
'run_modal() can only use one aerosol species')
100 last_output_time = 0d0
101 last_progress_time = 0d0
105 call check_event(time, run_modal_opt%del_t, run_modal_opt%t_output, &
106 last_output_time, do_output)
110 call output_modal(run_modal_opt%prefix, aero_binned, aero_dist, &
111 aero_data, env_state, gas_data, gas_state, bin_grid, scenario, &
112 i_summary, time, run_modal_opt%del_t, run_modal_opt%uuid)
117 n_time = nint(run_modal_opt%t_max / run_modal_opt%del_t)
119 time = run_modal_opt%t_max * real(i_time, kind=
dp) &
120 / real(n_time, kind=
dp)
122 old_env_state = env_state
126 env_state, old_env_state, gas_data, gas_state)
128 env_state, aero_data%density(1), scenario)
130 call check_event(time, run_modal_opt%del_t, run_modal_opt%t_output, &
131 last_output_time, do_output)
133 i_summary = i_summary + 1
136 call output_modal(run_modal_opt%prefix, aero_binned, aero_dist, &
137 aero_data, env_state, gas_data, gas_state, bin_grid, &
138 scenario, i_summary, time, run_modal_opt%del_t, &
143 call check_event(time, run_modal_opt%del_t, run_modal_opt%t_progress, &
144 last_progress_time, do_progress)
145 if (do_progress)
then
146 write(*,
'(a6,a8)')
'step',
'time'
147 write(*,
'(i6,f8.1)') i_time, time
157 bin_grid, gas_data, env_state, aero_dist_init, scenario)
176 character(len=PMC_MAX_FILENAME_LEN) :: sub_filename
186 call spec_file_read_radius_bin_grid(file, bin_grid)
189 run_modal_opt%do_camp_chem)
190 if (run_modal_opt%do_camp_chem)
then
192 "modal run does not support CAMP chemistry")
196 if (run_modal_opt%do_tchem)
then
198 "modal run does not support TChem chemistry")
203 call spec_file_read_gas_data(sub_file, gas_data)
208 call spec_file_read_aero_data(sub_file, aero_data)
211 call spec_file_read_fractal(file, aero_data%fractal)
215 call spec_file_read_aero_dist(sub_file, aero_data, .false., aero_dist_init)
218 call spec_file_read_scenario(file, gas_data, aero_data, .false., scenario)
219 call spec_file_read_env_state(file, env_state)
222 run_modal_opt%do_coagulation)
223 if (run_modal_opt%do_coagulation)
then
225 "modal run does not support coagulation")
229 run_modal_opt%do_condensation)
230 if (run_modal_opt%do_condensation)
then
232 "modal run does not support condensation")
236 if (run_modal_opt%do_mosaic)
then
238 "modal run does not support MOSAIC chemistry")
242 if (run_modal_opt%do_optical)
then
244 "modal run does not support optical properties calculation")
248 run_modal_opt%do_nucleation)
249 if (run_modal_opt%do_nucleation)
then
251 "modal run does not support nucleation")
255 run_modal_opt%do_immersion_freezing)
256 if (run_modal_opt%do_immersion_freezing)
then
258 "modal run does not support immersion freezing")
265 if (
size(scenario%aero_emission_rate_scale) > 0)
then
267 all(scenario%aero_emission_rate_scale == 0.0d0), &
268 "modal run does not support aerosol emissions: " &
269 //
"all aero_emission rates must be zero")
271 if (
size(scenario%aero_dilution_rate) > 0)
then
272 call assert_msg(742916380, all(scenario%aero_dilution_rate == 0.0d0), &
273 "modal run does not support aerosol background dilution: " &
274 //
"all aero_dilution rates must be zero")
279 "modal run only supports loss_function none or drydep")