Skip to content

Commit

Permalink
Merge pull request #329 from JamesMcClung/pr/fix-sparse-particles
Browse files Browse the repository at this point in the history
Fix particle weight when 0<n<.5
  • Loading branch information
JamesMcClung authored Apr 17, 2024
2 parents 62a4ece + da98c4f commit 23f175a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/include/setup_particles.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#pragma once

#include <algorithm>
#include <functional>
#include <type_traits>
#include "centering.hxx"
Expand Down Expand Up @@ -122,7 +123,7 @@ struct SetupParticles
if (fractional_n_particles_per_cell) {
return np.n / norm_.cori + dist.get();
}
return np.n / norm_.cori + .5;
return std::max(1, int(np.n / norm_.cori + .5));
}

// ----------------------------------------------------------------------
Expand Down

0 comments on commit 23f175a

Please sign in to comment.