aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp6
-rw-r--r--Source/WarpX.H5
-rw-r--r--Source/WarpX.cpp20
3 files changed, 30 insertions, 1 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 359b1ecde..6107bb9c1 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -621,7 +621,11 @@ void
MultiParticleContainer::SortParticlesByBin (amrex::IntVect bin_size)
{
for (auto& pc : allcontainers) {
- pc->SortParticlesByBin(bin_size);
+ if (WarpX::sort_particles_for_deposition) {
+ pc->SortParticlesForDeposition(WarpX::sort_idx_type);
+ } else {
+ pc->SortParticlesByBin(bin_size);
+ }
}
}
diff --git a/Source/WarpX.H b/Source/WarpX.H
index bfc2e0562..1358630b3 100644
--- a/Source/WarpX.H
+++ b/Source/WarpX.H
@@ -307,6 +307,11 @@ public:
static utils::parser::IntervalsParser sort_intervals;
static amrex::IntVect sort_bin_size;
+ //! If true, particles will be sorted in the order x -> y -> z -> ppc for faster deposition
+ static bool sort_particles_for_deposition;
+ //! Specifies the type of grid used for the above sorting, i.e. cell-centered, nodal, or mixed
+ static amrex::IntVect sort_idx_type;
+
static bool do_subcycling;
static bool do_multi_J;
static int do_multi_J_n_depositions;
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 1e48d659d..ec9f3ee05 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -172,6 +172,14 @@ int WarpX::num_mirrors = 0;
utils::parser::IntervalsParser WarpX::sort_intervals;
amrex::IntVect WarpX::sort_bin_size(AMREX_D_DECL(1,1,1));
+#if defined(AMREX_USE_CUDA)
+bool WarpX::sort_particles_for_deposition = true;
+#else
+bool WarpX::sort_particles_for_deposition = false;
+#endif
+
+amrex::IntVect WarpX::sort_idx_type(AMREX_D_DECL(0,0,0));
+
bool WarpX::do_dynamic_scheduling = true;
int WarpX::electrostatic_solver_id;
@@ -1165,6 +1173,18 @@ WarpX::ReadParameters ()
for (int i=0; i<AMREX_SPACEDIM; i++)
sort_bin_size[i] = vect_sort_bin_size[i];
}
+
+ pp_warpx.query("sort_particles_for_deposition",sort_particles_for_deposition);
+ Vector<int> vect_sort_idx_type(AMREX_SPACEDIM,0);
+ bool sort_idx_type_is_specified =
+ utils::parser::queryArrWithParser(
+ pp_warpx, "sort_idx_type",
+ vect_sort_idx_type, 0, AMREX_SPACEDIM);
+ if (sort_idx_type_is_specified){
+ for (int i=0; i<AMREX_SPACEDIM; i++)
+ sort_idx_type[i] = vect_sort_idx_type[i];
+ }
+
}
{