1#if defined(__GPUCOMPILE__) || !defined(G_MEDIUM_GAS_H) 
    3#if !defined(__GPUCOMPILE__) && !defined(G_MEDIUM_GAS_H) 
   34                      const std::string& gas2 = 
"", 
const double f2 = 0.,
 
   35                      const std::string& gas3 = 
"", 
const double f3 = 0.,
 
   36                      const std::string& gas4 = 
"", 
const double f4 = 0.,
 
   37                      const std::string& gas5 = 
"", 
const double f5 = 0.,
 
   38                      const std::string& gas6 = 
"", 
const double f6 = 0.);
 
   41                      double& f2, std::string& gas3, 
double& f3,
 
   42                      std::string& gas4, 
double& f4, std::string& gas5,
 
   43                      double& f5, std::string& gas6, 
double& f6) 
const;
 
   46  bool LoadGasFile(
const std::string& filename, 
const bool quiet = 
false);
 
   50  bool MergeGasFile(
const std::string& filename, 
const bool replaceOld);
 
   85                               const bool quiet = 
false);
 
   97                          double& energy) 
const;
 
  100                          double& energy) 
const;
 
  103                                 const size_t ib, 
const size_t ia,
 
  107                                 const size_t ib, 
const size_t ia,
 
  110  bool IsGas()
 const override { 
return true; }
 
  127                                             const std::string& high) {
 
 
  131                                             const std::string& high) {
 
 
  166                                      const unsigned int i) 
override;
 
  176#ifndef __GPUCOMPILE__ 
  178  std::array<std::string, m_nMaxGases> 
m_gas;
 
  201  std::vector<std::vector<std::vector<double> > > 
m_eAlp0;
 
  204  std::vector<std::vector<std::vector<std::vector<double> > > > 
m_excRates;
 
  205  std::vector<std::vector<std::vector<std::vector<double> > > > 
m_ionRates;
 
  224  std::pair<unsigned int, unsigned int> 
m_extrExc = {0, 1};
 
  225  std::pair<unsigned int, unsigned int> 
m_extrIon = {0, 1};
 
  230                    const bool negative);
 
  231  bool ReadHeader(std::ifstream& gasfile, 
int& version, std::bitset<20>& gasok,
 
  232                  bool& is3d, std::vector<double>& mixture,
 
  233                  std::vector<double>& efields, std::vector<double>& bfields,
 
  234                  std::vector<double>& angles, std::vector<ExcLevel>& excLevels,
 
  235                  std::vector<IonLevel>& ionLevels);
 
  236  void ReadFooter(std::ifstream& gasfile, std::array<unsigned int, 13>& extrapH,
 
  237                  std::array<unsigned int, 13>& extrapL,
 
  238                  std::array<unsigned int, 13>& interp, 
unsigned int& thrAlp,
 
  239                  unsigned int& thrAtt, 
unsigned int& thrDis, 
double& ionDiffL,
 
  240                  double& ionDiffT, 
double& pgas, 
double& tgas);
 
  241  void ReadRecord3D(std::ifstream& gasfile, 
double& ve, 
double& vb, 
double& vx,
 
  242                    double& dl, 
double& dt, 
double& alpha, 
double& alpha0,
 
  243                    double& eta, 
double& mu, 
double& lor, 
double& dis,
 
  244                    std::array<double, 6>& dif, std::vector<double>& rexc,
 
  245                    std::vector<double>& rion, std::bitset<20> gasok);
 
  246  void ReadRecord1D(std::ifstream& gasfile, 
double& ve, 
double& vb, 
double& vx,
 
  247                    double& wv, 
double& wr, 
double& dl, 
double& dt,
 
  248                    double& alpha, 
double& alpha0, 
double& eta, 
double& riontof,
 
  249                    double& ratttof, 
double& mu, 
double& lor, 
double& dis,
 
  250                    std::array<double, 6>& dif, std::vector<double>& rexc,
 
  251                    std::vector<double>& rion, std::bitset<20> gasok);
 
  252  void InsertE(
const int ie, 
const int ne, 
const int nb, 
const int na);
 
  253  void InsertB(
const int ib, 
const int ne, 
const int nb, 
const int na);
 
  254  void InsertA(
const int ia, 
const int ne, 
const int nb, 
const int na);
 
  255  void ZeroRowE(
const int ie, 
const int nb, 
const int na);
 
  256  void ZeroRowB(
const int ib, 
const int ne, 
const int na);
 
  257  void ZeroRowA(
const int ia, 
const int ne, 
const int nb);
 
  258  bool GetMixture(
const std::vector<double>& mixture, 
const int version,
 
  259                  std::vector<std::string>& gasnames,
 
  260                  std::vector<double>& percentages) 
