OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
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_HH
24 #define BEAMSTRIPPINGPHYSICS_HH
25 
26 #include "AbsBeamline/Component.h"
28 #include "Algorithms/Vektor.h"
30 
31 #include <gsl/gsl_math.h>
32 #include <gsl/gsl_rng.h>
33 
34 template <class T, unsigned Dim>
35 class PartBunchBase;
36 
37 class LossDataSink;
38 class Inform;
39 class Cyclotron;
40 class Vacuum;
41 
43 
44 public:
45 
46  BeamStrippingPhysics(const std::string& name, ElementBase* element);
48 
49  void setCyclotron(Cyclotron* cycl) { cycl_m = cycl; };
50 
51  virtual void apply(PartBunchBase<double, 3>* bunch,
52  const std::pair<Vector_t, double>& boundingSphere);
53 
54  virtual const std::string getType() const;
55  virtual void print(Inform& msg);
56  virtual bool stillActive();
57 
58  virtual double getTime();
59  virtual std::string getName();
60  virtual size_t getParticlesInMat();
61  virtual unsigned getRediffused();
62  virtual unsigned int getNumEntered();
63 
64  inline void doPhysics(PartBunchBase<double, 3>* bunch);
65 
66 private:
67 
68  void computeCrossSection(PartBunchBase<double, 3>* bunch, size_t& i, double energy);
69 
70  double computeCrossSectionNakai(double energy, double energyThreshold, int& i);
71 
72  double computeCrossSectionTabata(double energy, double energyThreshold,
73  double a1, double a2, double a3,
74  double a4, double a5, double a6);
75 
76  double computeCrossSectionChebyshev(double energy, double energyMin, double energyMax);
77 
78  double computeCrossSectionBohr(double energy, int zTarget, double massInAmu);
79 
80  bool evalGasStripping(double& deltas);
81  bool evalLorentzStripping(double& gamma, double& eField);
82 
83  void getSecondaryParticles(PartBunchBase<double, 3>* bunch, size_t& i, bool pdead_LS);
84  void transformToProton(PartBunchBase<double, 3>* bunch, size_t& i);
85  void transformToHydrogen(PartBunchBase<double, 3>* bunch, size_t& i);
86  void transformToHminus(PartBunchBase<double, 3>* bunch, size_t& i);
87  void transformToH3plus(PartBunchBase<double, 3>* bunch, size_t& i);
88 
90  Vector_t& /*P*/,
91  const double /*deltat*/,
92  bool /*includeFluctuations*/) const {
93  return false;
94  }
95 
98 
99  gsl_rng* r_m;
100 
101  double T_m; // s
102  double dT_m; // s
103  double mass_m;
104  double charge_m;
105  double pressure_m;
106 
107  std::unique_ptr<LossDataSink> lossDs_m;
108 
110  double nCSA;
111  double nCSB;
112  double nCSC;
113  double nCSTotal;
114 
119 
120  static const double csCoefSingle_Hminus[3][9];
121  static const double csCoefDouble_Hminus[3][9];
122  static const double csCoefSingle_Hplus[3][9];
123  static const double csCoefDouble_Hplus[3][9];
124  static const double csCoefSingleLoss_H[3][9];
125  static const double csCoefSingleCapt_H[3][9];
126 
127  static const double csCoefSingle_Hplus_Tabata[10];
128  static const double csCoefHminusProduction_H_Tabata[13];
129  static const double csCoefProtonProduction_H_Tabata[9];
130  static const double csCoefProtonProduction_H2plus_Tabata[11];
131  static const double csCoefH3plusProduction_H2plus_Tabata[7];
132 
133  static const double csCoefSingle_Hminus_Chebyshev[11];
134  static const double csCoefDouble_Hminus_Chebyshev[11];
135  static const double csCoefSingle_Hplus_Chebyshev[11];
136  static const double csCoefDouble_Hplus_Chebyshev[11];
139  static const double energyRangeH2plusinH2[2];
140  static double a_m[9];
141  static double b_m[3][9];
142 };
143 
144 inline
146  return T_m;
147 }
148 
149 inline
151  return (element_ref_m->getName() + "_" + name_m);
152 }
153 
154 inline
156  return totalPartsInMat_m;
157 }
158 
159 inline
161  return rediffusedStat_m;
162 }
163 
164 inline
166  return bunchToMatStat_m;
167 }
168 
169 inline
170 const std::string BeamStrippingPhysics::getType() const {
171  return "BeamStrippingPhysics";
172 }
173 
174 #endif //BEAMSTRIPPINGPHYSICS_HH
const std::string name
virtual const std::string & getName() const
Get element name.
Definition: Vacuum.h:67
static const double csCoefProtonProduction_H_Tabata[9]
double computeCrossSectionNakai(double energy, double energyThreshold, int &i)
virtual size_t getParticlesInMat()
static const double csCoefProtonProduction_H2plus_Tabata[11]
double nCSA
macroscopic cross sections
static const double csCoefProtonProduction_H2plus_Chebyshev[11]
static const double csCoefDouble_Hminus[3][9]
virtual std::string getName()
static const double csCoefSingle_Hminus[3][9]
bool computeEnergyLoss(PartBunchBase< double, 3 > *, Vector_t &, const double, bool) const
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 transformToHydrogen(PartBunchBase< double, 3 > *bunch, size_t &i)
virtual unsigned getRediffused()
void doPhysics(PartBunchBase< double, 3 > *bunch)
static const double csCoefHminusProduction_H_Tabata[13]
double computeCrossSectionBohr(double energy, int zTarget, double massInAmu)
static const double csCoefSingleCapt_H[3][9]
static const double csCoefDouble_Hplus_Chebyshev[11]
virtual void apply(PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere)
static const double csCoefSingle_Hplus[3][9]
void transformToH3plus(PartBunchBase< double, 3 > *bunch, size_t &i)
void transformToHminus(PartBunchBase< double, 3 > *bunch, size_t &i)
virtual unsigned int getNumEntered()
static const double csCoefSingleLoss_H[3][9]
static const double csCoefSingle_Hplus_Chebyshev[11]
virtual void print(Inform &msg)
void computeCrossSection(PartBunchBase< double, 3 > *bunch, size_t &i, double energy)
virtual const std::string getType() const
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)
void transformToProton(PartBunchBase< double, 3 > *bunch, size_t &i)
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]
Definition: Inform.h:42