Skip to content

Commit

Permalink
Rename Depose -> Deposit (ECP-WarpX#4474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l authored Dec 5, 2023
1 parent 431bd94 commit 60516d5
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 164 deletions.
62 changes: 31 additions & 31 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ WarpX::Evolve (int numsteps)
electromagnetic_solver_id == ElectromagneticSolverAlgo::HybridPIC )
{
const bool skip_deposition = true;
PushParticlesandDepose(cur_time, skip_deposition);
PushParticlesandDeposit(cur_time, skip_deposition);
}
// Electromagnetic case: multi-J algorithm
else if (do_multi_J)
Expand Down Expand Up @@ -425,7 +425,7 @@ WarpX::OneStep_nosub (Real cur_time)
ExecutePythonCallback("particlescraper");
ExecutePythonCallback("beforedeposition");

PushParticlesandDepose(cur_time);
PushParticlesandDeposit(cur_time);

ExecutePythonCallback("afterdeposition");

Expand Down Expand Up @@ -597,7 +597,7 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
// Push particle from x^{n} to x^{n+1}
// from p^{n-1/2} to p^{n+1/2}
const bool skip_deposition = true;
PushParticlesandDepose(cur_time, skip_deposition);
PushParticlesandDeposit(cur_time, skip_deposition);

// Initialize multi-J loop:

Expand Down Expand Up @@ -639,29 +639,29 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
}

// Number of depositions for multi-J scheme
const int n_depose = WarpX::do_multi_J_n_depositions;
const int n_deposit = WarpX::do_multi_J_n_depositions;
// Time sub-step for each multi-J deposition
const amrex::Real sub_dt = dt[0] / static_cast<amrex::Real>(n_depose);
const amrex::Real sub_dt = dt[0] / static_cast<amrex::Real>(n_deposit);
// Whether to perform multi-J depositions on a time interval that spans
// one or two full time steps (from n*dt to (n+1)*dt, or from n*dt to (n+2)*dt)
const int n_loop = (WarpX::fft_do_time_averaging) ? 2*n_depose : n_depose;
const int n_loop = (WarpX::fft_do_time_averaging) ? 2*n_deposit : n_deposit;

