diff options
-rw-r--r-- | Regression/WarpX-tests.ini | 5 | ||||
-rw-r--r-- | Source/ParticleContainer.H | 2 | ||||
-rw-r--r-- | Source/ParticleContainer.cpp | 3 | ||||
-rw-r--r-- | Source/WarpX.H | 2 | ||||
-rw-r--r-- | Source/WarpXEvolve.cpp | 6 | ||||
-rw-r--r-- | Source/WarpXMove.cpp | 8 |
6 files changed, 15 insertions, 11 deletions
diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini index fc58b9555..14af09277 100644 --- a/Regression/WarpX-tests.ini +++ b/Regression/WarpX-tests.ini @@ -261,11 +261,12 @@ numthreads = 2 compileTest = 0 doVis = 0 compareParticles = 1 -particleTypes = electrons beam +particleTypes = electrons [subcyclingMR] buildDir = . inputFile = Examples/Tests/subcycling/inputs.2d +runtime_params = warpx.serialize_ics=1 warpx.do_dynamic_scheduling=0 dim = 2 restartTest = 0 useMPI = 1 @@ -294,7 +295,7 @@ particleTypes = electrons beam [PlasmaAccelerationMR] buildDir = . inputFile = Examples/Physics_applications/plasma_acceleration/inputs.2d -runtime_params = amr.max_level=1 amr.n_cell=32 512 max_step=100 plasma_e.zmin=-200.e-6 warpx.serialize_ics=1 +runtime_params = amr.max_level=1 amr.n_cell=32 512 max_step=100 plasma_e.zmin=-200.e-6 warpx.serialize_ics=1 warpx.do_dynamic_scheduling=0 dim = 2 restartTest = 0 useMPI = 1 diff --git a/Source/ParticleContainer.H b/Source/ParticleContainer.H index 1b955d55f..026ba90a5 100644 --- a/Source/ParticleContainer.H +++ b/Source/ParticleContainer.H @@ -141,7 +141,7 @@ public: void Redistribute (); - void RedistributeLocal (); + void RedistributeLocal (const int num_ghost); amrex::Vector<long> NumberOfParticlesInGrid(int lev) const; diff --git a/Source/ParticleContainer.cpp b/Source/ParticleContainer.cpp index 39119e960..75c13d793 100644 --- a/Source/ParticleContainer.cpp +++ b/Source/ParticleContainer.cpp @@ -269,9 +269,8 @@ MultiParticleContainer::Redistribute () } void -MultiParticleContainer::RedistributeLocal () +MultiParticleContainer::RedistributeLocal (const int num_ghost) { - int num_ghost = WarpX::do_moving_window ? 2 : 1; for (auto& pc : allcontainers) { pc->Redistribute(0, 0, 0, num_ghost); } diff --git a/Source/WarpX.H b/Source/WarpX.H index b3c382cc7..ec41115cd 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -130,7 +130,7 @@ public: } void ComputeDt (); - void MoveWindow (bool move_j); + int MoveWindow (bool move_j); void UpdatePlasmaInjectionPosition (amrex::Real dt); void EvolveE ( amrex::Real dt); diff --git a/Source/WarpXEvolve.cpp b/Source/WarpXEvolve.cpp index 4a77fde43..7c1629e94 100644 --- a/Source/WarpXEvolve.cpp +++ b/Source/WarpXEvolve.cpp @@ -144,10 +144,12 @@ WarpX::EvolveEM (int numsteps) bool move_j = is_synchronized || to_make_plot || do_insitu; // If is_synchronized we need to shift j too so that next step we can evolve E by dt/2. // We might need to move j because we are going to make a plotfile. - MoveWindow(move_j); + int num_moved = MoveWindow(move_j); + if (max_level == 0) { - mypc->RedistributeLocal(); + int num_redistribute_ghost = num_moved + 1; + mypc->RedistributeLocal(num_redistribute_ghost); } else { mypc->Redistribute(); diff --git a/Source/WarpXMove.cpp b/Source/WarpXMove.cpp index 17fa6db2b..401211554 100644 --- a/Source/WarpXMove.cpp +++ b/Source/WarpXMove.cpp @@ -24,10 +24,10 @@ WarpX::UpdatePlasmaInjectionPosition (Real dt) } } -void +int WarpX::MoveWindow (bool move_j) { - if (do_moving_window == 0) return; + if (do_moving_window == 0) return 0; // Update the continuous position of the moving window, // and of the plasma injection @@ -43,7 +43,7 @@ WarpX::MoveWindow (bool move_j) const Real* dx = geom[0].CellSize(); int num_shift_base = static_cast<int>((moving_window_x - current_lo[dir]) / dx[dir]); - if (num_shift_base == 0) return; + if (num_shift_base == 0) return 0; // update the problem domain. Note the we only do this on the base level because // amrex::Geometry objects share the same, static RealBox. @@ -174,6 +174,8 @@ WarpX::MoveWindow (bool move_j) current_injection_position = new_injection_position; } } + + return num_shift_base; } void |