Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add call to HandleParticlesAtBoundaries in WarpXEvolve.cpp to prevent oob segfaults #5136

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,30 +172,6 @@ WarpX::Evolve (int numsteps)
// B : guard cells are NOT up-to-date
}

// TODO: move out
if (evolve_scheme == EvolveScheme::Explicit) {
if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) {
// At the end of last step, push p by 0.5*dt to synchronize
FillBoundaryE(guard_cells.ng_FieldGather);
FillBoundaryB(guard_cells.ng_FieldGather);
if (fft_do_time_averaging)
{
FillBoundaryE_avg(guard_cells.ng_FieldGather);
FillBoundaryB_avg(guard_cells.ng_FieldGather);
}
UpdateAuxilaryData();
FillBoundaryAux(guard_cells.ng_UpdateAux);
for (int lev = 0; lev <= finest_level; ++lev) {
mypc->PushP(lev, 0.5_rt*dt[lev],
*Efield_aux[lev][0],*Efield_aux[lev][1],
*Efield_aux[lev][2],
*Bfield_aux[lev][0],*Bfield_aux[lev][1],
*Bfield_aux[lev][2]);
}
is_synchronized = true;
}
}

for (int lev = 0; lev <= max_level; ++lev) {
++istep[lev];
}
Expand Down Expand Up @@ -262,6 +238,29 @@ WarpX::Evolve (int numsteps)
ExecutePythonCallback("afterEsolve");
}

if (evolve_scheme == EvolveScheme::Explicit) {
if (cur_time >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) {
// At the end of last step, push p by 0.5*dt to synchronize
FillBoundaryE(guard_cells.ng_FieldGather);
FillBoundaryB(guard_cells.ng_FieldGather);
if (fft_do_time_averaging)
{
FillBoundaryE_avg(guard_cells.ng_FieldGather);
FillBoundaryB_avg(guard_cells.ng_FieldGather);
}
UpdateAuxilaryData();
FillBoundaryAux(guard_cells.ng_UpdateAux);
for (int lev = 0; lev <= finest_level; ++lev) {
mypc->PushP(lev, 0.5_rt*dt[lev],
*Efield_aux[lev][0],*Efield_aux[lev][1],
*Efield_aux[lev][2],
*Bfield_aux[lev][0],*Bfield_aux[lev][1],
*Bfield_aux[lev][2]);
}
is_synchronized = true;
}
}

// afterstep callback runs with the updated global time. It is included
// in the evolve timing.
ExecutePythonCallback("afterstep");
Expand Down
Loading