aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/LaserParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2022-09-20 16:54:42 -0700
committerGravatar GitHub <noreply@github.com> 2022-09-20 23:54:42 +0000
commit71ca75648289904e071b4f6ba6ce8a031ac725f2 (patch)
treefbd8b62d7c6b4ab8e6436a4bffddfcd5f54aebbf /Source/Particles/LaserParticleContainer.cpp
parent5761b4bf998eab84ea0f7e4b132026593f3ddf9f (diff)
downloadWarpX-71ca75648289904e071b4f6ba6ce8a031ac725f2.tar.gz
WarpX-71ca75648289904e071b4f6ba6ce8a031ac725f2.tar.zst
WarpX-71ca75648289904e071b4f6ba6ce8a031ac725f2.zip
Add option to deposit laser on main grid (#3235)
* Add option to deposit laser on main grid * Use `deposit_on_main_grid` * Update Source/Particles/LaserParticleContainer.cpp * Add documentation * Update documentation
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r--Source/Particles/LaserParticleContainer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp
index 565ac3ee1..a8df886be 100644
--- a/Source/Particles/LaserParticleContainer.cpp
+++ b/Source/Particles/LaserParticleContainer.cpp
@@ -550,6 +550,8 @@ LaserParticleContainer::Evolve (int lev,
amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev);
+ const bool has_buffer = cjx;
+
#ifdef AMREX_USE_OMP
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
@@ -578,18 +580,21 @@ LaserParticleContainer::Evolve (int lev,
auto& uzp = attribs[PIdx::uz];
const long np = pti.numParticles();
- // For now, laser particles do not take the current buffers into account
- const long np_current = np;
-
plane_Xp.resize(np);
plane_Yp.resize(np);
amplitude_E.resize(np);
+ // Determine whether particles will deposit on the fine or coarse level
+ long np_current = np;
+ if (lev > 0 && m_deposit_on_main_grid && has_buffer) {
+ np_current = 0;
+ }
+
if (rho && ! skip_deposition && ! do_not_deposit) {
int* AMREX_RESTRICT ion_lev = nullptr;
DepositCharge(pti, wp, ion_lev, rho, 0, 0,
np_current, thread_num, lev, lev);
- if (crho) {
+ if (has_buffer) {
DepositCharge(pti, wp, ion_lev, crho, 0, np_current,
np-np_current, thread_num, lev, lev-1);
}
@@ -628,7 +633,6 @@ LaserParticleContainer::Evolve (int lev,
0, np_current, thread_num,
lev, lev, dt, relative_time);
- const bool has_buffer = cjx;
if (has_buffer)
{
// Deposit in buffers
@@ -643,7 +647,7 @@ LaserParticleContainer::Evolve (int lev,
int* AMREX_RESTRICT ion_lev = nullptr;
DepositCharge(pti, wp, ion_lev, rho, 1, 0,
np_current, thread_num, lev, lev);
- if (crho) {
+ if (has_buffer) {
DepositCharge(pti, wp, ion_lev, crho, 1, np_current,
np-np_current, thread_num, lev, lev-1);
}