Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::GasDef Class Reference

#include <GasDef.h>

+ Inheritance diagram for Heed::GasDef:

Public Member Functions

double pressure () const
 
long qmolec () const
 
const std::vector< MoleculeDef * > & molec () const
 
MoleculeDefmolec (long n) const
 
const std::vector< double > & weight_quan_molec () const
 
const std::vector< double > & weight_mass_molec () const
 
double weight_quan_molec (const long n) const
 
double weight_mass_molec (const long n) const
 
double Z_mean_molec () const
 Mean charge of molecules in this gas.
 
 GasDef ()
 
 GasDef (const std::string &fname, const std::string &fnotation, long fqmolec, const std::vector< std::string > &fmolec_not, const std::vector< double > &fweight_quan_molec, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const std::string &fname, const std::string &fnotation, long fqmolec, const std::vector< std::string > &fmolec_not, const std::vector< double > &fweight_volume_molec, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not1, double fweight_quan_molec1, const std::string &fmolec_not2, double fweight_quan_molec2, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not1, double fweight_volume_molec1, const std::string &fmolec_not2, double fweight_volume_molec2, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not1, double fweight_quan_molec1, const std::string &fmolec_not2, double fweight_quan_molec2, const std::string &fmolec_not3, double fweight_quan_molec3, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const std::string &fname, const std::string &fnotation, const std::string &fmolec_not1, double fweight_volume_molec1, const std::string &fmolec_not2, double fweight_volume_molec2, const std::string &fmolec_not3, double fweight_volume_molec3, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const std::string &fname, const std::string &fnotation, const GasDef &gd, double fpressure, double ftemperature, double fdensity=-1.0)
 
void print (std::ostream &file, int l=0) const
 
GasDefcopy () const
 
- Public Member Functions inherited from Heed::MatterDef
 MatterDef ()
 
 MatterDef (const std::string &fname, const std::string &fnotation, long fqatom, const std::vector< std::string > &fatom_not, const std::vector< double > &fweight_quan, double fdensity, double ftemperature)
 
 MatterDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not, double fdensity, double ftemperature)
 
 MatterDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, double fdensity, double ftemperature)
 
 MatterDef (const std::string &fname, const std::string &fnotation, const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3, double fdensity, double ftemperature)
 
virtual ~MatterDef ()
 
const std::string & name () const
 
const std::string & notation () const
 
double density () const
 
double temperature () const
 
double I_eff () const
 
void verify ()
 Check that there is no matter with the same name in the container.
 
void print (std::ostream &file, int l) const
 
MatterDefcopy () const
 
- Public Member Functions inherited from Heed::AtomMixDef
 AtomMixDef ()=default
 Default constructor.
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< double > &fweight_quan)
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< long > &fweight_quan)
 
 AtomMixDef (const std::string &fatom_not)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3, const std::string &fatom_not4, double fweight_quan4)
 
void print (std::ostream &file, int l) const
 
long qatom () const
 
const std::vector< AtomDef * > & atom () const
 
AtomDefatom (long n) const
 
const std::vector< double > & weight_quan () const
 
const std::vector< double > & weight_mass () const
 
double weight_quan (long n) const
 
double weight_mass (long n) const
 
double Z_mean () const
 
double A_mean () const
 
double inv_A_mean () const
 
double mean_ratio_Z_to_A () const
 
double NumberOfElectronsInGram () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Heed::MatterDef
static void printall (std::ostream &file)
 
static void verify (const std::string &fname, const std::string &fnotation)
 
static std::list< MatterDef * > & get_logbook ()
 
static const std::list< MatterDef * > & get_const_logbook ()
 
static MatterDefget_MatterDef (const std::string &fnotation)
 

Detailed Description

Definition of a gas. haracteristic feature of the Gas class is that it consists of molecules. Additional feature is that the density can be calculated by temperature and pressure. But this is not always, and therefore it is not characteristic feature. Then with only one this feature (consisting of molecules) we can describe as gas also some other substances, for example, the liquids.

Only the basic information: the data of matter, plus the pressure. Note that the class AtomMixDef undirectly appear twice. It is the base class of matter and molecula. Therefore it is indirectly the base class of GasDef, and the base class of its external elements molech.

