Skip to content

Commit

Permalink
Remove invalid beam particle from first diagnostic step (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSinn authored Feb 12, 2025
1 parent c0ac640 commit cf5abf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/particles/beam/BeamParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ BeamParticleContainer::initializeSlice (int slice, int which_slice) {
}
);
}

// remove invalid particles so they don't show up in the beam diagnostic of the first time step
amrex::removeInvalidParticles(getBeamSlice(which_slice));
resize(which_slice, getBeamSlice(which_slice).size(), 0);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/particles/beam/BeamParticleContainerInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace
ptd.rdata(BeamIdx::ux )[ip] = uxp;
ptd.rdata(BeamIdx::uy )[ip] = uyp;
ptd.rdata(BeamIdx::uz )[ip] = uz * speed_of_light;
ptd.rdata(BeamIdx::w )[ip] = std::abs(weight);
ptd.rdata(BeamIdx::w )[ip] = is_valid ? std::abs(weight) : amrex::Real{0};

ptd.idata(BeamIdx::nsubcycles)[ip] = 0;
ptd.idata(BeamIdx::mr_level)[ip] = 0;
Expand Down
1 change: 0 additions & 1 deletion src/salame/Salame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ SalameMultiplyBeamWeight (const amrex::Real W, Hipace* hipace)
// invalidate particles with a weight of zero
if (W == 0) {
id.make_invalid();
return;
}

// Multiply SALAME beam particles on this slice with W
Expand Down

0 comments on commit cf5abf8

Please sign in to comment.