WarpX
Loading...
Searching...
No Matches
SplitAndScatterFunc Class Reference

This class defines an operator to create product particles from DSMC collisions and sets the particle properties (position, momentum, weight). More...

#include <SplitAndScatterFunc.H>

Public Member Functions

 SplitAndScatterFunc ()=default
 Default constructor of the SplitAndScatterFunc class.
 
 SplitAndScatterFunc (const std::string &collision_name, MultiParticleContainer const *mypc)
 Constructor of the SplitAndScatterFunc class.
 
AMREX_INLINE amrex::Vector< int > operator() (const index_type &n_total_pairs, ParticleTileType &ptile0, ParticleTileType &ptile1, const amrex::Vector< WarpXParticleContainer * > &pc_products, ParticleTileType **AMREX_RESTRICT tile_products, const amrex::ParticleReal m0, const amrex::ParticleReal m1, const amrex::Vector< amrex::ParticleReal > &, const index_type *AMREX_RESTRICT mask, amrex::Vector< index_type > &products_np, const SmartCopy *AMREX_RESTRICT copy_species0, const SmartCopy *AMREX_RESTRICT copy_species1, const index_type *AMREX_RESTRICT p_pair_indices_0, const index_type *AMREX_RESTRICT p_pair_indices_1, const amrex::ParticleReal *AMREX_RESTRICT p_pair_reaction_weight, const amrex::ParticleReal *) const
 Function that performs binary collision between macroparticle pairs (referred to as "reactant species" in the code below)
 

Private Types

using ParticleType = typename WarpXParticleContainer::ParticleType
 
using ParticleTileType = typename WarpXParticleContainer::ParticleTileType
 
using ParticleTileDataType = typename ParticleTileType::ParticleTileDataType
 
using ParticleBins = amrex::DenseBins<ParticleTileDataType>
 
using index_type = typename ParticleBins::index_type
 
using SoaData_type = WarpXParticleContainer::ParticleTileType::ParticleTileDataType
 

Private Attributes

int m_num_product_species
 
amrex::ParticleReal m_reaction_energy = 0.0
 
amrex::Gpu::HostVector< int > m_num_products_host
 
CollisionType m_collision_type
 

Detailed Description

This class defines an operator to create product particles from DSMC collisions and sets the particle properties (position, momentum, weight).

Member Typedef Documentation

◆ index_type

◆ ParticleBins

◆ ParticleTileDataType

using SplitAndScatterFunc::ParticleTileDataType = typename ParticleTileType::ParticleTileDataType
private

◆ ParticleTileType

◆ ParticleType

◆ SoaData_type

using SplitAndScatterFunc::SoaData_type = WarpXParticleContainer::ParticleTileType::ParticleTileDataType
private

Constructor & Destructor Documentation

◆ SplitAndScatterFunc() [1/2]

SplitAndScatterFunc::SplitAndScatterFunc ( )
default

Default constructor of the SplitAndScatterFunc class.

◆ SplitAndScatterFunc() [2/2]

SplitAndScatterFunc::SplitAndScatterFunc ( const std::string & collision_name,
MultiParticleContainer const * mypc )

Constructor of the SplitAndScatterFunc class.

Parameters
[in]collision_namethe name of the collision
[in]mypcpointer to the MultiParticleContainer

Member Function Documentation

◆ operator()()

AMREX_INLINE amrex::Vector< int > SplitAndScatterFunc::operator() ( const index_type & n_total_pairs,
ParticleTileType & ptile0,
ParticleTileType & ptile1,
const amrex::Vector< WarpXParticleContainer * > & pc_products,
ParticleTileType **AMREX_RESTRICT tile_products,
const amrex::ParticleReal m0,
const amrex::ParticleReal m1,
const amrex::Vector< amrex::ParticleReal > & ,
const index_type *AMREX_RESTRICT mask,
amrex::Vector< index_type > & products_np,
const SmartCopy *AMREX_RESTRICT copy_species0,
const SmartCopy *AMREX_RESTRICT copy_species1,
const index_type *AMREX_RESTRICT p_pair_indices_0,
const index_type *AMREX_RESTRICT p_pair_indices_1,
const amrex::ParticleReal *AMREX_RESTRICT p_pair_reaction_weight,
const amrex::ParticleReal *  ) const
inline

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_pairstotal number of colliding particle pairs (across all cells) handled by this kernel.
[in,out]ptile0particle tile for the first reactant species (slot 0); weights may be reduced by the collision.
[in,out]ptile1particle tile for the other reactant species (slot 1); weights may be reduced by the collision.
[in]pc_productspointers to all product species containers (size m_num_product_species); used for mass queries and runtime attribute initialization.
[in,out]tile_productsarray of pointers to product particle tiles (size m_num_product_species); new particles are appended to each tile.
[in]m0rest mass of the first reactant species (slot 0).
[in]m1rest mass of the other reactant species (slot 1).
[in]maskper-pair collision type: 0 = no collision, otherwise cast of ScatteringProcessType to int.
[in,out]products_npmacroparticle count of each product tile; updated in this kernel to reflect the number of new macroparticles added in each species.
[in]copy_species0array 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_species1array 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_0per-pair index of the first reactant species (slot 0) particle.
[in]p_pair_indices_1per-pair index of the other reactant species (slot 1) particle.
[in]p_pair_reaction_weightper-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.

Member Data Documentation

◆ m_collision_type

CollisionType SplitAndScatterFunc::m_collision_type
private

◆ m_num_product_species

int SplitAndScatterFunc::m_num_product_species
private

◆ m_num_products_host

amrex::Gpu::HostVector<int> SplitAndScatterFunc::m_num_products_host
private

◆ m_reaction_energy

amrex::ParticleReal SplitAndScatterFunc::m_reaction_energy = 0.0
private

The documentation for this class was generated from the following files: