diff options
author | 2019-06-10 13:34:55 -0700 | |
---|---|---|
committer | 2019-06-10 13:34:55 -0700 | |
commit | 4e2bc0444eacb6b3db36d7c3c3f7bbe6233c5f19 (patch) | |
tree | 5d5bb1d98d7f0ff4394f24607f4c46a6b3b04a6a /Source/Particles/Pusher/UpdatePosition.H | |
parent | 2c25e914fcaae826a4e28acdc1e7c5348e05a168 (diff) | |
parent | 4c01a51d48f0f95b6ac309060d279145c5443064 (diff) | |
download | WarpX-4e2bc0444eacb6b3db36d7c3c3f7bbe6233c5f19.tar.gz WarpX-4e2bc0444eacb6b3db36d7c3c3f7bbe6233c5f19.tar.zst WarpX-4e2bc0444eacb6b3db36d7c3c3f7bbe6233c5f19.zip |
Merge branch 'dev' into fft_from_local_boxes
Diffstat (limited to 'Source/Particles/Pusher/UpdatePosition.H')
-rw-r--r-- | Source/Particles/Pusher/UpdatePosition.H | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/Particles/Pusher/UpdatePosition.H b/Source/Particles/Pusher/UpdatePosition.H new file mode 100644 index 000000000..0a4f579f4 --- /dev/null +++ b/Source/Particles/Pusher/UpdatePosition.H @@ -0,0 +1,30 @@ +#ifndef WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_ +#define WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_ + +#include <AMReX_FArrayBox.H> +#include <WarpXConst.H> +#include <AMReX_REAL.H> + +/* \brief Push the particle's positions over one timestep, + * given the value of its momenta `ux`, `uy`, `uz` */ +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void UpdatePosition( + 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 ) +{ + + constexpr amrex::Real inv_c2 = 1./(PhysConst::c*PhysConst::c); + + // Compute inverse Lorentz factor + const amrex::Real inv_gamma = 1./std::sqrt(1. + (ux*ux + uy*uy + uz*uz)*inv_c2); + // Update positions over one time step + x += ux * inv_gamma * dt; +#if (AMREX_SPACEDIM == 3) || (defined WARPX_RZ) // RZ pushes particles in 3D + y += uy * inv_gamma * dt; +#endif + z += uz * inv_gamma * dt; + +} + +#endif // WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_ |