7 #ifndef WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_ 8 #define WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_ 14 #include <AMReX_Random.H> 37 template <
typename T_index,
typename T_R>
38 AMREX_GPU_HOST_DEVICE AMREX_INLINE
40 T_index
const I1s, T_index
const I1e,
41 T_index
const I2s, T_index
const I2e,
42 T_index *I1, T_index *I2,
43 T_R *u1x, T_R *u1y, T_R *u1z,
44 T_R *u2x, T_R *u2y, T_R *u2z,
45 T_R
const *w1, T_R
const *w2,
46 T_R
const q1, T_R
const q2,
47 T_R
const m1, T_R
const m2,
48 T_R
const T1, T_R
const T2,
49 T_R
const dt, T_R
const L, T_R
const dV,
50 amrex::RandomEngine
const& engine)
58 if ( T1 <= T_R(0.0) && L <= T_R(0.0) )
63 if ( T2 <= T_R(0.0) && L <= T_R(0.0) )
73 for (
int i1=I1s; i1<static_cast<int>(I1e); ++i1) { n1 += w1[ I1[i1] ]; }
74 for (
int i2=I2s; i2<static_cast<int>(I2e); ++i2) { n2 += w2[ I2[i2] ]; }
75 n1 = n1 / dV; n2 = n2 / dV;
77 int i1 = I1s;
int i2 = I2s;
78 for (
int k = 0; k < amrex::max(NI1,NI2); ++k)
80 n12 += amrex::min( w1[ I1[i1] ], w2[ I2[i2] ] );
81 ++i1;
if ( i1 == static_cast<int>(I1e) ) { i1 = I1s; }
82 ++i2;
if ( i2 == static_cast<int>(I2e) ) { i2 = I2s; }
89 lmdD = T_R(1.0)/std::sqrt( n1*q1*q1/(T1t*PhysConst::ep0) +
90 n2*q2*q2/(T2t*PhysConst::ep0) );
91 T_R rmin = std::pow( T_R(4.0) * MathConst::pi / T_R(3.0) *
92 amrex::max(n1,n2), T_R(-1.0/3.0) );
93 lmdD = amrex::max(lmdD, rmin);
97 int i1 = I1s;
int i2 = I2s;
98 for (
int k = 0; k < amrex::max(NI1,NI2); ++k)
101 u1x[ I1[i1] ], u1y[ I1[i1] ], u1z[ I1[i1] ],
102 u2x[ I2[i2] ], u2y[ I2[i2] ], u2z[ I2[i2] ],
104 q1, m1, w1[ I1[i1] ], q2, m2, w2[ I2[i2] ],
107 ++i1;
if ( i1 == static_cast<int>(I1e) ) { i1 = I1s; }
108 ++i2;
if ( i2 == static_cast<int>(I2e) ) { i2 = I2s; }
114 #endif // WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_
AMREX_GPU_HOST_DEVICE AMREX_INLINE void UpdateMomentumPerezElastic(T_R &u1x, T_R &u1y, T_R &u1z, T_R &u2x, T_R &u2y, T_R &u2z, T_R const n1, T_R const n2, T_R const n12, T_R const q1, T_R const m1, T_R const w1, T_R const q2, T_R const m2, T_R const w2, T_R const dt, T_R const L, T_R const lmdD, amrex::RandomEngine const &engine)
Definition: UpdateMomentumPerezElastic.H:30
AMREX_GPU_HOST_DEVICE AMREX_INLINE void ElasticCollisionPerez(T_index const I1s, T_index const I1e, T_index const I2s, T_index const I2e, T_index *I1, T_index *I2, T_R *u1x, T_R *u1y, T_R *u1z, T_R *u2x, T_R *u2y, T_R *u2z, T_R const *w1, T_R const *w2, T_R const q1, T_R const q2, T_R const m1, T_R const m2, T_R const T1, T_R const T2, T_R const dt, T_R const L, T_R const dV, amrex::RandomEngine const &engine)
Prepare information for and call UpdateMomentumPerezElastic().
Definition: ElasticCollisionPerez.H:39
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