Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GasDef.h
Go to the documentation of this file.
1#ifndef GAS_DEF_H
2#define GAS_DEF_H
3
6
7namespace Heed {
8
9/// Definition of a gas.
10/// Characteristic feature of the Gas class is that it consists of molecules.
11/// Additional feature is that the density can be calculated by temperature
12/// and pressure. But this is not always the case, and therefore it is not a
13/// characteristic feature. Then with only one this feature (consisting of
14/// molecules) we can also describe other substances as a gas,
15/// for example, liquids.
16///
17/// Only the basic information: the data of matter, plus the pressure.
18/// Note that the class AtomMixDef indirectly appears twice.
19/// It is the base class of matter and molecule. Therefore it is
20/// indirectly the base class of GasDef, and the base class
21/// of its external elements molech.
22///
23/// As the base class of GasDef, the class AtomMixDef determines only the
24/// relative weights of atoms of different sorts. Also note that
25/// the atoms of the same sorts participated in different molecules,
26/// included in AtomMixDef as different atoms.
27///
28/// As the base class of MoleculeDef, the class AtomMixDef determines
29/// also only the relative weights of atoms of different sorts in the given
30/// molecule, since the class AtomMixDef doesn't have space to encapsulate
31/// the number of atoms. But the latter number is also necessary: consider H2,
32/// the relative weight of H is 1, and nothing says that there are two atoms.
33/// Therefore in the class MoleculeDef there is additional array, which
34/// gives the numbers of atoms of each sort, and also there is another
35/// parameter giving the total number of atoms in molecule.
36///
37/// 1998-2004 I. Smirnov
38
39class GasDef : public MatterDef {
40 double pressureh = 0.;
41 /// Number of different molecules
42 long qmolech = 0;
43 std::vector<const MoleculeDef*> molech;
44 std::vector<double> weight_quan_molech; // sum is 1
45 std::vector<double> weight_mass_molech; // sum is 1
46 public:
47 double pressure() const { return pressureh; }
48 long qmolec() const { return qmolech; }
49 const std::vector<const MoleculeDef*>& molec() const {
50 return molech;
51 }
52 const MoleculeDef* molec(long n) const { return molech[n]; }
53 const std::vector<double>& weight_quan_molec() const {
54 return weight_quan_molech;
55 }
56 const std::vector<double>& weight_mass_molec() const {
57 return weight_mass_molech;
58 }
59 double weight_quan_molec(const long n) const {
60 return weight_quan_molech[n];
61 }
62 double weight_mass_molec(const long n) const {
63 return weight_mass_molech[n];
64 }
65 /// Mean charge of molecules in this gas
66 double Z_mean_molec() const;
67
68 /// Default constructor.
69 GasDef() = default;
70 /// Constructor from arbitrary number of molecules (ideal gas).
71 GasDef(const std::string& fname, const std::string& fnotation, long fqmolec,
72 const std::vector<std::string>& fmolec_not,
73 const std::vector<double>& fweight_quan_molec, double fpressure,
74 double ftemperature, double fdensity = -1.0);
75 /// Constructor from arbitrary number of molecules (using Van der Waals
76 /// correction for calculating the density).
77 /// s1 and s2 are to distinguish the constructor.
78 GasDef(const std::string& fname, const std::string& fnotation, long fqmolec,
79 const std::vector<std::string>& fmolec_not,
80 const std::vector<double>& fweight_volume_molec, double fpressure,
81 double ftemperature, int s1, int s2);
82 /// Constructor from a single molecule (ideal gas).
83 GasDef(const std::string& fname, const std::string& fnotation,
84 const std::string& fmolec_not, double fpressure, double ftemperature,
85 double fdensity = -1.0);
86
87 /// Constructor from a single molecule (Van der Waals gas).
88 GasDef(const std::string& fname, const std::string& fnotation,
89 const std::string& fmolec_not, double fpressure, double ftemperature,
90 int s1, int s2);
91 /// Constructor from two molecules (ideal gas).
92 GasDef(const std::string& fname, const std::string& fnotation,
93 const std::string& fmolec_not1, double fweight_quan_molec1,
94 const std::string& fmolec_not2, double fweight_quan_molec2,
95 double fpressure, double ftemperature, double fdensity = -1.0);
96 /// Constructor from two molecules (Van der Waals gas).
97 GasDef(const std::string& fname, const std::string& fnotation,
98 const std::string& fmolec_not1, double fweight_volume_molec1,
99 const std::string& fmolec_not2, double fweight_volume_molec2,
100 double fpressure, double ftemperature, int s1, int s2);
101 /// Constructor from three molecules (ideal gas).
102 GasDef(const std::string& fname, const std::string& fnotation,
103 const std::string& fmolec_not1, double fweight_quan_molec1,
104 const std::string& fmolec_not2, double fweight_quan_molec2,
105 const std::string& fmolec_not3, double fweight_quan_molec3,
106 double fpressure, double ftemperature, double fdensity = -1.0);
107 /// Constructor from three molecules (Van der Waals gas).
108 GasDef(const std::string& fname, const std::string& fnotation,
109 const std::string& fmolec_not1, double fweight_volume_molec1,
110 const std::string& fmolec_not2, double fweight_volume_molec2,
111 const std::string& fmolec_not3, double fweight_volume_molec3,
112 double fpressure, double ftemperature, int s1, int s2);
113 /// Constructor from another gas at different pressure and temperature.
114 GasDef(const std::string& fname, const std::string& fnotation,
115 const GasDef& gd, double fpressure, double ftemperature,
116 double fdensity = -1.0);
117
118 void print(std::ostream& file, int l = 0) const;
119 GasDef* copy() const { return new GasDef(*this); }
120};
121std::ostream& operator<<(std::ostream& file, const GasDef& f);
122
123}
124
125#endif
const std::vector< const MoleculeDef * > & molec() const
Definition GasDef.h:49
double Z_mean_molec() const
Mean charge of molecules in this gas.
Definition GasDef.cpp:237
GasDef * copy() const
Definition GasDef.h:119
void print(std::ostream &file, int l=0) const
Definition GasDef.cpp:246
const MoleculeDef * molec(long n) const
Definition GasDef.h:52
long qmolec() const
Definition GasDef.h:48
const std::vector< double > & weight_quan_molec() const
Definition GasDef.h:53
double weight_quan_molec(const long n) const
Definition GasDef.h:59
const std::vector< double > & weight_mass_molec() const
Definition GasDef.h:56
GasDef()=default
Default constructor.
double pressure() const
Definition GasDef.h:47
double weight_mass_molec(const long n) const
Definition GasDef.h:62
MatterDef()=default
Definition BGMesh.cpp:6
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition BGMesh.cpp:37