Skip to content

Commit 848ee5d

Browse files
authored
Merge pull request #409 from pdziekan/droplet_puddle
Droplet puddle
2 parents e7ab05a + 9ce15c4 commit 848ee5d

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
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
}

tests/python/physics/puddle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def lognormal(lnr):
6868

6969
assert(tab_out[0][0] == 0.)
7070

71-
puddle_expected_per_cell = {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 0.0, 8: 7.087802417148837e-05, 9: 5.630090090571395e-06}
71+
puddle_expected_per_cell = {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 0.0, 8: 7.087802417148837e-05, 9: 5.630090090571395e-06, 10: 815411.5}
7272

7373
for a in puddle:
7474
print(puddle[a], Opts_init.nx * puddle_expected_per_cell[a])

0 commit comments

Comments
 (0)