As the base class of GasDef, the class AtomMixDef determines only the relative weights of atoms of different sorts. Also note that the atoms of the same sorts participated in different molecules, included in AtomMixDef as different atoms.

As the base class of MoleculeDef, the class AtomMixDef determines also only the relative weights of atoms of different sorts in the given molecule, since the class AtomMixDef doesn't have space to encapsulate the number of atoms. But the latter number is also necessary: consider H2, the relative weight of H is 1, and nothing says that there are two atoms. Therefore in the class MoleculeDef there is additional array, which gives the numbers of atoms of each sort, and also there is another parameter giving the total number of atoms in molecule.

1998-2004 I. Smirnov

Definition at line 38 of file GasDef.h.

Constructor & Destructor Documentation

◆ GasDef() [1/10]

Heed::GasDef::GasDef ( )

Definition at line 11 of file GasDef.cpp.

11: MatterDef() {}

Referenced by copy(), and GasDef().

◆ GasDef() [2/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
long  fqmolec,
const std::vector< std::string > &  fmolec_not,
const std::vector< double > &  fweight_quan_molec,
double  fpressure,
double  ftemperature,
double  fdensity = -1.0 
)

Definition at line 13 of file GasDef.cpp.

17 : pressureh(fpressure),
18 qmolech(fqmolec),
19 molech(fqmolec, nullptr),
20 weight_quan_molech(fqmolec),
21 weight_mass_molech(fqmolec) {
22 mfunname("GasDef::GasDef(...many molecules...)");
23
24 // Finding pointers to all molec. by notations
25 for (long k = 0; k < fqmolec; ++k) {
26 MoleculeDef* amd = MoleculeDef::get_MoleculeDef(fmolec_not[k]);
27 check_econd11a(amd, == NULL,
28 "No molecule with such notation: " << fmolec_not[k] << '\n',
29 mcerr)
30 if (!amd) {
31 mcerr << "cannot find molecule with notation " << fmolec_not[k]
32 << "\nIn particular, check the sequence of initialization\n";
34 }
35 molech[k] = amd;
36 }
37 double s = 0.0;
38 for (long n = 0; n < fqmolec; ++n) {
39 weight_quan_molech[n] = fweight_quan_molec[n];
40 check_econd11(weight_quan_molech[n], <= 0, mcerr);
41 s += weight_quan_molech[n];
42 }
43 check_econd11(s, <= 0, mcerr);
44 if (s != 1.0) {
45 for (long n = 0; n < fqmolec; ++n) {
46 weight_quan_molech[n] /= s;
47 }
48 }
49 for (long n = 0; n < fqmolec; ++n) {
50 weight_mass_molech[n] = weight_quan_molech[n] * molech[n]->A_total();
51 }
52 s = 0.0;
53 for (long n = 0; n < fqmolec; ++n) {
54 s += weight_mass_molech[n];
55 }
56 check_econd11(s, <= 0, mcerr);
57 if (s != 1.0) {
58 for (long n = 0; n < fqmolec; ++n) {
59 weight_mass_molech[n] /= s;
60 }
61 }
62
63 long qat = 0;
64 std::vector<std::string> fatom_not(1000);
65 std::vector<double> weight_qa(1000, 0.0);
66 for (long k = 0; k < fqmolec; ++k) {
67 for (long n = 0; n < molech[k]->qatom(); ++n) {
68 /*
69 This is originally designed to avoid duplication of an atom
70 in the list if it presents twice in different moleculas.
71 But it appears that the same atom in different moleculas
72 can have different features related to position and sensitivity
73 of external shell. In particular it affects on ionization.
74 This difference can be used in inherited and
75 related classes. Therefore such reduction of the list can produce
76 problems. Therefore this is excluded by commenting off this passage,
77 and also by commenting off mark2.
78 for (i = 0; i < qat; i++) {
79 if (molech[k]->atom(n)->notation() == fatom_not[i]) {
80 weight_qa[i] += fweight_quan_molec[k] * molech[k]->weight_quan(n);
81 goto mark2;
82 }
83 }
84 */
85 fatom_not[qat] = molech[k]->atom(n)->notation();
86 weight_qa[qat] = fweight_quan_molec[k] * molech[k]->qatom_ps(n);
87 // mcout << "qat=" << qat << " fatom_not[qat]=" << fatom_not[qat]
88 // << " weight_qa[qat]=" << weight_qa[qat] << '\n';
89 ++qat;
90 // mark2: ;
91 }
92 }
93 if (fdensity < 0.0) {
94 double sw = 0.0;
95 double sa = 0.0;
96 for (long n = 0; n < qmolech; ++n) {
97 sa += weight_quan_molech[n] * molech[n]->A_total();
98 sw += weight_quan_molech[n];
99 }
100 const double rydberg = k_Boltzmann * Avogadro;
101 fdensity = sa * fpressure / (rydberg * ftemperature * sw);
102 }
103 verify(fname, fnotation);
104 {
105 *((MatterDef*)this) = MatterDef(fname, fnotation, qat, fatom_not, weight_qa,
106 fdensity, ftemperature);
107 }
108}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
#define spexit(stream)
Definition: FunNameStack.h:256
#define mfunname(string)
Definition: FunNameStack.h:45
void verify()
Check that there is no matter with the same name in the container.
Definition: MatterDef.cpp:77
static MoleculeDef * get_MoleculeDef(const std::string &fnotation)
#define mcerr
Definition: prstream.h:128

