Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
01ce76f
diag_sstp_cond_mom + fix of activation adaptation (but it is to be re…
pdziekan Feb 17, 2026
a97faec
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Feb 19, 2026
014f88d
adaptive sstp: fix for the case when first step wwas not done in adap…
pdziekan Feb 20, 2026
6fbd589
remove merge leftobers
pdziekan Feb 20, 2026
7e5c845
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Feb 20, 2026
fd5d91d
incease tmp_drp_no, because sstp_cond is not released (due to diag_ss…
pdziekan Feb 23, 2026
a6fc416
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Feb 23, 2026
ff57222
diag ice rng in python
AgnieszkaMakulska Feb 26, 2026
81bfd89
bindigns missing functions
AgnieszkaMakulska Feb 26, 2026
8e8b670
debug
AgnieszkaMakulska Feb 26, 2026
bb63f15
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Mar 3, 2026
2db5d5c
Merge remote-tracking branch 'pdziekan/diag_sstp_cond' into diag_sstp…
AgnieszkaMakulska Mar 3, 2026
ddfd80b
debugging segfault
AgnieszkaMakulska Mar 3, 2026
7b0bc92
d_ice_mass per particle
AgnieszkaMakulska Mar 4, 2026
2ea0c0f
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Mar 4, 2026
4563010
Merge branch 'perparticle_sstp_deposition' into diag_sstp_cond
pdziekan Mar 4, 2026
f6aa689
diag_sstp_mom only if sstp vector exists
AgnieszkaMakulska Mar 19, 2026
e2f6f03
Merge branch 'diag_sstp_cond' of https://github.com/pdziekan/libcloud…
AgnieszkaMakulska Apr 8, 2026
52e50b5
Merge remote-tracking branch 'pdziekan/perparticle_sstp_deposition' i…
AgnieszkaMakulska Apr 8, 2026
0988628
Merge branch 'master' into diag_sstp_cond
AgnieszkaMakulska Apr 8, 2026
2bc5462
diag_sstp_cond_mom on GPU
AgnieszkaMakulska Apr 9, 2026
c905d91
Merge branch 'ice' into diag_sstp_cond
AgnieszkaMakulska Apr 17, 2026
3d5cb7c
Revert "Merge branch 'ice' into diag_sstp_cond"
AgnieszkaMakulska Apr 17, 2026
b2cb994
fix u01 for T_freeze
AgnieszkaMakulska Apr 17, 2026
7ddcf00
parcel moms fix
AgnieszkaMakulska Apr 22, 2026
9169d74
Merge branch 'master' into diag_sstp_cond
pdziekan Jul 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bindings/python/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ BOOST_PYTHON_MODULE(libcloudphxx)
bp::def("exner", &common::exner<real_t>);
bp::def("p_v", &common::p_v<real_t>);
bp::def("p_vs", &common::p_vs<real_t>);
bp::def("p_vsi", &common::p_vsi<real_t>);
bp::def("r_vs", &common::r_vs<real_t>);
bp::def("r_vsi", &common::r_vsi<real_t>);
bp::def("p_vs_tet", &common::p_vs_tet<real_t>);
bp::def("l_v", &common::l_v<real_t>);
bp::def("l_s", &common::l_s<real_t>);
bp::def("l_f", &common::l_f<real_t>);
bp::def("T", &common::T<real_t>);
bp::def("p", &common::p<real_t>);
bp::def("visc", &common::visc<real_t>);
Expand Down Expand Up @@ -282,6 +285,7 @@ BOOST_PYTHON_MODULE(libcloudphxx)
.def_readwrite("turb_cond", &lgr::opts_t<real_t>::turb_cond)
.def_readwrite("turb_coal", &lgr::opts_t<real_t>::turb_coal)
.def_readwrite("ice_nucl", &lgr::opts_t<real_t>::ice_nucl)
.def_readwrite("depo", &lgr::opts_t<real_t>::depo)
.def_readwrite("dt", &lgr::opts_t<real_t>::dt)
.add_property("src_dry_distros", &lgrngn::get_sdd<real_t>, &lgrngn::set_sdd<real_t>)
.add_property("src_dry_sizes", &lgrngn::get_ds<real_t>, &lgrngn::set_sds<real_t>)
Expand Down Expand Up @@ -427,7 +431,12 @@ BOOST_PYTHON_MODULE(libcloudphxx)
.def("diag_water_cons", &lgr::particles_proto_t<real_t>::diag_water_cons)
.def("diag_ice_a_mom", &lgr::particles_proto_t<real_t>::diag_ice_a_mom)
.def("diag_ice_c_mom", &lgr::particles_proto_t<real_t>::diag_ice_c_mom)
.def("diag_ice_a_rng", &lgr::particles_proto_t<real_t>::diag_ice_a_rng)
.def("diag_ice_c_rng", &lgr::particles_proto_t<real_t>::diag_ice_c_rng)
.def("diag_ice_a_rng_cons", &lgr::particles_proto_t<real_t>::diag_ice_a_rng_cons)
.def("diag_ice_c_rng_cons", &lgr::particles_proto_t<real_t>::diag_ice_c_rng_cons)
.def("diag_ice_mix_ratio", &lgr::particles_proto_t<real_t>::diag_ice_mix_ratio)
.def("diag_sstp_cond_mom", &lgr::particles_proto_t<real_t>::diag_sstp_cond_mom)
.def("outbuf", &lgrngn::outbuf<real_t>)
.def("get_attr", &lgr::particles_proto_t<real_t>::get_attr)
;
Expand Down
3 changes: 3 additions & 0 deletions include/libcloudph++/lgrngn/particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace libcloudphxx
virtual void diag_vp_mom(const int&) { assert(false); }
virtual void diag_wp_mom(const int&) { assert(false); }
virtual void diag_incloud_time_mom(const int&) { assert(false); } // requires opts_init.diag_incloud_time==true
virtual void diag_sstp_cond_mom(const int &k) { assert(false); }
virtual void diag_max_rw() { assert(false); }
virtual void diag_vel_div() { assert(false); }
virtual std::map<libcloudphxx::common::output_t, real_t> diag_puddle() { assert(false); return std::map<libcloudphxx::common::output_t, real_t>(); }
Expand Down Expand Up @@ -212,6 +213,7 @@ namespace libcloudphxx
void diag_vp_mom(const int&);
void diag_wp_mom(const int&);
void diag_incloud_time_mom(const int &k);
void diag_sstp_cond_mom(const int &k);
void diag_wet_mass_dens(const real_t&, const real_t&);

void diag_chem(const enum common::chem::chem_species_t&);
Expand Down Expand Up @@ -321,6 +323,7 @@ namespace libcloudphxx
void diag_vp_mom(const int&);
void diag_wp_mom(const int&);
void diag_incloud_time_mom(const int&);
void diag_sstp_cond_mom(const int &k);
void diag_wet_mass_dens(const real_t&, const real_t&);
std::vector<real_t> get_attr(const std::string &);
real_t *outbuf();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace libcloudphxx

if(opts_init.adaptive_sstp_cond)
{
perparticle_sstp_cond_gp.reset();
// perparticle_sstp_cond_gp.reset();
}
}
};
Expand Down
52 changes: 52 additions & 0 deletions src/impl/diagnose_SD_attributes/particles_impl_moms.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,57 @@ namespace libcloudphxx
{
moms_calc(vec_bgn, n_part, power, specific);
}

