1#ifndef G_MEDIUM_MAGBOLTZ_9
2#define G_MEDIUM_MAGBOLTZ_9
40 m_useAnisotropic = on;
62 std::string gasname)
override;
88 double& dx,
double& dy,
double& dz,
89 std::vector<std::pair<int, double> >& secondaries,
90 int& ndxc,
int& band)
override;
93 return m_dxcProducts.size();
96 int& type,
double& energy)
const override;
100 double& ctheta,
int& nsec,
double& esec)
override;
108 unsigned int& nIonising,
109 unsigned int& nAttachment,
110 unsigned int& nInelastic,
111 unsigned int& nExcitation,
112 unsigned int& nSuperelastic)
const;
116 bool GetLevel(
const unsigned int i,
int& ngas,
int& type, std::string& descr,
128 unsigned int& nIonising,
129 unsigned int& nInelastic)
const;
159 void RunMagboltz(
const double e,
const double b,
const double btheta,
160 const int ncoll,
bool verbose,
double& vx,
double& vy,
161 double& vz,
double& dl,
double& dt,
double& alpha,
162 double& eta,
double& lor,
double& vxerr,
double& vyerr,
163 double& vzerr,
double& dlerr,
double& dterr,
164 double& alphaerr,
double& etaerr,
double& lorerr,
165 double& alphatof, std::array<double, 6>& difftens);
171 const bool verbose =
true);
174 static constexpr int nEnergyStepsLog = 1000;
175 static constexpr int nEnergyStepsGamma = 5000;
176 static constexpr int nCsTypes = 7;
177 static constexpr int nCsTypesGamma = 4;
179 static const int DxcTypeRad;
180 static const int DxcTypeCollIon;
181 static const int DxcTypeCollNonIon;
187 bool m_useGasMotion =
false;
189 bool m_autoEnergyLimit =
true;
195 double m_eHigh, m_eHighLog;
197 bool m_useAutoAdjust =
true;
200 bool m_useCsOutput =
false;
202 unsigned int m_nTerms = 0;
204 std::array<double, m_nMaxGases> m_rgas;
206 std::array<double, Magboltz::nMaxLevels> m_wOpalBeaty;
209 std::array<std::array<double, 5>,
m_nMaxGases> m_parGreenSawada;
210 std::array<bool, m_nMaxGases> m_hasGreenSawada;
212 bool m_useOpalBeaty =
true;
214 bool m_useGreenSawada =
false;
217 std::array<double, Magboltz::nMaxLevels> m_energyLoss;
219 std::array<int, Magboltz::nMaxLevels> m_csType;
222 std::array<double, Magboltz::nMaxLevels> m_yFluorescence;
224 std::array<unsigned int, Magboltz::nMaxLevels> m_nAuger1;
225 std::array<unsigned int, Magboltz::nMaxLevels> m_nAuger2;
227 std::array<double, Magboltz::nMaxLevels> m_eAuger1;
228 std::array<double, Magboltz::nMaxLevels> m_eAuger2;
229 std::array<unsigned int, Magboltz::nMaxLevels> m_nFluorescence;
230 std::array<double, Magboltz::nMaxLevels> m_eFluorescence;
233 bool m_useAnisotropic =
true;
234 std::vector<std::vector<double> > m_scatPar;
235 std::vector<std::vector<double> > m_scatCut;
236 std::vector<std::vector<double> > m_scatParLog;
237 std::vector<std::vector<double> > m_scatCutLog;
238 std::array<int, Magboltz::nMaxLevels> m_scatModel;
241 std::vector<std::string> m_description;
244 std::vector<double> m_cfTot;
245 std::vector<double> m_cfTotLog;
247 double m_cfNull = 0.;
249 std::vector<std::vector<double> > m_cf;
250 std::vector<std::vector<double> > m_cfLog;
259 std::array<unsigned int, nCsTypes> m_nCollisions;
261 std::vector<unsigned int> m_nCollisionsDetailed;
265 std::array<double, Magboltz::nMaxLevels> m_rPenning;
267 std::array<double, Magboltz::nMaxLevels> m_lambdaPenning;
269 unsigned int m_nPenning = 0;
273 bool m_useDeexcitation =
false;
276 bool m_useRadTrap =
true;
278 struct Deexcitation {
288 std::vector<double> p;
290 std::vector<int>
final;
292 std::vector<int> type;
306 std::vector<Deexcitation> m_deexcitations;
308 std::array<int, Magboltz::nMaxLevels> m_iDeexcitation;
321 std::vector<dxcProd> m_dxcProducts;
324 std::array<double, m_nMaxGases> m_ionPot;
326 double m_minIonPot = -1.;
329 std::array<double, m_nMaxGases> m_scaleExc;
332 double m_eFinalGamma, m_eStepGamma;
334 unsigned int m_nPhotonTerms = 0;
336 std::vector<double> m_cfTotGamma;
338 std::vector<std::vector<double> > m_cfGamma;
339 std::vector<int> csTypeGamma;
345 std::array<unsigned int, nCsTypesGamma> m_nPhotonCollisions;
347 int GetGasNumberMagboltz(
const std::string& input)
const;
348 bool Mixer(
const bool verbose =
false);
349 void SetupGreenSawada();
350 void SetScatteringParameters(
const int model,
const double parIn,
double& cut,
351 double& parOut)
const;
352 void ComputeAngularCut(
const double parIn,
double& cut,
double& parOut)
const;
354 void GetExcitationIonisationLevels();
356 void ComputeDeexcitationTable(
const bool verbose);
357 void AddPenningDeexcitation(Deexcitation& dxc,
const double rate,
358 const double pPenning) {
359 dxc.p.push_back(rate * pPenning);
360 dxc.p.push_back(rate * (1. - pPenning));
361 dxc.type.push_back(DxcTypeCollIon);
362 dxc.type.push_back(DxcTypeCollNonIon);
364 double RateConstantWK(
const double energy,
const double osc,
365 const double pacs,
const int igas1,
366 const int igas2)
const;
367 double RateConstantHardSphere(
const double r1,
const double r2,
368 const int igas1,
const int igas2)
const;
369 void ComputeDeexcitationInternal(
int iLevel,
int& fLevel);
370 bool ComputePhotonCollisionTable(
const bool verbose);
Base class for gas media.
static constexpr unsigned int m_nMaxGases
bool EnablePenningTransfer(const double r, const double lambda) override
void SetSplittingFunctionGreenSawada()
Sample the secondary electron energy according to the Green-Sawada model.
void EnableAnisotropicScattering(const bool on=true)
Switch on/off anisotropic scattering (enabled by default)
unsigned int GetNumberOfLevels()
Get the number of cross-section terms.
void SetExcitationScaling(const double r, std::string gasname)
Multiply all excitation cross-sections by a uniform scaling factor.
bool GetLevel(const unsigned int i, int &ngas, int &type, std::string &descr, double &e)
Get detailed information about a given cross-section term i.
double GetElectronNullCollisionRate(const int band) override
Get the overall null-collision rate [ns-1].
virtual ~MediumMagboltz()
Destructor.
void ResetCollisionCounters()
Reset the collision counters.
void EnableRadiationTrapping()
Switch on discrete photoabsorption levels.
unsigned int GetNumberOfElectronCollisions() const
Get the total number of electron collisions.
double GetPhotonCollisionRate(const double e) override
void EnableAutoEnergyLimit(const bool on=true)
void RunMagboltz(const double e, const double b, const double btheta, const int ncoll, bool verbose, double &vx, double &vy, double &vz, double &dl, double &dt, double &alpha, double &eta, double &lor, double &vxerr, double &vyerr, double &vzerr, double &dlerr, double &dterr, double &alphaerr, double &etaerr, double &lorerr, double &alphatof, std::array< double, 6 > &difftens)
void ComputeDeexcitation(int iLevel, int &fLevel)
void SetSplittingFunctionOpalBeaty()
Sample the secondary electron energy according to the Opal-Beaty model.
void GenerateGasTable(const int numCollisions=10, const bool verbose=true)
double GetMaxElectronEnergy() const
Get the highest electron energy in the table of scattering rates.
bool GetDeexcitationProduct(const unsigned int i, double &t, double &s, int &type, double &energy) const override
void SetSplittingFunctionFlat()
Sample the secondary electron energy from a flat distribution.
MediumMagboltz()
Constructor.
unsigned int GetNumberOfPenningTransfers() const
Get the number of Penning transfers that occured since the last reset.
double GetMaxPhotonEnergy() const
Get the highest photon energy in the table of scattering rates.
unsigned int GetNumberOfPhotonCollisions() const
Get the total number of photon collisions.
bool SetMaxPhotonEnergy(const double e)
void DisablePenningTransfer() override
Switch the simulation of Penning transfers off globally.
bool GetPhotonCollision(const double e, int &type, int &level, double &e1, double &ctheta, int &nsec, double &esec) override
unsigned int GetNumberOfDeexcitationProducts() const override
void DisableDeexcitation()
Switch off (microscopic) de-excitation handling.
void EnableCrossSectionOutput(const bool on=true)
Write the gas cross-section table to a file during the initialisation.
void DisableRadiationTrapping()
Switch off discrete photoabsorption levels.
bool GetElectronCollision(const double e, int &type, int &level, double &e1, double &dx, double &dy, double &dz, std::vector< std::pair< int, double > > &secondaries, int &ndxc, int &band) override
Sample the collision type.
bool Initialise(const bool verbose=false)
double GetElectronCollisionRate(const double e, const int band) override
Get the (real) collision rate [ns-1] at a given electron energy e [eV].
bool SetMaxElectronEnergy(const double e)
void EnableThermalMotion(const bool on=true)
void PrintGas() override
Print information about the present gas mixture and available data.
void EnableDeexcitation()
Switch on (microscopic) de-excitation handling.
void EnableEnergyRangeAdjustment(const bool on)