aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Pusher
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/Pusher')
-rw-r--r--Source/Particles/Pusher/Make.package1
-rw-r--r--Source/Particles/Pusher/UpdatePositionPhoton.H29
2 files changed, 30 insertions, 0 deletions
diff --git a/Source/Particles/Pusher/Make.package b/Source/Particles/Pusher/Make.package
index 95a38fa2d..45886702e 100644
--- a/Source/Particles/Pusher/Make.package
+++ b/Source/Particles/Pusher/Make.package
@@ -2,5 +2,6 @@ CEXE_headers += GetAndSetPosition.H
CEXE_headers += UpdatePosition.H
CEXE_headers += UpdateMomentumBoris.H
CEXE_headers += UpdateMomentumVay.H
+CEXE_headers += UpdatePositionPhoton.H
INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/Particles/Pusher
VPATH_LOCATIONS += $(WARPX_HOME)/Source/Particles/Pusher
diff --git a/Source/Particles/Pusher/UpdatePositionPhoton.H b/Source/Particles/Pusher/UpdatePositionPhoton.H
new file mode 100644
index 000000000..bd6e6cd21
--- /dev/null
+++ b/Source/Particles/Pusher/UpdatePositionPhoton.H
@@ -0,0 +1,29 @@
+#ifndef WARPX_PARTICLES_PUSHER_UPDATEPOSITIONPHOTON_H_
+#define WARPX_PARTICLES_PUSHER_UPDATEPOSITIONPHOTON_H_
+
+#include <WarpXConst.H>
+
+#include <AMReX_FArrayBox.H>
+#include <AMReX_REAL.H>
+
+/* \brief Push the position of a photon particle over one timestep,
+ * given the value of its momenta `ux`, `uy`, `uz` */
+AMREX_GPU_HOST_DEVICE AMREX_INLINE
+void UpdatePositionPhoton(
+ amrex::Real& x, amrex::Real& y, amrex::Real& z,
+ const amrex::Real ux, const amrex::Real uy, const amrex::Real uz,
+ const amrex::Real dt )
+{
+ // Compute speed of light over inverse of momentum modulus
+ const amrex::Real c_over_umod = PhysConst::c/std::sqrt(ux*ux + uy*uy + uz*uz);
+
+ // Update positions over one time step
+ x += ux * c_over_umod * dt;
+#if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ) // RZ pushes particles in 3D
+ y += uy * c_over_umod * dt;
+#endif
+ z += uz * c_over_umod * dt;
+
+}
+
+#endif // WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_