◆ GasDef() [3/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
long  fqmolec,
const std::vector< std::string > &  fmolec_not,
const std::vector< double > &  fweight_volume_molec,
double  fpressure,
double  ftemperature,
int  s1,
int  s2 
)

Definition at line 110 of file GasDef.cpp.

113 {
114 // s1 and s2 are to distinguish the constructor
115 mfunname("GasDef::GasDef(...many molecules... Waals)");
116 std::vector<MoleculeDef*> amolec(fqmolec);
117 for (long n = 0; n < fqmolec; ++n) {
118 amolec[n] = MoleculeDef::get_MoleculeDef(fmolec_not[n]);
119 check_econd11a(amolec[n], == NULL,
120 "No molecule with such notation: " << fmolec_not[n] << '\n',
121 mcerr)
122 // Van der Waals correction currently not used.
123 // VanDerWaals* aw = amolec[n]->vdw().get();
124 }
125 // first normalize volumes to total unity
126 std::vector<double> fw(fqmolec);
127 // normalized volume weights
128 double s = 0.0;
129 for (long n = 0; n < fqmolec; ++n) {
130 s += fweight_volume_molec[n];
131 }
132 check_econd11(s, <= 0, mcerr);
133 for (long n = 0; n < fqmolec; ++n) {
134 fw[n] = fweight_volume_molec[n] / s;
135 }
136
137 // calculate number of molecules or moles and mass of each component
138 std::vector<double> fweight_quan_molec(fqmolec);
139 double mass_t = 0.0;
140 constexpr double rydberg = k_Boltzmann * Avogadro;
141 for (long n = 0; n < fqmolec; ++n) {
142 VanDerWaals* aw = amolec[n]->vdw().get();
143 if (!aw) {
144 // ideal gas case
145 fweight_quan_molec[n] = fw[n] * fpressure / (rydberg * ftemperature);
146 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
147 // Iprint2n(mcout, fweight_quan_molec[n], ms/gram);
148 mass_t += ms;
149 } else {
150 // van der Waals gas case
151 int s_not_single;
152 double number_of_moles =
153 fw[n] * 1.0 / aw->volume_of_mole(ftemperature, // relative to T_k
154 fpressure, s_not_single);
155 check_econd11(s_not_single, == 1, mcerr);
156 fweight_quan_molec[n] = number_of_moles;
157 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
158 // Iprint2n(mcout, fweight_quan_molec[n], ms/gram);
159 mass_t += ms;
160 }
161 }
162 double density_t = mass_t;
163 *this = GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
164 fpressure, ftemperature, density_t);
165}

◆ GasDef() [4/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not,
double  fpressure,
double  ftemperature,
double  fdensity = -1.0 
)

Definition at line 167 of file GasDef.cpp.

169 {
170 mfunname("GasDef::GasDef(...1 molecule...)");
171 std::vector<std::string> fmolec_noth(1, fmolec_not);
172 std::vector<double> fweight_quan_molec(1, 1.0);
173 {
174 *this = GasDef(fname, fnotation, 1, fmolec_noth, fweight_quan_molec,
175 fpressure, ftemperature, fdensity);
176 }
177}