// Loop over multi-J depositions
for (int i_depose = 0; i_depose < n_loop; i_depose++)
for (int i_deposit = 0; i_deposit < n_loop; i_deposit++)
{
// Move J from new to old if J is linear in time
if (J_in_time == JInTime::Linear) PSATDMoveJNewToJOld();

const amrex::Real t_depose_current = (J_in_time == JInTime::Linear) ?
(i_depose-n_depose+1)*sub_dt : (i_depose-n_depose+0.5_rt)*sub_dt;
const amrex::Real t_deposit_current = (J_in_time == JInTime::Linear) ?
(i_deposit-n_deposit+1)*sub_dt : (i_deposit-n_deposit+0.5_rt)*sub_dt;

const amrex::Real t_depose_charge = (rho_in_time == RhoInTime::Linear) ?
(i_depose-n_depose+1)*sub_dt : (i_depose-n_depose+0.5_rt)*sub_dt;
const amrex::Real t_deposit_charge = (rho_in_time == RhoInTime::Linear) ?
(i_deposit-n_deposit+1)*sub_dt : (i_deposit-n_deposit+0.5_rt)*sub_dt;

// Deposit new J at relative time t_depose_current with time step dt
// Deposit new J at relative time t_deposit_current with time step dt
// (dt[0] denotes the time step on mesh refinement level 0)
auto& current = (WarpX::do_current_centering) ? current_fp_nodal : current_fp;
mypc->DepositCurrent(current, dt[0], t_depose_current);
mypc->DepositCurrent(current, dt[0], t_deposit_current);
// Synchronize J: filter, exchange boundary, and interpolate across levels.
// With current centering, the nodal current is deposited in 'current',
// namely 'current_fp_nodal': SyncCurrent stores the result of its centering
Expand All @@ -678,8 +678,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
// Move rho from new to old if rho is linear in time
if (rho_in_time == RhoInTime::Linear) PSATDMoveRhoNewToRhoOld();

// Deposit rho at relative time t_depose_charge
mypc->DepositCharge(rho_fp, t_depose_charge);
// Deposit rho at relative time t_deposit_charge
mypc->DepositCharge(rho_fp, t_deposit_charge);
// Filter, exchange boundary, and interpolate across levels
SyncRho(rho_fp, rho_cp, charge_buf);
// Forward FFT of rho
Expand All @@ -696,9 +696,9 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
// Advance E,B,F,G fields in time and update the average fields
PSATDPushSpectralFields();

// Transform non-average fields E,B,F,G after n_depose pushes
// Transform non-average fields E,B,F,G after n_deposit pushes
// (the relative time reached here coincides with an integer full time step)
if (i_depose == n_depose-1)
if (i_deposit == n_deposit-1)
{
PSATDBackwardTransformEB(Efield_fp, Bfield_fp, Efield_cp, Bfield_cp);
if (WarpX::do_dive_cleaning) PSATDBackwardTransformF();
Expand Down Expand Up @@ -778,7 +778,7 @@ WarpX::OneStep_sub1 (Real curtime)
const int coarse_lev = 0;

// i) Push particles and fields on the fine patch (first fine step)
PushParticlesandDepose(fine_lev, curtime, DtType::FirstHalf);
PushParticlesandDeposit(fine_lev, curtime, DtType::FirstHalf);
RestrictCurrentFromFineToCoarsePatch(current_fp, current_cp, fine_lev);
RestrictRhoFromFineToCoarsePatch(rho_fp, rho_cp, fine_lev);
if (use_filter) ApplyFilterJ(current_fp, fine_lev);
Expand Down Expand Up @@ -809,7 +809,7 @@ WarpX::OneStep_sub1 (Real curtime)
// ii) Push particles on the coarse patch and mother grid.
// Push the fields on the coarse patch and mother grid
// by only half a coarse step (first half)
PushParticlesandDepose(coarse_lev, curtime, DtType::Full);
PushParticlesandDeposit(coarse_lev, curtime, DtType::Full);
StoreCurrent(coarse_lev);
AddCurrentFromFineLevelandSumBoundary(current_fp, current_cp, current_buf, coarse_lev);
AddRhoFromFineLevelandSumBoundary(rho_fp, rho_cp, charge_buf, coarse_lev, 0, ncomps);
Expand Down Expand Up @@ -839,7 +839,7 @@ WarpX::OneStep_sub1 (Real curtime)
FillBoundaryAux(guard_cells.ng_UpdateAux);

// iv) Push particles and fields on the fine patch (second fine step)
PushParticlesandDepose(fine_lev, curtime+dt[fine_lev], DtType::SecondHalf);
PushParticlesandDeposit(fine_lev, curtime + dt[fine_lev], DtType::SecondHalf);
RestrictCurrentFromFineToCoarsePatch(current_fp, current_cp, fine_lev);
RestrictRhoFromFineToCoarsePatch(rho_fp, rho_cp, fine_lev);
if (use_filter) ApplyFilterJ(current_fp, fine_lev);
Expand Down Expand Up @@ -954,17 +954,17 @@ WarpX::doQEDEvents (int lev)
#endif

void
WarpX::PushParticlesandDepose (amrex::Real cur_time, bool skip_deposition)
WarpX::PushParticlesandDeposit (amrex::Real cur_time, bool skip_current)
{
// Evolve particles to p^{n+1/2} and x^{n+1}
// Depose current, j^{n+1/2}
// Deposit current, j^{n+1/2}
for (int lev = 0; lev <= finest_level; ++lev) {
PushParticlesandDepose(lev, cur_time, DtType::Full, skip_deposition);
PushParticlesandDeposit(lev, cur_time, DtType::Full, skip_current);
}
}

void
WarpX::PushParticlesandDepose (int lev, amrex::Real cur_time, DtType a_dt_type, bool skip_deposition)
WarpX::PushParticlesandDeposit (int lev, amrex::Real cur_time, DtType a_dt_type, bool skip_current)
{
amrex::MultiFab* current_x = nullptr;
amrex::MultiFab* current_y = nullptr;
Expand All @@ -991,15 +991,15 @@ WarpX::PushParticlesandDepose (int lev, amrex::Real cur_time, DtType a_dt_type,
}

mypc->Evolve(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],
*Efield_aux[lev][0], *Efield_aux[lev][1], *Efield_aux[lev][2],
*Bfield_aux[lev][0], *Bfield_aux[lev][1], *Bfield_aux[lev][2],
*current_x, *current_y, *current_z,
current_buf[lev][0].get(), current_buf[lev][1].get(), current_buf[lev][2].get(),
rho_fp[lev].get(), charge_buf[lev].get(),
Efield_cax[lev][0].get(), Efield_cax[lev][1].get(), Efield_cax[lev][2].get(),
Bfield_cax[lev][0].get(), Bfield_cax[lev][1].get(), Bfield_cax[lev][2].get(),
cur_time, dt[lev], a_dt_type, skip_deposition);
if (! skip_deposition) {
cur_time, dt[lev], a_dt_type, skip_current);
if (! skip_current) {
#ifdef WARPX_DIM_RZ
// This is called after all particles have deposited their current and charge.
ApplyInverseVolumeScalingToCurrentDensity(current_fp[lev][0].get(), current_fp[lev][1].get(), current_fp[lev][2].get(), lev);
Expand All @@ -1022,9 +1022,9 @@ WarpX::PushParticlesandDepose (int lev, amrex::Real cur_time, DtType a_dt_type,
#endif
if (do_fluid_species) {
myfl->Evolve(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],
rho_fp[lev].get(),*current_x, *current_y, *current_z, cur_time, skip_deposition);
*Efield_aux[lev][0], *Efield_aux[lev][1], *Efield_aux[lev][2],
*Bfield_aux[lev][0], *Bfield_aux[lev][1], *Bfield_aux[lev][2],
rho_fp[lev].get(), *current_x, *current_y, *current_z, cur_time, skip_current);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Particles/Deposition/ChargeDeposition.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
since q is a scalar. For non-ionizable species,
ion_lev is a null pointer.
* \param rho_fab FArrayBox of charge density, either full array or tile.
* \param np_to_depose Number of particles for which current is deposited.
* \param np_to_deposit Number of particles for which current is deposited.
* \param dx 3D cell size
* \param xyzmin Physical lower bounds of domain.
* \param lo Index lower bounds of domain.
Expand All @@ -41,7 +41,7 @@ void doChargeDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
const amrex::ParticleReal * const wp,
const int* ion_lev,
amrex::FArrayBox& rho_fab,
long np_to_depose,
long np_to_deposit,
const std::array<amrex::Real,3>& dx,
const std::array<amrex::Real, 3> xyzmin,
amrex::Dim3 lo,
Expand Down Expand Up @@ -95,8 +95,8 @@ void doChargeDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
}
#endif
amrex::ParallelFor(
np_to_depose,
[=] AMREX_GPU_DEVICE (long ip) {
np_to_deposit,
[=] AMREX_GPU_DEVICE (long ip) {
#if defined(WARPX_USE_GPUCLOCK)
const auto KernelTimer = ablastr::parallelization::KernelTimer(
cost && (load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::GpuClock),
Expand Down
32 changes: 16 additions & 16 deletions Source/Particles/Deposition/CurrentDeposition.H
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
since q is a scalar. For non-ionizable species,
ion_lev is a null pointer.
* \param jx_fab,jy_fab,jz_fab FArrayBox of current density, either full array or tile.
* \param np_to_depose Number of particles for which current is deposited.
* \param np_to_deposit Number of particles for which current is deposited.
* \param relative_time Time at which to deposit J, relative to the time of the
* current positions of the particles. When different than 0,
* the particle position will be temporarily modified to match
Expand All @@ -60,7 +60,7 @@ void doDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
amrex::FArrayBox& jx_fab,
amrex::FArrayBox& jy_fab,
amrex::FArrayBox& jz_fab,
long np_to_depose,
long np_to_deposit,
amrex::Real relative_time,
const std::array<amrex::Real,3>& dx,
const std::array<amrex::Real,3>& xyzmin,
Expand Down Expand Up @@ -126,8 +126,8 @@ void doDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
}
#endif
amrex::ParallelFor(
np_to_depose,
[=] AMREX_GPU_DEVICE (long ip) {
np_to_deposit,
[=] AMREX_GPU_DEVICE (long ip) {
#if defined(WARPX_USE_GPUCLOCK)
const auto KernelTimer = ablastr::parallelization::KernelTimer(
cost && (load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::GpuClock),
Expand Down Expand Up @@ -350,7 +350,7 @@ void doDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
since q is a scalar. For non-ionizable species,
ion_lev is a null pointer.
* \param jx_fab,jy_fab,jz_fab FArrayBox of current density, either full array or tile.
* \param np_to_depose Number of particles for which current is deposited.
* \param np_to_deposit Number of particles for which current is deposited.
* \param dt Time step for particle level
* \param relative_time Time at which to deposit J, relative to the time of the
* current positions of the particles. When different than 0,
Expand All @@ -374,7 +374,7 @@ void doDepositionSharedShapeN (const GetParticlePosition<PIdx>& GetPosition,
amrex::FArrayBox& jx_fab,
amrex::FArrayBox& jy_fab,
amrex::FArrayBox& jz_fab,
long np_to_depose,
long np_to_deposit,
const amrex::Real relative_time,
const std::array<amrex::Real,3>& dx,
const std::array<amrex::Real,3>& xyzmin,
Expand Down Expand Up @@ -437,7 +437,7 @@ void doDepositionSharedShapeN (const GetParticlePosition<PIdx>& GetPosition,
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(shared_mem_bytes <= max_shared_mem_bytes,
"Tile size too big for GPU shared memory current deposition");

amrex::ignore_unused(np_to_depose);
amrex::ignore_unused(np_to_deposit);
// Launch one thread-block per bin
amrex::launch(
nblocks, threads_per_block, shared_mem_bytes, amrex::Gpu::gpuStream(),
Expand Down Expand Up @@ -545,7 +545,7 @@ void doDepositionSharedShapeN (const GetParticlePosition<PIdx>& GetPosition,
// Note, you should never reach this part of the code. This funcion cannot be called unless
// using HIP/CUDA, and those things are checked prior
//don't use any args
ignore_unused( GetPosition, wp, uxp, uyp, uzp, ion_lev, jx_fab, jy_fab, jz_fab, np_to_depose, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes, cost, load_balance_costs_update_algo, a_bins, box, geom, a_tbox_max_size);
ignore_unused(GetPosition, wp, uxp, uyp, uzp, ion_lev, jx_fab, jy_fab, jz_fab, np_to_deposit, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes, cost, load_balance_costs_update_algo, a_bins, box, geom, a_tbox_max_size);
WARPX_ABORT_WITH_MESSAGE("Shared memory only implemented for HIP/CUDA");
#endif
}
Expand All @@ -562,7 +562,7 @@ void doDepositionSharedShapeN (const GetParticlePosition<PIdx>& GetPosition,
since q is a scalar. For non-ionizable species,
ion_lev is a null pointer.
* \param Jx_arr,Jy_arr,Jz_arr Array4 of current density, either full array or tile.
* \param np_to_depose Number of particles for which current is deposited.
* \param np_to_deposit Number of particles for which current is deposited.
* \param dt Time step for particle level
* \param[in] relative_time Time at which to deposit J, relative to the time of the
* current positions of the particles. When different than 0,
Expand All @@ -586,7 +586,7 @@ void doEsirkepovDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
const amrex::Array4<amrex::Real>& Jx_arr,
const amrex::Array4<amrex::Real>& Jy_arr,
const amrex::Array4<amrex::Real>& Jz_arr,
long np_to_depose,
long np_to_deposit,
amrex::Real dt,
amrex::Real relative_time,
const std::array<amrex::Real,3>& dx,
Expand Down Expand Up @@ -656,7 +656,7 @@ void doEsirkepovDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
}
#endif
amrex::ParallelFor(
np_to_depose,
np_to_deposit,
[=] AMREX_GPU_DEVICE (long const ip) {
#if defined(WARPX_USE_GPUCLOCK)
const auto KernelTimer = ablastr::parallelization::KernelTimer(
Expand Down Expand Up @@ -941,7 +941,7 @@ void doEsirkepovDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
required to have the charge of each macroparticle since \c q
is a scalar. For non-ionizable species, \c ion_lev is \c null
* \param[in,out] Dx_fab,Dy_fab,Dz_fab FArrayBox of Vay current density, either full array or tile
* \param[in] np_to_depose Number of particles for which current is deposited
* \param[in] np_to_deposit Number of particles for which current is deposited
* \param[in] dt Time step for particle level
* \param[in] relative_time Time at which to deposit D, relative to the time of the
* current positions of the particles. When different than 0,
Expand All @@ -966,7 +966,7 @@ void doVayDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
amrex::FArrayBox& Dx_fab,
amrex::FArrayBox& Dy_fab,
amrex::FArrayBox& Dz_fab,
long np_to_depose,
long np_to_deposit,
amrex::Real dt,
amrex::Real relative_time,
const std::array<amrex::Real,3>& dx,
Expand All @@ -982,14 +982,14 @@ void doVayDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
#if defined(WARPX_DIM_RZ)
amrex::ignore_unused(GetPosition,
wp, uxp, uyp, uzp, ion_lev, Dx_fab, Dy_fab, Dz_fab,
np_to_depose, dt, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes);
np_to_deposit, dt, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes);
WARPX_ABORT_WITH_MESSAGE("Vay deposition not implemented in RZ geometry");
#endif

#if defined(WARPX_DIM_1D_Z)
amrex::ignore_unused(GetPosition,
wp, uxp, uyp, uzp, ion_lev, Dx_fab, Dy_fab, Dz_fab,
np_to_depose, dt, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes);
np_to_deposit, dt, relative_time, dx, xyzmin, lo, q, n_rz_azimuthal_modes);
WARPX_ABORT_WITH_MESSAGE("Vay deposition not implemented in cartesian 1D geometry");
#endif

Expand Down Expand Up @@ -1054,7 +1054,7 @@ void doVayDepositionShapeN (const GetParticlePosition<PIdx>& GetPosition,
*cost_real = 0._rt;
}
#endif
amrex::ParallelFor(np_to_depose, [=] AMREX_GPU_DEVICE (long ip)
amrex::ParallelFor(np_to_deposit, [=] AMREX_GPU_DEVICE (long ip)
{
#if defined(WARPX_USE_GPUCLOCK)
const auto KernelTimer = ablastr::parallelization::KernelTimer(
Expand Down
4 changes: 2 additions & 2 deletions Source/Particles/PhotonParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public:
amrex::MultiFab* /*rho*/,
int /*icomp*/,
const long /*offset*/,
const long /*np_to_depose*/,
const long /*np_to_deposit*/,
int /*thread_num*/,
int /*lev*/,
int /*depos_lev*/) override {}
Expand All @@ -119,7 +119,7 @@ public:
amrex::MultiFab * const /*jy*/,
amrex::MultiFab * const /*jz*/,
long const /*offset*/,
long const /*np_to_depose*/,
long const /*np_to_deposit*/,
int const /*thread_num*/,
int const /*lev*/,
int const /*depos_lev*/,
Expand Down
Loading

0 comments on commit 60516d5

Please sign in to comment.