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 *I,
17 T_R
const *
ux, T_R
const *uy, T_R
const *
uz, T_R
const m )
20 T_R constexpr inv_c2 = T_R(1.0) / ( PhysConst::c * PhysConst::c );
23 if ( N == 0 ) {
return T_R(0.0); }
25 T_R vx = T_R(0.0); T_R vy = T_R(0.0);
26 T_R vz = T_R(0.0); T_R vs = T_R(0.0);
27 T_R gm = T_R(0.0); T_R us = T_R(0.0);
29 for (
int i = Is; i < static_cast<int>(Ie); ++
i)
31 us = ( ux[ I[
i] ] * ux[ I[
i] ] +
32 uy[ I[
i] ] * uy[ I[
i] ] +
33 uz[ I[
i] ] * uz[ I[
i] ] );
34 gm = std::sqrt( T_R(1.0) + us*inv_c2 );
35 vx += ux[ I[
i] ] / gm;
36 vy += uy[ I[
i] ] / gm;
37 vz += uz[ I[
i] ] / gm;
41 vx = vx / N; vy = vy / N;
42 vz = vz / N; vs = vs / N;
44 return m/T_R(3.0)*(vs-(vx*vx+vy*vy+vz*vz));
47 #endif // WARPX_PARTICLES_COLLISION_COMPUTE_TEMPERATURE_H_
def uz
Definition: read_lab_particles.py:29
i
Definition: check_interp_points_and_weights.py:171
def ux
Definition: read_lab_particles.py:28
AMREX_GPU_HOST_DEVICE T_R ComputeTemperature(T_index const Is, T_index const Ie, T_index const *I, T_R const *ux, T_R const *uy, T_R const *uz, T_R const m)
Definition: ComputeTemperature.H:15