const;
 
  263  static bool GetGasInfo(
const std::string& gasname, 
double& a, 
double& z,
 
  264                         double& w, 
double& f);
 
  265  static std::string 
GetGasName(
const int gasnumber, 
const int version);
 
  268  static const std::vector<std::string> 
GetAliases(
const std::string& gas);
 
 
virtual bool DisablePenningTransfer(std::string gasname)
Switch the simulation of Penning transfers off for a given component.
double GetMassDensity() const override
Get the mass density [g/cm3].
double GetNumberDensity() const override
Get the number density [cm-3].
virtual double CreateGPUTransferObject(MediumGPU *&med_gpu) override
Create and initialise GPU Transfer class.
void SetExtrapolationMethodExcitationRates(const std::string &low, const std::string &high)
bool LoadGasFile(const std::string &filename, const bool quiet=false)
Read table of gas properties (transport parameters) from file.
bool AdjustTownsendCoefficient()
Adjust the Townsend coefficient using the excitation and ionisation rates stored in the gas table and...
double ScaleElectricField(const double e) const override
bool GetElectronIonisationRate(const size_t level, const size_t ie, const size_t ib, const size_t ia, double &f) const
Get an entry in the table of ionisation rates.
static std::string GetGasName(const int gasnumber, const int version)
void GetIonisationLevel(const size_t level, std::string &label, double &energy) const
Return the identifier and threshold of an ionisation level.
std::pair< unsigned int, unsigned int > m_extrIon
bool GetPenningTransfer(const std::string &gasname, double &r, double &lambda)
Retrieve the Penning transfer probability and distance for a specific component.
void SetInterpolationMethodExcitationRates(const unsigned int intrp)
void SetAtomicNumber(const double z) override
Set the effective atomic number.
bool LoadNegativeIonMobility(const std::string &filename, const bool quiet=false)
Read a table of negative ion mobilities vs. electric field from file.
double ScaleDiffusion(const double d) const override
static constexpr unsigned int m_nMaxGases
void ReadRecord1D(std::ifstream &gasfile, double &ve, double &vb, double &vx, double &wv, double &wr, double &dl, double &dt, double &alpha, double &alpha0, double &eta, double &riontof, double &ratttof, double &mu, double &lor, double &dis, std::array< double, 6 > &dif, std::vector< double > &rexc, std::vector< double > &rion, std::bitset< 20 > gasok)
std::vector< std::vector< std::vector< std::vector< double > > > > m_excRates
void InsertB(const int ib, const int ne, const int nb, const int na)
size_t GetNumberOfExcitationLevels() const
Return the number of excitation levels in the table.
virtual bool EnablePenningTransfer()
Switch on simulation of Penning transfers, using pre-implemented parameterisations of the transfer pr...
virtual bool EnablePenningTransfer(const double r, const double lambda, std::string gasname)
Switch on simulation of Penning transfers by means of transfer probabilities, for all excitations of ...
static bool GetGasInfo(const std::string &gasname, double &a, double &z, double &w, double &f)
double m_lambdaPenningGlobal
virtual void PrintGas()
Print information about the present gas mixture and available data.
void SetExtrapolationMethodIonisationRates(const std::string &low, const std::string &high)
std::vector< IonLevel > m_ionLevels
std::array< double, m_nMaxGases > m_rPenningGas
void GetComposition(std::string &gas1, double &f1, std::string &gas2, double &f2, std::string &gas3, double &f3, std::string &gas4, double &f4, std::string &gas5, double &f5, std::string &gas6, double &f6) const
Retrieve the gas mixture.
double GetAtomicNumber() const override
Get the effective atomic number.
std::array< double, m_nMaxGases > m_atNum
void GetGasBits(std::bitset< 20 > &gasok) const
std::vector< std::vector< std::vector< std::vector< double > > > > m_ionRates
void ZeroRowA(const int ia, const int ne, const int nb)
void ResetTables() override
Reset all tables of transport parameters.
bool LoadMobility(const std::string &filename, const bool quiet, const bool negative)
static const std::vector< std::string > GetAliases(const std::string &gas)
std::vector< ExcLevel > m_excLevels
void ZeroRowB(const int ib, const int ne, const int na)
bool GetElectronExcitationRate(const size_t level, const size_t ie, const size_t ib, const size_t ia, double &f) const
Get an entry in the table of excitation rates.
virtual void DisablePenningTransfer()
Switch the simulation of Penning transfers off globally.
double ScaleDiffusionTensor(const double d) const override
void ReadFooter(std::ifstream &gasfile, std::array< unsigned int, 13 > &extrapH, std::array< unsigned int, 13 > &extrapL, std::array< unsigned int, 13 > &interp, unsigned int &thrAlp, unsigned int &thrAtt, unsigned int &thrDis, double &ionDiffL, double &ionDiffT, double &pgas, double &tgas)
double m_temperatureTable
bool LoadIonMobility(const std::string &filename, const bool quiet=false)
Read a table of (positive) ion mobilities vs. electric field from file.
std::array< double, m_nMaxGases > m_atWeight
double ScaleTownsend(const double alpha) const override
void GetComponent(const unsigned int i, std::string &label, double &f) override
Get the name and fraction of a given component.
double UnScaleElectricField(const double e) const override
static int GetGasNumberGasFile(const std::string &input)
bool WriteGasFile(const std::string &filename)
Save the present table of gas properties (transport parameters) to a file.
void SetInterpolationMethodIonisationRates(const unsigned int intrp)
bool GetMixture(const std::vector< double > &mixture, const int version, std::vector< std::string > &gasnames, std::vector< double > &percentages) const
std::array< double, m_nMaxGases > m_lambdaPenningGas
std::pair< unsigned int, unsigned int > m_extrExc
bool GetPhotoAbsorptionCrossSection(const double e, double &sigma, const unsigned int i) override
bool MergeGasFile(const std::string &filename, const bool replaceOld)
Read table of gas properties from and merge with the existing dataset.
double GetAtomicWeight() const override
Get the effective atomic weight.
static void PrintGases()
Print a list of all available gases.
void ReadRecord3D(std::ifstream &gasfile, double &ve, double &vb, double &vx, double &dl, double &dt, double &alpha, double &alpha0, double &eta, double &mu, double &lor, double &dis, std::array< double, 6 > &dif, std::vector< double > &rexc, std::vector< double > &rion, std::bitset< 20 > gasok)
void SetNumberDensity(const double n) override
Set the number density [cm-3].
bool SetComposition(const std::string &gas1, const double f1=1., const std::string &gas2="", const double f2=0., const std::string &gas3="", const double f3=0., const std::string &gas4="", const double f4=0., const std::string &gas5="", const double f5=0., const std::string &gas6="", const double f6=0.)
Set the gas mixture.
virtual bool EnablePenningTransfer(const double r, const double lambda)
Switch on simulation of Penning transfers by means of transfer probabilities, for all excitation leve...
void ZeroRowE(const int ie, const int nb, const int na)
double ScaleLorentzAngle(const double lor) const override
bool IsGas() const override
Is this medium a gas?
double ScaleAttachment(const double eta) const override
void SetMassDensity(const double rho) override
Set the mass density [g/cm3].
virtual ~MediumGas()
Destructor.
std::vector< std::vector< std::vector< double > > > m_eAlp0
void GetExcitationLevel(const size_t level, std::string &label, double &energy) const
Return the identifier and energy of an excitation level.
void InsertA(const int ia, const int ne, const int nb, const int na)
void InsertE(const int ie, const int ne, const int nb, const int na)
std::array< std::string, m_nMaxGases > m_gas
bool ReadHeader(std::ifstream &gasfile, int &version, std::bitset< 20 > &gasok, bool &is3d, std::vector< double > &mixture, std::vector< double > &efields, std::vector< double > &bfields, std::vector< double > &angles, std::vector< ExcLevel > &excLevels, std::vector< IonLevel > &ionLevels)
void SetAtomicWeight(const double a) override
Set the effective atomic weight.
size_t GetNumberOfIonisationLevels() const
Return the number of ionisation levels in the table.
static std::string GetGasName(std::string input)
std::array< double, m_nMaxGases > m_fraction
void SetExtrapolationMethod(const std::string &low, const std::string &high, std::pair< unsigned int, unsigned int > &extr, const std::string &fcn)