diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 12 | ||||
-rw-r--r-- | Source/WarpX.H | 4 | ||||
-rw-r--r-- | Source/WarpX.cpp | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index d5f133332..b1e83d652 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1363,8 +1363,16 @@ PhysicalParticleContainer::Evolve (int lev, } } } - // Split particles - if (do_splitting){ SplitParticles(lev); } + // Split particles at the end of the timestep. + // When subcycling is ON, the splitting is done on the last call to + // PhysicalParticleContainer::Evolve on the finest level, i.e., at the + // end of the large timestep. Otherwise, the pushes on different levels + // are not consistent, and the call to Redistribute (inside + // SplitParticles) may result in split particles to deposit twice on the + // coarse level. + if (do_splitting && (a_dt_type == DtType::SecondHalf || a_dt_type == DtType::Full) ){ + SplitParticles(lev); + } } // Loop over all particles in the particle container and diff --git a/Source/WarpX.H b/Source/WarpX.H index d4e1e6813..7a5344f4f 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -118,6 +118,8 @@ public: static int sort_int; + static int do_subcycling; + // buffers static int n_field_gather_buffer; //! in number of cells from the edge (identical for each dimension) static int n_current_deposition_buffer; //! in number of cells from the edge (identical for each dimension) @@ -527,8 +529,6 @@ private: // Other runtime parameters int verbose = 1; - int do_subcycling = 0; - int max_step = std::numeric_limits<int>::max(); amrex::Real stop_time = std::numeric_limits<amrex::Real>::max(); diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 6c6bb8107..a844e7aa0 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -69,6 +69,8 @@ bool WarpX::do_boosted_frame_particles = true; bool WarpX::do_dynamic_scheduling = true; +int WarpX::do_subcycling = 0; + #if (AMREX_SPACEDIM == 3) IntVect WarpX::Bx_nodal_flag(1,0,0); IntVect WarpX::By_nodal_flag(0,1,0); |