// like moms_calc, but not accounting for multiplicity (n) and not dividing by volume (or air mass)
template <typename real_t, backend_t device>
template <typename it_t> // iterator type
void particles_t<real_t, device>::impl::SD_moms_calc(
const it_t &vec_bgn,
const thrust_size_t npart,
const real_t power
)
{
thrust::pair<
thrust_device::vector<thrust_size_t>::iterator,
typename thrust_device::vector<real_t>::iterator
> it_pair = thrust::reduce_by_key(
// input - keys
sorted_ijk.begin(), sorted_ijk.begin()+npart,
// input - values
thrust::make_transform_iterator(
thrust::make_zip_iterator(thrust::make_tuple(
thrust::make_constant_iterator<real_t>(1),
thrust::make_permutation_iterator(vec_bgn, sorted_id.begin())
)),
detail::moment_counter<real_t>(power)
),
// output - keys
count_ijk.begin(),
// output - values
count_mom.begin()
);

count_n = it_pair.first - count_ijk.begin();
#if !defined(NDEBUG)
{
int nan_count = thrust::transform_reduce(count_mom.begin(), count_mom.begin() + count_n, isnaninf(), 0, thrust::plus<bool>());
if(nan_count>0)
{
std::cout << nan_count << " nan/inf numbers detected in count_mom after reduce_by_key " << std::endl;
}
}
#endif
assert(count_n <= n_cell);
}

