WarpX
UpdatePosition.H
Go to the documentation of this file.
1 /* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe
2  * Weiqun Zhang
3  *
4  * This file is part of WarpX.
5  *
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_
9 #define WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_
10 
11 #include "Utils/WarpXConst.H"
12 
13 #include <AMReX_REAL.H>
14 #include <AMReX_FArrayBox.H>
15 #include <AMReX.H>
16 
17 
20 AMREX_GPU_HOST_DEVICE AMREX_INLINE
21 void UpdatePosition(amrex::ParticleReal& x, amrex::ParticleReal& y, amrex::ParticleReal& z,
22  const amrex::ParticleReal ux, const amrex::ParticleReal uy, const amrex::ParticleReal uz,
23  const amrex::Real dt )
24 {
25  using namespace amrex::literals;
26 
27  constexpr amrex::Real inv_c2 = 1._rt/(PhysConst::c*PhysConst::c);
28 
29  // Compute inverse Lorentz factor
30  const amrex::Real inv_gamma = 1._rt/std::sqrt(1._rt + (ux*ux + uy*uy + uz*uz)*inv_c2);
31  // Update positions over one time step
32  x += ux * inv_gamma * dt;
33 #if (AMREX_SPACEDIM == 3) || (defined WARPX_DIM_RZ) // RZ pushes particles in 3D
34  y += uy * inv_gamma * dt;
35 #else
36  amrex::ignore_unused(y);
37 #endif
38  z += uz * inv_gamma * dt;
39 }
40 
41 #endif // WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_
def x
Definition: read_lab_particles.py:25
def uz
Definition: read_lab_particles.py:29
def z
Definition: read_lab_particles.py:26
def ux
Definition: read_lab_particles.py:28
AMREX_GPU_HOST_DEVICE AMREX_INLINE void UpdatePosition(amrex::ParticleReal &x, amrex::ParticleReal &y, amrex::ParticleReal &z, const amrex::ParticleReal ux, const amrex::ParticleReal uy, const amrex::ParticleReal uz, const amrex::Real dt)
Push the particle&#39;s positions over one timestep, given the value of its momenta ux, uy, uz
Definition: UpdatePosition.H:21