WarpX
Public Member Functions | Private Types | Private Attributes | List of all members
ParticleCreationFunc Class Reference

This functor creates particles produced from a binary collision and sets their initial properties (position, momentum, weight). More...

#include <ParticleCreationFunc.H>

Public Member Functions

 ParticleCreationFunc ()=default
 Default constructor of the ParticleCreationFunc class. More...
 
 ParticleCreationFunc (const std::string &collision_name, MultiParticleContainer const *mypc)
 Constructor of the ParticleCreationFunc class. More...
 
AMREX_INLINE amrex::Vector< intoperator() (const index_type &n_total_pairs, const SoaData_type &soa_1, const SoaData_type &soa_2, const amrex::Vector< WarpXParticleContainer * > &pc_products, ParticleTileType **AMREX_RESTRICT tile_products, const amrex::ParticleReal &m1, const amrex::ParticleReal &m2, const amrex::Vector< amrex::ParticleReal > &products_mass, const index_type *AMREX_RESTRICT p_mask, const amrex::Vector< index_type > &products_np, const SmartCopy *AMREX_RESTRICT copy_species1, const SmartCopy *AMREX_RESTRICT copy_species2, const index_type *AMREX_RESTRICT p_pair_indices_1, const index_type *AMREX_RESTRICT p_pair_indices_2, const amrex::ParticleReal *AMREX_RESTRICT p_pair_reaction_weight) const
 operator() of the ParticleCreationFunc class. It creates new particles from binary collisions. One product particle is created at the position of each parent particle that collided, allowing for exact charge conservation. For example, in the nuclear reaction "proton + boron -> 3 alpha", we actually create 6 new alpha particles, 3 at the position of of the proton and 3 at the position of the boron. This function also sets the initial weight of the produced particles and subtracts it from the parent particles. If the weight of a parent particle becomes 0, then that particle is deleted. Finally, this function sets the initial momentum of the product particles, by calling a function specific to the considered binary collision. More...
 

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 = typename WarpXParticleContainer::ParticleTileType::ParticleTileDataType
 

Private Attributes

int m_num_product_species
 
amrex::Gpu::DeviceVector< intm_num_products_device
 
amrex::Gpu::HostVector< intm_num_products_host
 
CollisionType m_collision_type
 

Detailed Description

This functor creates particles produced from a binary collision and sets their initial properties (position, momentum, weight).

Member Typedef Documentation

◆ index_type

◆ ParticleBins

◆ ParticleTileDataType

using ParticleCreationFunc::ParticleTileDataType = typename ParticleTileType::ParticleTileDataType
private

◆ ParticleTileType

◆ ParticleType

◆ SoaData_type

Constructor & Destructor Documentation

◆ ParticleCreationFunc() [1/2]

ParticleCreationFunc::ParticleCreationFunc ( )
default

Default constructor of the ParticleCreationFunc class.

◆ ParticleCreationFunc() [2/2]

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

Constructor of the ParticleCreationFunc class.

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

Member Function Documentation

◆ operator()()

AMREX_INLINE amrex::Vector<int> ParticleCreationFunc::operator() ( const index_type n_total_pairs,
const SoaData_type soa_1,
const SoaData_type soa_2,
const amrex::Vector< WarpXParticleContainer * > &  pc_products,
ParticleTileType **AMREX_RESTRICT  tile_products,
const amrex::ParticleReal &  m1,
const amrex::ParticleReal &  m2,
const amrex::Vector< amrex::ParticleReal > &  products_mass,
const index_type *AMREX_RESTRICT  p_mask,
const amrex::Vector< index_type > &  products_np,
const SmartCopy *AMREX_RESTRICT  copy_species1,
const SmartCopy *AMREX_RESTRICT  copy_species2,
const index_type *AMREX_RESTRICT  p_pair_indices_1,
const index_type *AMREX_RESTRICT  p_pair_indices_2,
const amrex::ParticleReal *AMREX_RESTRICT  p_pair_reaction_weight 
) const
inline

operator() of the ParticleCreationFunc class. It creates new particles from binary collisions. One product particle is created at the position of each parent particle that collided, allowing for exact charge conservation. For example, in the nuclear reaction "proton + boron -> 3 alpha", we actually create 6 new alpha particles, 3 at the position of of the proton and 3 at the position of the boron. This function also sets the initial weight of the produced particles and subtracts it from the parent particles. If the weight of a parent particle becomes 0, then that particle is deleted. Finally, this function sets the initial momentum of the product particles, by calling a function specific to the considered binary collision.

Parameters
[in]n_total_pairshow many binary collisions have been performed in this tile
[in,out]soa_1struct of array data of the first colliding particle species
[in,out]soa_2struct of array data of the second colliding particle species
[out]tile_productsarray containing tile data of the product particles.
[in]m1mass of the first colliding particle species
[in]m2mass of the second colliding particle species
[in]products_massarray storing the mass of product particles
[in]p_maska mask that is 1 if binary collision has resulted in particle creation event, 0 otherwise.
[in]products_nparray storing the number of existing product particles in that tile
[in]copy_species1array of functors used to copy data from the first colliding particle species to the product particles and to default initialize product particle quantities.
[in]copy_species2array of functors used to copy data from the second colliding particle species to the product particles and to default initialize product particle quantities.
[in]p_pair_indices_1array that stores the indices of the particles of the first colliding species that were used in the binary collisions (i.e. particle with index p_pair_indices_1[i] took part in collision i)
[in]p_pair_indices_2array that stores the indices of the particles of the second colliding species that were used in the binary collisions (i.e. particle with index p_pair_indices_2[i] took part in collision i)
[in]p_pair_reaction_weightarray that stores the weight of the binary collisions. This weight is removed from the parent particles and given to the product particles.

Member Data Documentation

◆ m_collision_type

CollisionType ParticleCreationFunc::m_collision_type
private

◆ m_num_product_species

int ParticleCreationFunc::m_num_product_species
private

◆ m_num_products_device

amrex::Gpu::DeviceVector<int> ParticleCreationFunc::m_num_products_device
private

◆ m_num_products_host

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

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