7 #ifndef WARPX_PARTICLES_COLLISION_COMPUTE_TEMPERATURE_H_
8 #define WARPX_PARTICLES_COLLISION_COMPUTE_TEMPERATURE_H_
13 template <
typename T_index,
typename T_R>
16 T_index
const Is, T_index
const Ie, T_index
const * AMREX_RESTRICT I,
17 T_R
const * AMREX_RESTRICT
w,
18 T_R
const * AMREX_RESTRICT ux, T_R
const * AMREX_RESTRICT uy, T_R
const * AMREX_RESTRICT uz,
24 const int N = Ie - Is;
25 if ( N == 0 ) {
return T_R(0.0); }
27 T_R vx = T_R(0.0); T_R vy = T_R(0.0);
28 T_R vz = T_R(0.0); T_R vs = T_R(0.0);
29 T_R gm = T_R(0.0); T_R us = T_R(0.0);
32 for (
int i = Is; i < static_cast<int>(Ie); ++
i)
34 us = ( ux[ I[
i] ] * ux[ I[
i] ] +
35 uy[ I[
i] ] * uy[ I[
i] ] +
36 uz[ I[
i] ] * uz[ I[
i] ] );
37 gm = std::sqrt( T_R(1.0) + us*inv_c2 );
39 vx +=
w[ I[
i] ] * ux[ I[
i] ] / gm;
40 vy +=
w[ I[
i] ] * uy[ I[
i] ] / gm;
41 vz +=
w[ I[
i] ] * uz[ I[
i] ] / gm;
42 vs +=
w[ I[
i] ] * us / gm / gm;
45 vx = vx / wtot; vy = vy / wtot;
46 vz = vz / wtot; vs = vs / wtot;
48 return m/T_R(3.0)*(vs-(vx*vx+vy*vy+vz*vz));
#define AMREX_GPU_HOST_DEVICE
AMREX_GPU_HOST_DEVICE T_R ComputeTemperature(T_index const Is, T_index const Ie, T_index const *AMREX_RESTRICT I, T_R const *AMREX_RESTRICT w, T_R const *AMREX_RESTRICT ux, T_R const *AMREX_RESTRICT uy, T_R const *AMREX_RESTRICT uz, T_R const m)
Definition: ComputeTemperature.H:15
static constexpr auto c
vacuum speed of light [m/s]
Definition: constant.H:44
i
Definition: check_interp_points_and_weights.py:174
tuple w
Definition: yt3d_mpi.py:46