Hipace
PushPlasmaParticles.H
Go to the documentation of this file.
1 /* Copyright 2020-2021
2  *
3  * This file is part of HiPACE++.
4  *
5  * Authors: MaxThevenet, Severin Diederichs
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef PUSHPLASMAPARTICLES_H_
9 #define PUSHPLASMAPARTICLES_H_
10 
11 #include <AMReX_Config.H>
12 
13 template<class T>
15  T dz_ux;
16  T dz_uy;
17  T dz_psi;
18 };
19 
39 template<class T>
42  const T& ux,
43  const T& uy,
44  const T& psi_inv,
45  amrex::Real ExmBy,
46  amrex::Real EypBx,
47  amrex::Real Ez,
48  amrex::Real Bx_clight,
49  amrex::Real By_clight,
50  amrex::Real Bz,
51  amrex::Real Aabssq_norm,
52  amrex::Real AabssqDx_norm,
53  amrex::Real AabssqDy_norm,
54  amrex::Real clight_inv,
55  amrex::Real charge_mass_clight_ratio)
56 {
57  using namespace amrex::literals;
58 
59  const T gamma_psi = 0.5_rt*psi_inv*psi_inv*(
60  1.0_rt + Aabssq_norm
61  + ux*ux*(clight_inv*clight_inv)
62  + uy*uy*(clight_inv*clight_inv))
63  + 0.5_rt;
64 
65  const T dz_ux = (charge_mass_clight_ratio * (gamma_psi * ExmBy
66  + By_clight + ( uy * Bz ) * psi_inv) - AabssqDx_norm * psi_inv);
67 
68  const T dz_uy = (charge_mass_clight_ratio * (gamma_psi * EypBx
69  - Bx_clight - ( ux * Bz ) * psi_inv) - AabssqDy_norm * psi_inv);
70 
71  const T dz_psi = (charge_mass_clight_ratio * clight_inv *
72  (( ux * ExmBy + uy * EypBx ) * clight_inv * psi_inv - Ez ));
73 
74  return {dz_ux, dz_uy, dz_psi};
75 }
76 
77 #endif // PUSHPLASMAPARTICLES_H_
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PlasmaMomentumDerivative< T > PlasmaMomentumPush(const T &ux, const T &uy, const T &psi_inv, amrex::Real ExmBy, amrex::Real EypBx, amrex::Real Ez, amrex::Real Bx_clight, amrex::Real By_clight, amrex::Real Bz, amrex::Real Aabssq_norm, amrex::Real AabssqDx_norm, amrex::Real AabssqDy_norm, amrex::Real clight_inv, amrex::Real charge_mass_clight_ratio)
Find the derivative of the Plasma momentum. This function can be used with dual numbers to find the s...
Definition: PushPlasmaParticles.H:41
Definition: PushPlasmaParticles.H:14
T dz_ux
Definition: PushPlasmaParticles.H:15
T dz_uy
Definition: PushPlasmaParticles.H:16
T dz_psi
Definition: PushPlasmaParticles.H:17