ARTEMIS
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.H>
14 #include <AMReX_FArrayBox.H>
15 #include <AMReX_REAL.H>
16 
17 
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::ParticleReal inv_c2 = 1._prt/(PhysConst::c*PhysConst::c);
28 
29  // Compute inverse Lorentz factor
30  const amrex::ParticleReal inv_gamma = 1._prt/std::sqrt(1._prt + (ux*ux + uy*uy + uz*uz)*inv_c2);
31  // Update positions over one time step
32 #if (AMREX_SPACEDIM >= 2)
33  x += ux * inv_gamma * dt;
34 #else
36 #endif
37 #if defined(WARPX_DIM_3D) || defined(WARPX_DIM_RZ) // RZ pushes particles in 3D
38  y += uy * inv_gamma * dt;
39 #else
41 #endif
42  z += uz * inv_gamma * dt;
43 }
44 
45 #endif // WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_
#define AMREX_INLINE
#define AMREX_GPU_HOST_DEVICE
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's positions over one timestep, given the value of its momenta ux,...
Definition: UpdatePosition.H:21
def y
Definition: Excitation_Flag_Generator.py:76
def x
Formats datastring to remove "+" at the end of the string #####.
Definition: Excitation_Flag_Generator.py:75
def z
Definition: Excitation_Flag_Generator.py:77
static constexpr auto c
vacuum speed of light [m/s]
Definition: constant.H:44
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
int dt
Definition: stencil.py:440