◆ GasDef() [5/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not,
double  fpressure,
double  ftemperature,
int  s1,
int  s2 
)

Definition at line 179 of file GasDef.cpp.

181 {
182 mfunname("GasDef::GasDef(...1 molecule...)");
183 std::vector<std::string> fmolec_noth(1, fmolec_not);
184 std::vector<double> fweight_volume_molec(1, 1.0);
185 {
186 *this = GasDef(fname, fnotation, 1, fmolec_noth, fweight_volume_molec,
187 fpressure, ftemperature, s1, s2);
188 }
189}

◆ GasDef() [6/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not1,
double  fweight_quan_molec1,
const std::string &  fmolec_not2,
double  fweight_quan_molec2,
double  fpressure,
double  ftemperature,
double  fdensity = -1.0 
)

Definition at line 191 of file GasDef.cpp.

194 {
195 mfunname("GasDef::GasDef(...2 molecules...)");
196 std::vector<std::string> fmolec_noth(2);
197 std::vector<double> fweight_quan_molec(2, 0.0);
198 fmolec_noth[0] = fmolec_not1;
199 fmolec_noth[1] = fmolec_not2;
200 fweight_quan_molec[0] = fweight_quan_molec1;
201 fweight_quan_molec[1] = fweight_quan_molec2;
202 {
203 *this = GasDef(fname, fnotation, 2, fmolec_noth, fweight_quan_molec,
204 fpressure, ftemperature, fdensity);
205 }
206}

◆ GasDef() [7/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not1,
double  fweight_volume_molec1,
const std::string &  fmolec_not2,
double  fweight_volume_molec2,
double  fpressure,
double  ftemperature,
int  s1,
int  s2 
)

Definition at line 208 of file GasDef.cpp.

211 {
212 mfunname("GasDef::GasDef(...2 molecules...)");
213 std::vector<std::string> fmolec_noth(2);
214 std::vector<double> fweight_volume_molec(2, 0.0);
215 fmolec_noth[0] = fmolec_not1;
216 fmolec_noth[1] = fmolec_not2;
217 fweight_volume_molec[0] = fweight_volume_molec1;
218 fweight_volume_molec[1] = fweight_volume_molec2;
219 {
220 *this = GasDef(fname, fnotation, 2, fmolec_noth, fweight_volume_molec,
221 fpressure, ftemperature, s1, s2);
222 }
223}

◆ GasDef() [8/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not1,
double  fweight_quan_molec1,
const std::string &  fmolec_not2,
double  fweight_quan_molec2,
const std::string &  fmolec_not3,
double  fweight_quan_molec3,
double  fpressure,
double  ftemperature,
double  fdensity = -1.0 
)

Definition at line 225 of file GasDef.cpp.

229 {
230 mfunname("GasDef::GasDef(...3 molecules...)");
231 std::vector<std::string> fmolec_noth(3);
232 std::vector<double> fweight_quan_molec(3, 0.0);
233 fmolec_noth[0] = fmolec_not1;
234 fmolec_noth[1] = fmolec_not2;
235 fmolec_noth[2] = fmolec_not3;
236 fweight_quan_molec[0] = fweight_quan_molec1;
237 fweight_quan_molec[1] = fweight_quan_molec2;
238 fweight_quan_molec[2] = fweight_quan_molec3;
239 {
240 *this = GasDef(fname, fnotation, 3, fmolec_noth, fweight_quan_molec,
241 fpressure, ftemperature, fdensity);
242 }
243}

◆ GasDef() [9/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const std::string &  fmolec_not1,
double  fweight_volume_molec1,
const std::string &  fmolec_not2,
double  fweight_volume_molec2,
const std::string &  fmolec_not3,
double  fweight_volume_molec3,
double  fpressure,
double  ftemperature,
int  s1,
int  s2 
)

Definition at line 245 of file GasDef.cpp.

