Function that performs binary collision between macroparticle pairs (referred to as "reactant species" in the code below)
During a collision, new macroparticles can be created in different species, which are arranged in slots 0 through m_num_product_species-1.
Slots 0 and 1 always correspond to the first and second reactant species, respectively. This is because, physically, some of the reacting particles can still be present after the collision (e.g., if the collision is elastic scattering), but with modified properties (e.g., modified momentum). In the code, this is handled by creating new macroparticles in the reactant species, whose weight is subtracted from the reacting macroparticles. (This approach is used in order to handle the fact that the two reactant macroparticles may have different weights.)
For collisions that, physically, produce new particles (e.g., ionization, charge exchange, two-product reaction), slots 2 and 3 hold the true product species.
- Parameters
-
| [in] | n_total_pairs | total number of colliding particle pairs (across all cells) handled by this kernel. |
| [in,out] | ptile0 | particle tile for the first reactant species (slot 0); weights may be reduced by the collision. |
| [in,out] | ptile1 | particle tile for the other reactant species (slot 1); weights may be reduced by the collision. |
| [in] | pc_products | pointers to all product species containers (size m_num_product_species); used for mass queries and runtime attribute initialization. |
| [in,out] | tile_products | array of pointers to product particle tiles (size m_num_product_species); new particles are appended to each tile. |
| [in] | m0 | rest mass of the first reactant species (slot 0). |
| [in] | m1 | rest mass of the other reactant species (slot 1). |
| [in] | mask | per-pair collision type: 0 = no collision, otherwise cast of ScatteringProcessType to int. |
| [in,out] | products_np | macroparticle count of each product tile; updated in this kernel to reflect the number of new macroparticles added in each species. |
| [in] | copy_species0 | array of SmartCopy functors (size m_num_product_species); copy_species0[k] copies a particle FROM the first reactant species (slot 0) INTO product slot k. |
| [in] | copy_species1 | array of SmartCopy functors (size m_num_product_species); copy_species1[k] copies a particle FROM the other reactant species (slot 1) INTO product slot k. |
| [in] | p_pair_indices_0 | per-pair index of the first reactant species (slot 0) particle. |
| [in] | p_pair_indices_1 | per-pair index of the other reactant species (slot 1) particle. |
| [in] | p_pair_reaction_weight | per-pair weight assigned to newly created product macroparticles; also the amount subtracted from the colliding macroparticle weights. |
- Returns
- num_added number of particles added to each product slot.