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

Remove redundant which_slice from plasma particle advance #328

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
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
12 changes: 4 additions & 8 deletions src/Hipace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ Hipace::SolveOneSlice (int islice, int lev, amrex::Vector<amrex::DenseBins<BeamP
m_fields.getSlices(lev, WhichSlice::This).setVal(0.);

AdvancePlasmaParticles(m_plasma_container, m_fields, geom[lev],
WhichSlice::This, false,
true, false, false, lev);
false, true, false, false, lev);

m_plasma_container.RedistributeSlice(lev);
amrex::MultiFab rho(m_fields.getSlices(lev, WhichSlice::This), amrex::make_alias,
Expand Down Expand Up @@ -453,8 +452,7 @@ Hipace::PredictorCorrectorLoopToSolveBxBy (const int islice, const int lev)

/* shift force terms, update force terms using guessed Bx and By */
AdvancePlasmaParticles(m_plasma_container, m_fields, geom[lev],
WhichSlice::This, false,
false, true, true, lev);
false, false, true, true, lev);

/* Begin of predictor corrector loop */
int i_iter = 0;
Expand All @@ -466,8 +464,7 @@ Hipace::PredictorCorrectorLoopToSolveBxBy (const int islice, const int lev)
i_iter++;
/* Push particles to the next slice */
AdvancePlasmaParticles(m_plasma_container, m_fields, geom[lev],
WhichSlice::Next, true,
true, false, false, lev);
true, true, false, false, lev);
m_plasma_container.RedistributeSlice(lev);

/* deposit current to next slice */
Expand Down Expand Up @@ -512,8 +509,7 @@ Hipace::PredictorCorrectorLoopToSolveBxBy (const int islice, const int lev)

/* Update force terms using the calculated Bx and By */
AdvancePlasmaParticles(m_plasma_container, m_fields, geom[lev],
WhichSlice::Next, false,
false, true, false, lev);
false, false, true, false, lev);

/* Shift relative_Bfield_error values */
relative_Bfield_error_prev_iter = relative_Bfield_error;
Expand Down
6 changes: 2 additions & 4 deletions src/particles/pusher/PlasmaParticleAdvance.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* \param[in,out] plasma plasma species to push
* \param[in,out] fields the general field class, modified by this function
* \param[in] gm Geometry of the simulation, to get the cell size etc.
* \param[in] which_slice defines if this or the next slice is handled
* \param[in] temp_slice if true, the temporary data (x_temp, ...) will be used
* \param[in] do_push boolean to define if plasma particles are pushed
* \param[in] do_update boolean to define if the force terms are updated
Expand All @@ -18,9 +17,8 @@
*/
void
AdvancePlasmaParticles (PlasmaParticleContainer& plasma, Fields & fields,
amrex::Geometry const& gm, const int which_slice,
const bool temp_slice, const bool do_push, const bool do_update,
const bool do_shift, int const lev);
amrex::Geometry const& gm, const bool temp_slice, const bool do_push,
const bool do_update, const bool do_shift, int const lev);

/** \brief Resets the particle position x, y, to x_prev, y_prev
* \param[in,out] plasma plasma species to reset
Expand Down
10 changes: 2 additions & 8 deletions src/particles/pusher/PlasmaParticleAdvance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,12 @@

void
AdvancePlasmaParticles (PlasmaParticleContainer& plasma, Fields & fields,
amrex::Geometry const& gm, const int which_slice,
const bool temp_slice, const bool do_push, const bool do_update,
const bool do_shift, int const lev)
amrex::Geometry const& gm, const bool temp_slice, const bool do_push,
const bool do_update, const bool do_shift, int const lev)
{
HIPACE_PROFILE("UpdateForcePushParticles_PlasmaParticleContainer()");
using namespace amrex::literals;

AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
which_slice == WhichSlice::This || which_slice == WhichSlice::Next,
"Plasma particles can only be pushed to this slice (WhichSlice::This) "
"or the next slice (WhichSlice::Next)");

// Extract properties associated with physical size of the box
amrex::Real const * AMREX_RESTRICT dx = gm.CellSize();
const PhysConst phys_const = get_phys_const();
Expand Down