Skip to content

Commit cb9503c

Browse files
committed
Fixes in Source/Particles/LaserParticleContainer.cpp
1 parent 09b999d commit cb9503c

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

Source/Particles/LaserParticleContainer.cpp

+7-17
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,10 @@ LaserParticleContainer::InitData (int lev)
413413
#if defined(WARPX_DIM_3D)
414414
return {m_u_X[0]*(pos[0]-m_position[0])+m_u_X[1]*(pos[1]-m_position[1])+m_u_X[2]*(pos[2]-m_position[2]),
415415
m_u_Y[0]*(pos[0]-m_position[0])+m_u_Y[1]*(pos[1]-m_position[1])+m_u_Y[2]*(pos[2]-m_position[2])};
416-
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
417-
# if defined(WARPX_DIM_RZ)
416+
#elif defined(WARPX_DIM_RZ)
418417
return {pos[0]-m_position[0], 0.0_rt};
419-
# else
418+
#elif defined(WARPX_DIM_XZ)
420419
return {m_u_X[0]*(pos[0]-m_position[0])+m_u_X[2]*(pos[2]-m_position[2]), 0.0_rt};
421-
# endif
422420
#else
423421
return {m_u_X[2]*(pos[2]-m_position[2]), 0.0_rt};
424422
#endif
@@ -734,13 +732,12 @@ LaserParticleContainer::ComputeSpacing (int lev, Real& Sx, Real& Sy) const
734732
Sy = std::min(std::min(dx[0]/(std::abs(m_u_Y[0])+eps),
735733
dx[1]/(std::abs(m_u_Y[1])+eps)),
736734
dx[2]/(std::abs(m_u_Y[2])+eps));
737-
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
738-
# if defined(WARPX_DIM_RZ)
735+
#elif defined(WARPX_DIM_RZ)
739736
Sx = dx[0];
740-
# else
737+
Sy = 1.0;
738+
#elif defined(WARPX_DIM_XZ)
741739
Sx = std::min(dx[0]/(std::abs(m_u_X[0])+eps),
742740
dx[2]/(std::abs(m_u_X[2])+eps));
743-
# endif
744741
Sy = 1.0;
745742
#else
746743
Sx = 1.0;
@@ -750,7 +747,7 @@ LaserParticleContainer::ComputeSpacing (int lev, Real& Sx, Real& Sy) const
750747
}
751748

752749
void
753-
LaserParticleContainer::ComputeWeightMobility (Real Sx, Real Sy)
750+
LaserParticleContainer::ComputeWeightMobility ([[maybe_unused]] Real Sx, [[maybe_unused]] Real Sy)
754751
{
755752
// The mobility is the constant of proportionality between the field to
756753
// be emitted, and the corresponding velocity that the particles need to have.
@@ -760,14 +757,7 @@ LaserParticleContainer::ComputeWeightMobility (Real Sx, Real Sy)
760757
m_mobility = eps/m_e_max;
761758
m_weight = PhysConst::ep0 / m_mobility;
762759
// Multiply by particle spacing
763-
#if defined(WARPX_DIM_3D)
764-
m_weight *= Sx * Sy;
765-
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
766-
m_weight *= Sx;
767-
amrex::ignore_unused(Sy);
768-
#else
769-
amrex::ignore_unused(Sx,Sy);
770-
#endif
760+
m_weight *= AMREX_D_TERM(1._rt, * Sx, * Sy);
771761
// When running in the boosted-frame, the input parameters (and in particular
772762
// the amplitude of the field) are given in the lab-frame.
773763
// Therefore, the mobility needs to be modified by a factor WarpX::gamma_boost.

0 commit comments

Comments
 (0)