diff options
Diffstat (limited to 'Source/Particles/Pusher')
-rw-r--r-- | Source/Particles/Pusher/GetAndSetPosition.H | 35 | ||||
-rw-r--r-- | Source/Particles/Pusher/UpdatePosition.H | 4 | ||||
-rw-r--r-- | Source/Particles/Pusher/UpdatePositionPhoton.H | 4 |
3 files changed, 38 insertions, 5 deletions
diff --git a/Source/Particles/Pusher/GetAndSetPosition.H b/Source/Particles/Pusher/GetAndSetPosition.H index b0f1257f5..4df1ef3c1 100644 --- a/Source/Particles/Pusher/GetAndSetPosition.H +++ b/Source/Particles/Pusher/GetAndSetPosition.H @@ -35,10 +35,14 @@ void get_particle_position (const WarpXParticleContainer::SuperParticleType& p, x = p.pos(0); y = p.pos(1); z = p.pos(2); -#else +#elif WARPX_DIM_XZ x = p.pos(0); y = amrex::ParticleReal(0.0); z = p.pos(1); +#else + x = amrex::ParticleReal(0.0); + y = amrex::ParticleReal(0.0); + z = p.pos(0); #endif } @@ -55,6 +59,9 @@ struct GetParticlePosition const RType* m_theta = nullptr; #elif (AMREX_SPACEDIM == 2) static constexpr RType m_y_default = RType(0.0); +#elif (AMREX_SPACEDIM == 1) + static constexpr RType m_x_default = RType(0.0); + static constexpr RType m_y_default = RType(0.0); #endif GetParticlePosition () = default; @@ -93,10 +100,14 @@ struct GetParticlePosition x = p.pos(0); y = p.pos(1); z = p.pos(2); -#else +#elif WARPX_DIM_XZ x = p.pos(0); y = m_y_default; z = p.pos(1); +#else + x = m_x_default; + y = m_y_default; + z = p.pos(0); #endif } @@ -117,10 +128,14 @@ struct GetParticlePosition x = p.pos(0); y = p.pos(1); z = p.pos(2); -#else +#elif WARPX_DIM_XZ x = p.pos(0); y = m_y_default; z = p.pos(1); +#else + x = m_x_default; + y = m_y_default; + z = p.pos(0); #endif } }; @@ -158,6 +173,9 @@ struct SetParticlePosition #if defined(WARPX_DIM_XZ) amrex::ignore_unused(y); #endif +#if defined(WARPX_DIM_1D_Z) + amrex::ignore_unused(x,y); +#endif #ifdef WARPX_DIM_RZ m_theta[i] = std::atan2(y, x); m_structs[i].pos(0) = std::sqrt(x*x + y*y); @@ -166,9 +184,11 @@ struct SetParticlePosition m_structs[i].pos(0) = x; m_structs[i].pos(1) = y; m_structs[i].pos(2) = z; -#else +#elif WARPX_DIM_XZ m_structs[i].pos(0) = x; m_structs[i].pos(1) = z; +#else + m_structs[i].pos(0) = z; #endif } @@ -182,6 +202,9 @@ struct SetParticlePosition #if defined(WARPX_DIM_XZ) amrex::ignore_unused(y); #endif +#if defined(WARPX_DIM_1D_Z) + amrex::ignore_unused(x,y); +#endif #ifdef WARPX_DIM_RZ m_structs[i].pos(0) = x; m_theta[i] = y; @@ -190,9 +213,11 @@ struct SetParticlePosition m_structs[i].pos(0) = x; m_structs[i].pos(1) = y; m_structs[i].pos(2) = z; -#else +#elif WARPX_DIM_XZ m_structs[i].pos(0) = x; m_structs[i].pos(1) = z; +#else + m_structs[i].pos(0) = z; #endif } }; diff --git a/Source/Particles/Pusher/UpdatePosition.H b/Source/Particles/Pusher/UpdatePosition.H index 8ebb0b49a..39b12cd67 100644 --- a/Source/Particles/Pusher/UpdatePosition.H +++ b/Source/Particles/Pusher/UpdatePosition.H @@ -29,7 +29,11 @@ void UpdatePosition(amrex::ParticleReal& x, amrex::ParticleReal& y, amrex::Parti // Compute inverse Lorentz factor const amrex::Real inv_gamma = 1._rt/std::sqrt(1._rt + (ux*ux + uy*uy + uz*uz)*inv_c2); // Update positions over one time step +#if (AMREX_SPACEDIM >= 2) x += ux * inv_gamma * dt; +#else + amrex::ignore_unused(x); +#endif #if (AMREX_SPACEDIM == 3) || (defined WARPX_DIM_RZ) // RZ pushes particles in 3D y += uy * inv_gamma * dt; #else diff --git a/Source/Particles/Pusher/UpdatePositionPhoton.H b/Source/Particles/Pusher/UpdatePositionPhoton.H index f52eb1c75..5e958c2c1 100644 --- a/Source/Particles/Pusher/UpdatePositionPhoton.H +++ b/Source/Particles/Pusher/UpdatePositionPhoton.H @@ -32,7 +32,11 @@ void UpdatePositionPhoton( const amrex::Real c_over_umod = (u_norm == 0._rt) ? 0._rt: PhysConst::c/u_norm; // Update positions over one time step +#if (AMREX_SPACEDIM >= 2) x += ux * c_over_umod * dt; +#else + amrex::ignore_unused(x); +#endif #if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ) // RZ pushes particles in 3D y += uy * c_over_umod * dt; #else |