7 #ifndef WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_
8 #define WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_
39 template <
typename T_index,
typename T_PR,
typename T_R,
typename SoaData_type>
42 T_index
const I1s, T_index
const I1e,
43 T_index
const I2s, T_index
const I2e,
44 T_index
const* AMREX_RESTRICT I1,
45 T_index
const* AMREX_RESTRICT I2,
46 SoaData_type soa_1, SoaData_type soa_2,
47 T_PR
const n1, T_PR
const n2,
48 T_PR
const T1, T_PR
const T2,
49 T_PR
const q1, T_PR
const q2,
50 T_PR
const m1, T_PR
const m2,
51 T_R
const dt, T_PR
const L, T_R
const dV,
53 bool const isSameSpecies, T_index coll_idx)
55 const T_index NI1 = I1e - I1s;
56 const T_index NI2 = I2e - I2s;
71 T_PR lmdD = T_PR(-1.0);
72 if ( L <= T_PR(0.0) ) {
79 const auto rmin =
static_cast<T_PR
>( 1.0/std::cbrt(4.0*MathConst::pi/3.0*maxn) );
84 #if (defined WARPX_DIM_RZ)
91 T_index i1 = I1s + coll_idx;
92 T_index i2 = I2s + coll_idx;
96 for (T_index k = coll_idx; k < max_N; k += min_N)
98 #if (defined WARPX_DIM_RZ)
107 T_PR
const theta = theta2[I2[i2]]-theta1[I1[i1]];
108 T_PR
const u1xbuf = u1x[I1[i1]];
109 u1x[I1[i1]] = u1xbuf*std::cos(theta) - u1y[I1[i1]]*std::sin(theta);
110 u1y[I1[i1]] = u1xbuf*std::sin(theta) + u1y[I1[i1]]*std::cos(theta);
120 const T_PR wpmax =
amrex::max(w1[ I1[i1] ],w2[ I2[i2] ]);
121 if (isSameSpecies) { n12 = wpmax*
static_cast<T_PR
>(min_N+max_N-1)/dV; }
122 else { n12 = wpmax*
static_cast<T_PR
>(min_N)/dV; }
125 u1x[ I1[i1] ], u1y[ I1[i1] ], u1z[ I1[i1] ],
126 u2x[ I2[i2] ], u2y[ I2[i2] ], u2z[ I2[i2] ],
128 q1, m1, w1[ I1[i1] ], q2, m2, w2[ I2[i2] ],
132 #if (defined WARPX_DIM_RZ)
133 T_PR
const u1xbuf_new = u1x[I1[i1]];
134 u1x[I1[i1]] = u1xbuf_new*std::cos(-theta) - u1y[I1[i1]]*std::sin(-theta);
135 u1y[I1[i1]] = u1xbuf_new*std::sin(-theta) + u1y[I1[i1]]*std::cos(-theta);
#define AMREX_GPU_HOST_DEVICE
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 const *AMREX_RESTRICT I1, T_index const *AMREX_RESTRICT I2, SoaData_type soa_1, SoaData_type soa_2, T_PR const n1, T_PR const n2, T_PR const T1, T_PR const T2, T_PR const q1, T_PR const q2, T_PR const m1, T_PR const m2, T_R const dt, T_PR const L, T_R const dV, amrex::RandomEngine const &engine, bool const isSameSpecies, T_index coll_idx)
Definition: ElasticCollisionPerez.H:41
AMREX_GPU_HOST_DEVICE AMREX_INLINE void UpdateMomentumPerezElastic(T_PR &u1x, T_PR &u1y, T_PR &u1z, T_PR &u2x, T_PR &u2y, T_PR &u2z, T_PR const n1, T_PR const n2, T_PR const n12, T_PR const q1, T_PR const m1, T_PR const w1, T_PR const q2, T_PR const m2, T_PR const w2, T_R const dt, T_PR const L, T_PR const bmax, amrex::RandomEngine const &engine)
Definition: UpdateMomentumPerezElastic.H:35
static constexpr auto ep0
vacuum permittivity: dielectric permittivity of vacuum [F/m]
Definition: constant.H:46
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
float dt
Definition: stencil.py:442
@ theta
RZ needs all three position components.
Definition: NamedComponentParticleContainer.H:36
@ uz
Definition: NamedComponentParticleContainer.H:34
@ w
weight
Definition: NamedComponentParticleContainer.H:33
@ uy
Definition: NamedComponentParticleContainer.H:34
@ ux
Definition: NamedComponentParticleContainer.H:34