249 {
250 mfunname("GasDef::GasDef(...3 molecules...)");
251 std::vector<std::string> fmolec_noth(3);
252 std::vector<double> fweight_volume_molec(3, 0.0);
253 fmolec_noth[0] = fmolec_not1;
254 fmolec_noth[1] = fmolec_not2;
255 fmolec_noth[2] = fmolec_not3;
256 fweight_volume_molec[0] = fweight_volume_molec1;
257 fweight_volume_molec[1] = fweight_volume_molec2;
258 fweight_volume_molec[2] = fweight_volume_molec3;
259 {
260 *this = GasDef(fname, fnotation, 3, fmolec_noth, fweight_volume_molec,
261 fpressure, ftemperature, s1, s2);
262 }
263}

◆ GasDef() [10/10]

Heed::GasDef::GasDef ( const std::string &  fname,
const std::string &  fnotation,
const GasDef gd,
double  fpressure,
double  ftemperature,
double  fdensity = -1.0 
)

Definition at line 265 of file GasDef.cpp.

267 {
268 mfunname("GasDef::GasDef( another GasDef with different pres)");
269 long fqmolec = gd.qmolec();
270 std::vector<std::string> fmolec_not(fqmolec);
271 std::vector<double> fweight_quan_molec(fqmolec);
272 for (long n = 0; n < fqmolec; ++n) {
273 fmolec_not[n] = gd.molec(n)->notation();
274 fweight_quan_molec[n] = gd.weight_quan_molec(n);
275 }
276 *this = GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
277 fpressure, ftemperature, fdensity);
278}

Member Function Documentation

◆ copy()

GasDef * Heed::GasDef::copy ( ) const
inline

Definition at line 116 of file GasDef.h.

116{ return new GasDef(*this); }

◆ molec() [1/2]

const std::vector< MoleculeDef * > & Heed::GasDef::molec ( ) const
inline

Definition at line 48 of file GasDef.h.

48 {
49 return molech;
50 }

Referenced by GasDef(), Heed::HeedMatterDef::HeedMatterDef(), and Heed::operator<<().

◆ molec() [2/2]

MoleculeDef * Heed::GasDef::molec ( long  n) const
inline

Definition at line 51 of file GasDef.h.

51{ return molech[n]; }

◆ pressure()

double Heed::GasDef::pressure ( ) const
inline

Definition at line 46 of file GasDef.h.

46{ return pressureh; }

Referenced by Heed::operator<<().

◆ print()

void Heed::GasDef::print ( std::ostream &  file,
int  l = 0 
) const

Definition at line 290 of file GasDef.cpp.

290 {
291 if (l > 0) file << (*this);
292}

◆ qmolec()

long Heed::GasDef::qmolec ( ) const
inline

Definition at line 47 of file GasDef.h.

47{ return qmolech; }

Referenced by GasDef(), Heed::HeedMatterDef::HeedMatterDef(), and Heed::operator<<().

◆ weight_mass_molec() [1/2]

const std::vector< double > & Heed::GasDef::weight_mass_molec ( ) const
inline

Definition at line 55 of file GasDef.h.

55 {
56 return weight_mass_molech;
57 }

Referenced by Heed::operator<<().

◆ weight_mass_molec() [2/2]

double Heed::GasDef::weight_mass_molec ( const long  n) const
inline

Definition at line 61 of file GasDef.h.

61 {
62 return weight_mass_molech[n];
63 }

◆ weight_quan_molec() [1/2]

const std::vector< double > & Heed::GasDef::weight_quan_molec ( ) const
inline

Definition at line 52 of file GasDef.h.

52 {
53 return weight_quan_molech;
54 }

Referenced by GasDef(), Heed::HeedMatterDef::HeedMatterDef(), and Heed::operator<<().

◆ weight_quan_molec() [2/2]

double Heed::GasDef::weight_quan_molec ( const long  n) const
inline

Definition at line 58 of file GasDef.h.

58 {
59 return weight_quan_molech[n];
60 }

◆ Z_mean_molec()

double Heed::GasDef::Z_mean_molec ( void  ) const

Mean charge of molecules in this gas.

Definition at line 281 of file GasDef.cpp.

281 {
282 mfunname("double GasDef::Z_mean_molec(void) const ");
283 double s = 0.0;
284 for (long n = 0; n < qmolech; ++n) {
285 s += molech[n]->Z_total() * weight_quan_molech[n];
286 }
287 return s;
288}

Referenced by Heed::operator<<().


The documentation for this class was generated from the following files: