Skip to content

Commit 26cb29f

Browse files
authored
Merge pull request #479 from AgnieszkaMakulska/ice
Ice in SD debug
2 parents a7a3db7 + 618f38b commit 26cb29f

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

src/impl/ice/particles_impl_ice_dep.ipp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
* GPLv3+ (see the COPYING file or http://www.gnu.org/licenses/)
66
*/
77

8-
// #include <thrust/iterator/transform_iterator.h>
9-
// #include <libcloudph++/common/maxwell-mason.hpp>
10-
// #include <libcloudph++/common/kappa_koehler.hpp>
11-
// #include <libcloudph++/common/kelvin_term.hpp>
12-
// #include <libcloudph++/common/transition_regime.hpp>
13-
// #include <libcloudph++/common/ventil.hpp>
148

159
namespace libcloudphxx
1610
{
@@ -31,8 +25,6 @@ namespace libcloudphxx
3125
hskpng_sort();
3226

3327
// Vector to store 3rd moment
34-
// auto d_ice_mass_g = tmp_device_real_cell.get_guard();
35-
// thrust_device::vector<real_t> &d_ice_mass = d_ice_mass_g.get();
3628
if(step == 0)
3729
reset_guardp(ice_mass_gp, tmp_device_real_cell);
3830
thrust_device::vector<real_t> &ice_mass = ice_mass_gp->get();
@@ -137,8 +129,6 @@ namespace libcloudphxx
137129
ice_mass_gp.reset(); // destroy guard to tmp array that stored ice_mass
138130
}
139131

140-
// update th and rv according to change in third specific moment
141-
// update_th_rv(d_ice_mass, impl::phase_change::deposition);
142132
}
143133
};
144134
}

src/particles_diag.ipp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,17 @@ namespace libcloudphxx
250250
template <typename real_t, backend_t device>
251251
void particles_t<real_t, device>::diag_ice_a_rng(const real_t &a_min, const real_t &a_max)
252252
{
253+
if(pimpl->opts_init.ice_switch == false)
254+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
253255
pimpl->moms_rng(a_min, a_max, pimpl->ice_a.begin(), false);
254256
}
255257

256258
// selects particles with (ice_c >= c_min && ice_c < c_max)
257259
template <typename real_t, backend_t device>
258260
void particles_t<real_t, device>::diag_ice_c_rng(const real_t &c_min, const real_t &c_max)
259261
{
262+
if(pimpl->opts_init.ice_switch == false)
263+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
260264
pimpl->moms_rng(c_min, c_max, pimpl->ice_c.begin(), false);
261265
}
262266

@@ -271,14 +275,16 @@ namespace libcloudphxx
271275
template <typename real_t, backend_t device>
272276
void particles_t<real_t, device>::diag_ice()
273277
{
278+
if(pimpl->opts_init.ice_switch == false)
279+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
274280
pimpl->moms_gt0(pimpl->ice_a.begin()); // ice_a greater than 0
275281
}
276282

277283
// selects water particles
278284
template <typename real_t, backend_t device>
279285
void particles_t<real_t, device>::diag_water()
280286
{
281-
pimpl->moms_eq0(pimpl->ice_a.begin()); // ice_a equal to 0
287+
pimpl->moms_gt0(pimpl->rw2.begin()); // rw2 greater than 0
282288
}
283289

284290
// selects particles with (r_d >= r_min && r_d < r_max) from particles previously selected
@@ -305,13 +311,17 @@ namespace libcloudphxx
305311
template <typename real_t, backend_t device>
306312
void particles_t<real_t, device>::diag_ice_a_rng_cons(const real_t &a_min, const real_t &a_max)
307313
{
314+
if(pimpl->opts_init.ice_switch == false)
315+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
308316
pimpl->moms_rng(a_min, a_max, pimpl->ice_a.begin(), true);
309317
}
310318

311319
// selects particles with (ice_c >= c_min && ice_c < c_max) from particles previously selected
312320
template <typename real_t, backend_t device>
313321
void particles_t<real_t, device>::diag_ice_c_rng_cons(const real_t &c_min, const real_t &c_max)
314322
{
323+
if(pimpl->opts_init.ice_switch == false)
324+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
315325
pimpl->moms_rng(c_min, c_max, pimpl->ice_c.begin(), true);
316326
}
317327

@@ -326,14 +336,16 @@ namespace libcloudphxx
326336
template <typename real_t, backend_t device>
327337
void particles_t<real_t, device>::diag_ice_cons()
328338
{
339+
if(pimpl->opts_init.ice_switch == false)
340+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
329341
pimpl->moms_gt0(pimpl->ice_a.begin(), true); // ice_a greater than 0
330342
}
331343

332344
// selects water particles from particles previously selected
333345
template <typename real_t, backend_t device>
334346
void particles_t<real_t, device>::diag_water_cons()
335347
{
336-
pimpl->moms_eq0(pimpl->ice_a.begin(), true); // ice_a equal to 0
348+
pimpl->moms_gt0(pimpl->rw2.begin(), true); // rw2 greater than 0
337349
}
338350

339351
// selects particles with RH >= Sc (Sc - critical supersaturation)
@@ -412,20 +424,26 @@ namespace libcloudphxx
412424
template <typename real_t, backend_t device>
413425
void particles_t<real_t, device>::diag_ice_a_mom(const int &n)
414426
{
427+
if(pimpl->opts_init.ice_switch == false)
428+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
415429
pimpl->moms_calc(pimpl->ice_a.begin(), n);
416430
}
417431

418432
// computes n-th moment of the ice polar radius spectrum for the selected particles
419433
template <typename real_t, backend_t device>
420434
void particles_t<real_t, device>::diag_ice_c_mom(const int &n)
421435
{
436+
if(pimpl->opts_init.ice_switch == false)
437+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
422438
pimpl->moms_calc(pimpl->ice_c.begin(), n);
423439
}
424440

425441
// computes ice mixing ratio
426442
template <typename real_t, backend_t device>
427443
void particles_t<real_t, device>::diag_ice_mix_ratio()
428444
{
445+
if(pimpl->opts_init.ice_switch == false)
446+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
429447
pimpl->moms_calc(thrust::make_transform_iterator(
430448
thrust::make_zip_iterator(thrust::make_tuple(pimpl->ice_a.begin(), pimpl->ice_c.begin(), pimpl->ice_rho.begin())),
431449
detail::ice_mass<real_t>()
@@ -571,6 +589,9 @@ namespace libcloudphxx
571589
template <typename real_t, backend_t device>
572590
void particles_t<real_t, device>::diag_precip_rate_ice_mass()
573591
{
592+
if(pimpl->opts_init.ice_switch == false)
593+
throw std::runtime_error("libcloudph++: ice is switched off in opts_init, but diag_ice was called");
594+
574595
// updating terminal velocities
575596
pimpl->hskpng_vterm_all();
576597

@@ -623,7 +644,8 @@ namespace libcloudphxx
623644
template <typename real_t, backend_t device>
624645
void particles_t<real_t, device>::diag_chem(const enum chem_species_t &c)
625646
{
626-
if(pimpl->opts_init.chem_switch == false) throw std::runtime_error("libcloudph++: all chemistry was switched off in opts_init");
647+
if(pimpl->opts_init.chem_switch == false)
648+
throw std::runtime_error("libcloudph++: chemistry is switched off in opts_init, but diag_chem was called");
627649
pimpl->moms_calc(pimpl->chem_bgn[c], 1.);
628650
}
629651

0 commit comments

Comments
 (0)