Skip to content

Commit 079937c

Browse files
committed
add number of particles to puddle
1 parent 929f8eb commit 079937c

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

include/libcloudph++/common/output.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ namespace libcloudphxx
1616
outS_VI = chem::S_VI,
1717
outH = chem::H,
1818
outliq_vol,
19-
outdry_vol
19+
outdry_vol,
20+
outprtcl_num
2021
};
2122

2223
const std::map<output_t, std::string> output_names
@@ -30,7 +31,8 @@ namespace libcloudphxx
3031
{outS_VI , "S_VI"},
3132
{outH , "H"},
3233
{outliq_vol, "liquid_volume"},
33-
{outdry_vol, "dry_volume"}
34+
{outdry_vol, "dry_volume"},
35+
{outprtcl_num, "particle_number"}
3436
};
3537
};
3638
};

src/impl/particles_impl_bcnd.ipp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ namespace libcloudphxx
231231
thrust::plus<real_t>()
232232
);
233233

234+
// add total number of particles that fell out in this step
235+
output_puddle[common::outprtcl_num] +=
236+
thrust::reduce(
237+
n_filtered.begin(), // input start
238+
n_filtered.begin() + n_part // input end
239+
);
240+
234241
if(opts_init.chem_switch)
235242
{
236243
for (int i = 0; i < chem_all; ++i)

src/particles_ctor.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace libcloudphxx
7575
pimpl->sanity_checks();
7676

7777
// init output map to 0
78-
for(int i=0; i < chem_all+2; ++i)
78+
for(int i=0; i < common::output_names.size(); ++i)
7979
pimpl->output_puddle[static_cast<common::output_t>(i)] = 0.;
8080
}
8181

src/particles_multi_gpu_diag.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ namespace libcloudphxx
203203
template<class real_t>
204204
std::map<common::output_t, real_t> add_puddle(std::map<common::output_t, real_t> x, std::map<common::output_t, real_t> y){
205205
std::map<common::output_t, real_t> res;
206-
for(int i=0; i < chem_all+2; ++i)
206+
for(int i=0; i < common::output_names.size(); ++i)
207207
res[static_cast<common::output_t>(i)] = x[static_cast<common::output_t>(i)] + y[static_cast<common::output_t>(i)];
208208
return res;
209209
}

0 commit comments

Comments
 (0)