@@ -54,21 +54,17 @@ namespace kernel {
5454 npart_t domain_idx,
5555 const SimulationParams& params,
5656 random_number_pool_t & random_pool)
57- : emitted_photon_weight { params.get <real_t >(
57+ : emitted_photon_weight { params.template get <real_t >(
5858 " radiation.emission.compton.photon_weight" ) }
59- , emitted_photon_min_energy { params.get <real_t >(
59+ , emitted_photon_min_energy { params.template get <real_t >(
6060 " radiation.emission.compton.photon_energy_min" ) }
6161 , nominal_probability { math::abs (species_charge / species_mass) *
62- params.get <real_t >(" scales.omegaB0" ) *
63- static_cast <real_t >(0.1 ) * dt *
64- SQR (params.get <real_t >(
65- " radiation.emission.compton.gamma_qed" ) /
66- params.get <real_t >(
67- " radiation.drag.compton.gamma_rad" )) /
68- emitted_photon_weight }
69- , nominal_photon_energy { species_mass /
70- SQR (params.get <real_t >(
71- " radiation.emission.compton.gamma_qed" )) }
62+ params.template get <real_t >(
63+ " radiation.emission.compton.nominal_"
64+ " probability" ) }
65+ , nominal_photon_energy { species_mass * params.template get <real_t >(
66+ " radiation.emission.compton."
67+ " nominal_photon_energy" ) }
7268 , should_drag { static_cast <bool >(radiative_drag_flags &
7369 RadiativeDrag::COMPTON) }
7470 , photon_i1 { photon_species.i1 }
@@ -98,8 +94,15 @@ namespace kernel {
9894
9995 /* *
10096 *
101- * @brief Determine whether a photon is emitted and compute its energy and
102- * the recoil on the emitting particle
97+ * @brief Determine whether a photon is emitted, the drag is applied,
98+ * and compute its energy and the recoil on the emitting particle
99+ *
100+ * @param x_Cd Position of the particle (code)
101+ * @param x_Ph Position of the particle (physical)
102+ * @param u_Ph Velocity of the particle (physical)
103+ * @param ep Interpolated electric field at the particle position (physical)
104+ * @param bp Interpolated magnetic field at the particle position (physical)
105+ * @param delta_u_Ph Output parameter for the recoil on the emitting particle (physical units)
103106 *
104107 * @note
105108 *
@@ -112,18 +115,18 @@ namespace kernel {
112115 * e_gamma = (gamma / gamma_QED)^2 * (m / m0)
113116 *
114117 * drag force [in units of m c]:
115- * du / dt = - photon_weight * p_gamma * e_gamma * u_hat
118+ * du / dt = - photon_weight * p_gamma * e_gamma * u_hat / beta
116119 *
117120 * @returns Pair of booleans to indicate whether a particle should be emitted
118121 * and whether the emitting particle should experience a recoil (i.e. radiative drag)
119122 *
120123 */
121- Inline auto shouldEmit (const coord_t <M::PrtlDim>& xp_Cd ,
122- const coord_t <M::PrtlDim>& xp_Ph ,
123- const vec_t <Dim::_3D>& u_Ph,
124- const vec_t <Dim::_3D>& ep ,
125- const vec_t <Dim::_3D>& bp ,
126- vec_t <Dim::_3D>& delta_u_Ph,
124+ Inline auto shouldEmit (const coord_t <M::PrtlDim>&,
125+ const coord_t <M::PrtlDim>&,
126+ const vec_t <Dim::_3D>& u_Ph,
127+ const vec_t <Dim::_3D>&,
128+ const vec_t <Dim::_3D>&,
129+ vec_t <Dim::_3D>& delta_u_Ph,
127130 Payload& payload) const -> Kokkos::pair<bool, bool> {
128131 const auto u_sqr = NORM_SQR (u_Ph[0 ], u_Ph[1 ], u_Ph[2 ]);
129132 const auto gamma_sqr = ONE + u_sqr;
@@ -132,8 +135,8 @@ namespace kernel {
132135
133136 payload.photon_energy = gamma_sqr * nominal_photon_energy;
134137
135- const auto delta_u = -probability * payload.photon_energy /
136- math::sqrt (u_sqr);
138+ const auto delta_u = -emitted_photon_weight * payload.photon_energy /
139+ ( math::sqrt (u_sqr) * beta );
137140
138141 delta_u_Ph[0 ] = delta_u * u_Ph[0 ];
139142 delta_u_Ph[1 ] = delta_u * u_Ph[1 ];
@@ -142,11 +145,10 @@ namespace kernel {
142145 auto rand_gen = random_pool.get_state ();
143146 const auto should_emit = Random<real_t >(rand_gen) < probability;
144147 random_pool.free_state (rand_gen);
145- Kokkos::printf (" probability: %e\n " , probability);
146148
147149 return Kokkos::make_pair (
148150 should_emit and (payload.photon_energy >= emitted_photon_min_energy),
149- should_drag);
151+ should_drag and should_emit );
150152 }
151153
152154 Inline void emit (const tuple_t <int , M::Dim>& xi_Cd,
0 commit comments