@@ -152,6 +152,10 @@ namespace libcloudphxx
152152 thrust_device::vector<real_t > w_LS; // large-scale subsidence velocity profile
153153 thrust_device::vector<real_t > SGS_mix_len; // SGS mixing length profile
154154
155+ // time steps to be used, considering that opts.dt can override opts_init.dt
156+ real_t dt;
157+ int sstp_cond, sstp_coal, sstp_chem;
158+
155159 // sorting needed only for diagnostics and coalescence
156160 bool sorted;
157161
@@ -163,6 +167,10 @@ namespace libcloudphxx
163167 // is a constant, external pressure profile used? (e.g. anelastic model)
164168 bool const_p;
165169
170+ // is it allowed to do substepping, if not, some memory can be saved
171+ bool allow_sstp_cond,
172+ allow_sstp_chem;
173+
166174 // timestep counter
167175 n_t stp_ctr;
168176
@@ -327,6 +335,8 @@ namespace libcloudphxx
327335 w_LS(_opts_init.w_LS),
328336 SGS_mix_len(_opts_init.SGS_mix_len),
329337 adve_scheme(_opts_init.adve_scheme),
338+ allow_sstp_cond(_opts_init.sstp_cond > 1 || _opts_init.variable_dt_switch),
339+ allow_sstp_chem(_opts_init.sstp_chem > 1 || _opts_init.variable_dt_switch),
330340 pure_const_multi (((_opts_init.sd_conc) == 0) && (_opts_init.sd_const_multi > 0 || _opts_init.dry_sizes.size() > 0)) // coal prob can be greater than one only in sd_conc simulations
331341 {
332342
@@ -383,7 +393,7 @@ namespace libcloudphxx
383393 if (opts_init.ny != 0 ) distmem_real_vctrs.insert (&y);
384394 if (opts_init.nz != 0 ) distmem_real_vctrs.insert (&z);
385395
386- if (opts_init. sstp_cond > 1 && opts_init.exact_sstp_cond )
396+ if (allow_sstp_cond && opts_init.exact_sstp_cond )
387397 {
388398 distmem_real_vctrs.insert (&sstp_tmp_rv);
389399 distmem_real_vctrs.insert (&sstp_tmp_th);
@@ -483,7 +493,7 @@ namespace libcloudphxx
483493 void hskpng_vterm_all ();
484494 void hskpng_vterm_invalid ();
485495 void hskpng_tke ();
486- void hskpng_turb_vel (const bool only_vertical = false );
496+ void hskpng_turb_vel (const real_t &dt, const bool only_vertical = false );
487497 void hskpng_turb_dot_ss ();
488498 void hskpng_remove_n0 ();
489499 void hskpng_resize_npart ();
@@ -522,12 +532,13 @@ namespace libcloudphxx
522532 arrinfo_t <real_t > &
523533 );
524534
535+ void adjust_timesteps (const real_t &dt);
525536 void adve ();
526- void turb_adve ();
537+ void turb_adve (const real_t &dt );
527538 template <class adve_t >
528539 void adve_calc (bool , thrust_size_t = 0 );
529- void sedi ();
530- void subs ();
540+ void sedi (const real_t &dt );
541+ void subs (const real_t &dt );
531542
532543 void cond_dm3_helper ();
533544 void cond (const real_t &dt, const real_t &RH_max, const bool turb_cond);
@@ -537,7 +548,7 @@ namespace libcloudphxx
537548 void update_th_rv (thrust_device::vector<real_t > &);
538549 void update_state (thrust_device::vector<real_t > &, thrust_device::vector<real_t > &);
539550 void update_pstate (thrust_device::vector<real_t > &, thrust_device::vector<real_t > &);
540- void update_incloud_time ();
551+ void update_incloud_time (const real_t &dt );
541552
542553 void coal (const real_t &dt, const bool &turb_coal);
543554
0 commit comments