OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Decay.h
Go to the documentation of this file.
1#ifndef OPAL_GLOBALPROCESS_DECAY_H
2#define OPAL_GLOBALPROCESS_DECAY_H
3
5
6#include "Ippl.h"
7
8#include <Kokkos_Core.hpp>
9#include <Kokkos_Random.hpp>
10
11#include <cstddef>
12#include <memory>
13
28class Decay : public GlobalProcess {
29public:
30 Decay(double restLifetimeSeconds, std::size_t containerIndex, double parentMassGeV,
31 int parentChargeSign);
32
33 ~Decay() override = default;
34
44 std::shared_ptr<ParticleContainer<double, 3>> daughterPC, double daughterMassGeV);
45
46 size_t apply(
47 ParticleContainer<double, 3>& pc, double dt, long long globalTrackStep,
48 size_t containerIdx) override;
49
59 std::size_t localDestroyNum, std::size_t oldDaughterLocal,
60 const Kokkos::View<ippl::Vector<double, 3>*>& parentR,
61 const Kokkos::View<ippl::Vector<double, 3>*>& parentP,
62 const Kokkos::View<double*>& parentDt,
63 const Kokkos::View<ippl::Vector<float, 3>*>& parentPol) = 0;
64
68 Kokkos::View<ippl::Vector<double, 3>*> R;
69 Kokkos::View<ippl::Vector<double, 3>*> P;
70 Kokkos::View<double*> dt;
71 Kokkos::View<ippl::Vector<float, 3>*> Pol;
72 };
73
80 ippl::detail::size_type markDecayedParticles(
81 ippl::detail::size_type nLocal, double dt, Kokkos::View<ippl::Vector<double, 3>*> Pview,
82 Kokkos::View<bool*> decayed);
83
91 ippl::detail::size_type nLocal, ippl::detail::size_type localDestroyNum,
92 Kokkos::View<bool*> decayed, Kokkos::View<ippl::Vector<double, 3>*> Rview,
93 Kokkos::View<ippl::Vector<double, 3>*> Pview, Kokkos::View<double*> dtView,
94 Kokkos::View<ippl::Vector<float, 3>*> PolView);
95
96protected:
98 double tau0_m;
99
101 Kokkos::Random_XorShift64_Pool<> randPool_m;
102
104 std::shared_ptr<ParticleContainer<double, 3>> daughterPC_m;
105
109
111 double daughterMassGeV_m = 0.0;
112
115
119};
120
121#endif
Abstract base class for particle decay processes.
Definition Decay.h:28
DecayedParentViews collectDecayedParents(ippl::detail::size_type nLocal, ippl::detail::size_type localDestroyNum, Kokkos::View< bool * > decayed, Kokkos::View< ippl::Vector< double, 3 > * > Rview, Kokkos::View< ippl::Vector< double, 3 > * > Pview, Kokkos::View< double * > dtView, Kokkos::View< ippl::Vector< float, 3 > * > PolView)
Gather R/P/dt of parents marked for decay into compact views.
Definition Decay.cpp:115
ippl::detail::size_type markDecayedParticles(ippl::detail::size_type nLocal, double dt, Kokkos::View< ippl::Vector< double, 3 > * > Pview, Kokkos::View< bool * > decayed)
Mark particles for decay using the relativistic exponential law.
Definition Decay.cpp:86
Kokkos::View< ippl::Vector< double, 3 > * > R
Definition Decay.h:68
double tau0_m
Mean lifetime at rest [s].
Definition Decay.h:98
Kokkos::Random_XorShift64_Pool randPool_m
Random pool for decay sampling.
Definition Decay.h:101
virtual void createDaughterParticles(std::size_t localDestroyNum, std::size_t oldDaughterLocal, const Kokkos::View< ippl::Vector< double, 3 > * > &parentR, const Kokkos::View< ippl::Vector< double, 3 > * > &parentP, const Kokkos::View< double * > &parentDt, const Kokkos::View< ippl::Vector< float, 3 > * > &parentPol)=0
Create daughter particles from collected parent data.
double parentMassGeV_m
Rest mass of the parent particle [GeV].
Definition Decay.h:114
Kokkos::View< ippl::Vector< double, 3 > * > P
Definition Decay.h:69
Kokkos::View< double * > dt
Definition Decay.h:70
size_t apply(ParticleContainer< double, 3 > &pc, double dt, long long globalTrackStep, size_t containerIdx) override
Definition Decay.cpp:33
~Decay() override=default
Kokkos::View< ippl::Vector< float, 3 > * > Pol
Definition Decay.h:71
std::shared_ptr< ParticleContainer< double, 3 > > daughterPC_m
Daughter container for decay products (nullptr = destroy-only mode).
Definition Decay.h:104
int parentChargeSign_m
Definition Decay.h:118
short allowedDaughterSpecies_m
Definition Decay.h:108
void setDaughterContainer(std::shared_ptr< ParticleContainer< double, 3 > > daughterPC, double daughterMassGeV)
Set the daughter particle container and its rest mass.
Definition Decay.cpp:161
double daughterMassGeV_m
Rest mass of the daughter particle [GeV].
Definition Decay.h:111
Container for all per-particle (and per-simulation) fields tracked during OPALX tracking.