template <typename real_t, backend_t device>
template <typename it_t> // iterator type
void particles_t<real_t, device>::impl::SD_moms_calc(
const it_t &vec_bgn,
const real_t power
)
{
moms_calc(vec_bgn, n_part, power);
}
};
};
13 changes: 12 additions & 1 deletion src/impl/particles_impl.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ namespace libcloudphxx
if(allow_sstp_cond && opts_init.exact_sstp_cond && sstp_cond_exact_nomix_adaptive)
tmp_drp_no = std::max(tmp_drp_no, 4); // why 5? not 4?
if(allow_sstp_cond && opts_init.exact_sstp_cond && !sstp_cond_exact_nomix_adaptive)
tmp_drp_no = std::max(tmp_drp_no, 7); // why 8? not 7?
tmp_drp_no = std::max(tmp_drp_no, 10); // for some reason it fails for less than 10
// if(allow_sstp_cond && opts_init.exact_sstp_cond && opts_init.const_p)
// tmp_drp_no = std::max(tmp_drp_no, 7);
tmp_device_real_part.add_vectors(tmp_drp_no-1); // -1 because 1 is already created in the ctor
Expand Down Expand Up @@ -672,6 +672,17 @@ namespace libcloudphxx
const real_t power,
const bool specific = true
);
template<typename it_t> // iterator type
void SD_moms_calc(
const it_t &vec_bgn,
const thrust_size_t npart,
const real_t power
);
template<typename it_t> // iterator type
void SD_moms_calc(
const it_t &vec_bgn,
const real_t power
);

void mass_dens_estim(
const typename thrust_device::vector<real_t>::iterator &vec_bgn,
Expand Down
14 changes: 14 additions & 0 deletions src/particles_diag.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,19 @@ namespace libcloudphxx
{
return pimpl->output_puddle;
}

template <typename real_t, backend_t device>
void particles_t<real_t, device>::diag_sstp_cond_mom(const int &n)
{
if(pimpl->opts_init.exact_sstp_cond && (pimpl->sstp_cond > 1 || pimpl->sstp_cond_act > 1) && pimpl->opts_init.adaptive_sstp_cond)
{
if (pimpl->perparticle_sstp_cond_gp)
{
pimpl->SD_moms_calc(pimpl->perparticle_sstp_cond_gp->get().begin(), n);
}
}
else
assert(0 && "diag_sstp_cond_mom called, but adaptive substepping is off (opts_init.exact_sstp_cond && (opts_ini.sstp_cond > 1 || opts_ini.sstp_cond_act > 1) && opts_init.adaptive_sstp_cond) == False. Therefore number of substeps is defined by opts_init.sstp_cond.");
}
};
};
6 changes: 6 additions & 0 deletions src/particles_multi_gpu_diag.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ namespace libcloudphxx
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_incloud_time_mom, k);
}

template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_sstp_cond_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_sstp_cond_mom, k);
}

template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_wet_mass_dens(const real_t &a, const real_t &b)
{
Expand Down
Loading