OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
BeamStrippingPhysics.h
Go to the documentation of this file.
1//
2// Class BeamStrippingPhysics
3// Defines the physical processes of residual gas
4// interactions and Lorentz stripping
5//
6// Copyright (c) 2018 - 2021, Pedro Calvo, CIEMAT, Spain
7// All rights reserved
8//
9// Implemented as part of the PhD thesis
10// "Optimizing the radioisotope production of the novel AMIT
11// superconducting weak focusing cyclotron"
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23#ifndef BEAMSTRIPPINGPHYSICS_H
24#define BEAMSTRIPPINGPHYSICS_H
25
28#include "Algorithms/Vektor.h"
30
31#include <gsl/gsl_math.h>
32#include <gsl/gsl_rng.h>
33
34#include <memory>
35#include <string>
36#include <utility>
37
38template <class T, unsigned Dim>
39class PartBunchBase;
40
41class LossDataSink;
42class Inform;
43class Cyclotron;
44class Vacuum;
45
47
48public:
49 BeamStrippingPhysics(const std::string& name, ElementBase* element);
51
52 void setCyclotron(Cyclotron* cycl) { cycl_m = cycl; };
53
54 virtual void apply(PartBunchBase<double, 3>* bunch,
55 const std::pair<Vector_t, double>& boundingSphere) override;
56
57 virtual const std::string getType() const override;
58 virtual void print(Inform& msg) override;
59 virtual bool stillActive() override;
60
61 virtual double getTime() override;
62 virtual std::string getName() override;
63 virtual size_t getParticlesInMat() override;
64 virtual unsigned getRediffused() override;
65 virtual unsigned int getNumEntered() override;
66
68
69private:
70
71 void computeCrossSection(double energy);
72
73 double computeCrossSectionNakai(double energy, double energyThreshold, int& i);
74
75 double computeCrossSectionTabata(double energy, double energyThreshold,
76 double a1, double a2, double a3,
77 double a4, double a5, double a6);
78
79 double computeCrossSectionChebyshev(double energy, double energyMin, double energyMax);
80
81 double computeCrossSectionBohr(double energy, int zTarget, double massInAmu);
82
83 bool evalGasStripping(double& deltas);
84 bool evalLorentzStripping(double& gamma, double& eField);
85
86 void getSecondaryParticles(PartBunchBase<double, 3>* bunch, size_t& i, bool pdead_LS);
87
89
91 Vector_t& /*P*/,
92 const double /*deltat*/,
93 bool /*includeFluctuations*/) const override {
94 return false;
95 }
96
97 void gatherStatistics();
98
100
103
104 gsl_rng* r_m;
105
106 double T_m; // s
107 double dT_m; // s
108 double mass_m; // GeV/c2
109 double pressure_m; // mbar
110 double temperature_m; // K
111
112 std::unique_ptr<LossDataSink> lossDs_m;
113
115 double nCSA_m;
116 double nCSB_m;
117 double nCSC_m;
119
124
125 static const double csCoefSingle_Hminus[3][9];
126 static const double csCoefDouble_Hminus[3][9];
127 static const double csCoefSingle_Hplus[3][9];
128 static const double csCoefDouble_Hplus[3][9];
129 static const double csCoefSingleLoss_H[3][9];
130 static const double csCoefSingleCapt_H[3][9];
131
132 static const double csCoefSingle_Hplus_Tabata[10];
133 static const double csCoefHminusProduction_H_Tabata[13];
134 static const double csCoefProtonProduction_H_Tabata[9];
137
138 static const double csCoefSingle_Hminus_Chebyshev[11];
139 static const double csCoefDouble_Hminus_Chebyshev[11];
140 static const double csCoefSingle_Hplus_Chebyshev[11];
141 static const double csCoefDouble_Hplus_Chebyshev[11];
144 static const double energyRangeH2plusinH2[2];
145 static double a_m[9];
146 static double b_m[3][9];
147};
148
149
150inline
152 return T_m;
153}
154
155inline
157 return (element_ref_m->getName() + "_" + name_m);
158}
159
160inline
162 return totalPartsInMat_m;
163}
164
165inline
167 return rediffusedStat_m;
168}
169
170inline
172 return bunchToMatStat_m;
173}
174
175inline
177 return totalPartsInMat_m != 0;
178}
179
180inline
181const std::string BeamStrippingPhysics::getType() const {
182 return "BeamStrippingPhysics";
183}
184
185#endif //BEAMSTRIPPINGPHYSICS_H
ParticleType
const std::string name
boost::function< boost::tuple< double, bool >(arguments_t)> type
Definition: function.hpp:21
virtual const std::string & getName() const
Get element name.
Definition: Vacuum.h:61
static const double csCoefProtonProduction_H_Tabata[9]
double computeCrossSectionNakai(double energy, double energyThreshold, int &i)
static const double csCoefProtonProduction_H2plus_Tabata[11]
static const double csCoefProtonProduction_H2plus_Chebyshev[11]
static const double csCoefDouble_Hminus[3][9]
static const double csCoefSingle_Hminus[3][9]
virtual void apply(PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere) override
void getSecondaryParticles(PartBunchBase< double, 3 > *bunch, size_t &i, bool pdead_LS)
double computeCrossSectionChebyshev(double energy, double energyMin, double energyMax)
static const double csCoefSingle_Hminus_Chebyshev[11]
static const double energyRangeH2plusinH2[2]
static const double csCoefSingle_Hplus_Tabata[10]
void doPhysics(PartBunchBase< double, 3 > *bunch)
bool computeEnergyLoss(PartBunchBase< double, 3 > *, Vector_t &, const double, bool) const override
static const double csCoefHminusProduction_H_Tabata[13]
virtual size_t getParticlesInMat() override
double computeCrossSectionBohr(double energy, int zTarget, double massInAmu)
virtual void print(Inform &msg) override
static const double csCoefSingleCapt_H[3][9]
virtual unsigned int getNumEntered() override
double nCSA_m
macroscopic cross sections
static const double csCoefDouble_Hplus_Chebyshev[11]
void computeCrossSection(double energy)
virtual double getTime() override
virtual std::string getName() override
static const double csCoefSingle_Hplus[3][9]
void transformToSecondary(PartBunchBase< double, 3 > *bunch, size_t &i, ParticleType type)
static const double csCoefSingleLoss_H[3][9]
static const double csCoefSingle_Hplus_Chebyshev[11]
virtual bool stillActive() override
virtual const std::string getType() const override
void setCyclotron(Cyclotron *cycl)
BeamStrippingPhysics(const std::string &name, ElementBase *element)
double computeCrossSectionTabata(double energy, double energyThreshold, double a1, double a2, double a3, double a4, double a5, double a6)
bool evalLorentzStripping(double &gamma, double &eField)
std::unique_ptr< LossDataSink > lossDs_m
bool evalGasStripping(double &deltas)
static const double csCoefHydrogenProduction_H2plus_Chebyshev[11]
static const double csCoefH3plusProduction_H2plus_Tabata[7]
static double b_m[3][9]
static const double csCoefDouble_Hminus_Chebyshev[11]
static const double csCoefDouble_Hplus[3][9]
virtual unsigned getRediffused() override
Definition: Inform.h:42