8 #ifndef HIPACE_COMPUTE_TEMPERATURE_H_
9 #define HIPACE_COMPUTE_TEMPERATURE_H_
11 template <
typename T_index,
typename T_R>
14 T_index
const Is, T_index
const Ie, T_index
const * AMREX_RESTRICT I,
15 T_R
const * AMREX_RESTRICT ux, T_R
const * AMREX_RESTRICT uy, T_R
const * AMREX_RESTRICT psi,
16 T_R
const m, T_R
const clight, T_R
const inv_c2,
bool is_beam_coll )
18 using namespace amrex::literals;
20 const int N = Ie - Is;
21 if (
N == 0 ) {
return T_R(0.0); }
23 T_R vx = T_R(0.0); T_R vy = T_R(0.0);
24 T_R vz = T_R(0.0); T_R vs = T_R(0.0);
25 T_R gm = T_R(0.0); T_R us = T_R(0.0);
27 for (
int i = Is;
i < (
int) Ie; ++
i)
30 gm = is_beam_coll ? std::sqrt( 1._rt + (ux[I[
i]]*ux[I[
i]] + uy[I[
i]]*uy[I[
i]]
31 + psi[I[
i]]*psi[I[
i]])*inv_c2 )
32 : (1.0_rt + (ux[I[
i]]*ux[I[
i]] + uy[I[
i]]*uy[I[
i]])*inv_c2
33 + psi[I[
i]]*psi[I[
i]]) / (2.0_rt * psi[I[
i]] );
34 const amrex::Real uz = is_beam_coll ? psi[I[
i]] : clight * (gm - psi[I[
i]]);
35 us = ( ux[ I[
i] ] * ux[ I[
i] ] +
36 uy[ I[
i] ] * uy[ I[
i] ] +
38 vx += ux[ I[
i] ] / gm;
39 vy += uy[ I[
i] ] / gm;
44 vx = vx /
N; vy = vy /
N;
45 vz = vz /
N; vs = vs /
N;
47 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 ux, T_R const *AMREX_RESTRICT uy, T_R const *AMREX_RESTRICT psi, T_R const m, T_R const clight, T_R const inv_c2, bool is_beam_coll)
Definition: ComputeTemperature.H:13
int i
Definition: MakeOpenBoundary.py:152
@ N
Definition: MultiLaser.H:92