Garfield++ v1r0
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 (void) const
 
long qmolec (void) const
 
const DynLinArr< PassivePtr< MoleculeDef > > & molec (void) const
 
PassivePtr< MoleculeDefmolec (long n) const
 
const DynLinArr< double > & weight_quan_molec (void) const
 
const DynLinArr< double > & weight_mass_molec (void) const
 
double weight_quan_molec (long n) const
 
double weight_mass_molec (long n) const
 
double Z_mean_molec (void) const
 
 GasDef (void)
 
 GasDef (const String &fname, const String &fnotation, long fqmolec, const DynLinArr< String > &fmolec_not, const DynLinArr< double > &fweight_quan_molec, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const String &fname, const String &fnotation, long fqmolec, const DynLinArr< String > &fmolec_not, const DynLinArr< double > &fweight_volume_molec, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not1, double fweight_quan_molec1, const String &fmolec_not2, double fweight_quan_molec2, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not1, double fweight_volume_molec1, const String &fmolec_not2, double fweight_volume_molec2, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not1, double fweight_quan_molec1, const String &fmolec_not2, double fweight_quan_molec2, const String &fmolec_not3, double fweight_quan_molec3, double fpressure, double ftemperature, double fdensity=-1.0)
 
 GasDef (const String &fname, const String &fnotation, const String &fmolec_not1, double fweight_volume_molec1, const String &fmolec_not2, double fweight_volume_molec2, const String &fmolec_not3, double fweight_volume_molec3, double fpressure, double ftemperature, int s1, int s2)
 
 GasDef (const String &fname, const String &fnotation, const GasDef &gd, double fpressure, double ftemperature, double fdensity=-1.0)
 
virtual void print (std::ostream &file, int l=0) const
 
 macro_copy_total (GasDef)
 
- Public Member Functions inherited from Heed::MatterDef
 MatterDef (void)
 
 MatterDef (const String &fname, const String &fnotation, long fqatom, const DynLinArr< String > &fatom_not, const DynLinArr< double > &fweight_quan, double fdensity, double ftemperature)
 
 MatterDef (const String &fname, const String &fnotation, const String &fatom_not, double fdensity, double ftemperature)
 
 MatterDef (const String &fname, const String &fnotation, const String &fatom_not1, double fweight_quan1, const String &fatom_not2, double fweight_quan2, double fdensity, double ftemperature)
 
 MatterDef (const String &fname, const String &fnotation, const String &fatom_not1, double fweight_quan1, const String &fatom_not2, double fweight_quan2, const String &fatom_not3, double fweight_quan3, double fdensity, double ftemperature)
 
 ~MatterDef ()
 
virtual void print (std::ostream &file, int l) const
 
const Stringname (void) const
 
const Stringnotation (void) const
 
double density (void) const
 
double temperature (void) const
 
double I_eff (void) const
 
void verify (void)
 
 macro_copy_total (MatterDef)
 
- Public Member Functions inherited from Heed::AtomMixDef
 AtomMixDef (void)
 
 AtomMixDef (long fqatom, const DynLinArr< String > &fatom_not, const DynLinArr< double > &fweight_quan)
 
 AtomMixDef (long fqatom, const DynLinArr< String > &fatom_not, const DynLinArr< long > &fweight_quan)
 
 AtomMixDef (const String &fatom_not)
 
 AtomMixDef (const String &fatom_not1, double fweight_quan1, const String &fatom_not2, double fweight_quan2)
 
 AtomMixDef (const String &fatom_not1, double fweight_quan1, const String &fatom_not2, double fweight_quan2, const String &fatom_not3, double fweight_quan3)
 
 AtomMixDef (const String &fatom_not1, double fweight_quan1, const String &fatom_not2, double fweight_quan2, const String &fatom_not3, double fweight_quan3, const String &fatom_not4, double fweight_quan4)
 
void print (std::ostream &file, int l) const
 
long qatom (void) const
 
const DynLinArr< PassivePtr< AtomDef > > & atom (void) const
 
PassivePtr< AtomDefatom (long n) const
 
const DynLinArr< double > & weight_quan (void) const
 
const DynLinArr< double > & weight_mass (void) const
 
double weight_quan (long n) const
 
double weight_mass (long n) const
 
double Z_mean (void) const
 
double A_mean (void) const
 
double inv_A_mean (void) const
 
double mean_ratio_Z_to_A (void) const
 
double NumberOfElectronsInGram (void) const
 

Additional Inherited Members

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

Detailed Description

Definition at line 39 of file GasDef.h.

Constructor & Destructor Documentation

◆ GasDef() [1/10]

Heed::GasDef::GasDef ( void  )

Definition at line 8 of file GasDef.cpp.

8: MatterDef(), pressureh(0.0), qmolech(0) {}

Referenced by GasDef().

◆ GasDef() [2/10]

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

Definition at line 10 of file GasDef.cpp.

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

◆ GasDef() [3/10]

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

Definition at line 101 of file GasDef.cpp.

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

◆ GasDef() [4/10]

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

Definition at line 159 of file GasDef.cpp.

161 {
162 mfunname("GasDef::GasDef(...1 molecule...)");
163 DynLinArr<String> fmolec_noth(1, fmolec_not);
164 DynLinArr<double> fweight_quan_molec(1, 1.0);
165 {
166 *this = GasDef(fname, fnotation, 1, fmolec_noth, fweight_quan_molec,
167 fpressure, ftemperature, fdensity);
168 }
169}

◆ GasDef() [5/10]

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

Definition at line 171 of file GasDef.cpp.

173 {
174 mfunname("GasDef::GasDef(...1 molecule...)");
175 DynLinArr<String> fmolec_noth(1, fmolec_not);
176 DynLinArr<double> fweight_volume_molec(1, 1.0);
177 {
178 *this = GasDef(fname, fnotation, 1, fmolec_noth, fweight_volume_molec,
179 fpressure, ftemperature, s1, s2);
180 }
181}

◆ GasDef() [6/10]

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

Definition at line 183 of file GasDef.cpp.

186 {
187 mfunname("GasDef::GasDef(...2 molecules...)");
188 DynLinArr<String> fmolec_noth(2);
189 DynLinArr<double> fweight_quan_molec(2, 0.0);
190 fmolec_noth[0] = fmolec_not1;
191 fmolec_noth[1] = fmolec_not2;
192 fweight_quan_molec[0] = fweight_quan_molec1;
193 fweight_quan_molec[1] = fweight_quan_molec2;
194 {
195 *this = GasDef(fname, fnotation, 2, fmolec_noth, fweight_quan_molec,
196 fpressure, ftemperature, fdensity);
197 }
198}

◆ GasDef() [7/10]

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

Definition at line 200 of file GasDef.cpp.

203 {
204 mfunname("GasDef::GasDef(...2 molecules...)");
205 DynLinArr<String> fmolec_noth(2);
206 DynLinArr<double> fweight_volume_molec(2, 0.0);
207 fmolec_noth[0] = fmolec_not1;
208 fmolec_noth[1] = fmolec_not2;
209 fweight_volume_molec[0] = fweight_volume_molec1;
210 fweight_volume_molec[1] = fweight_volume_molec2;
211 {
212 *this = GasDef(fname, fnotation, 2, fmolec_noth, fweight_volume_molec,
213 fpressure, ftemperature, s1, s2);
214 }
215}

◆ GasDef() [8/10]

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

Definition at line 217 of file GasDef.cpp.

221 {
222 mfunname("GasDef::GasDef(...3 molecules...)");
223 DynLinArr<String> fmolec_noth(3);
224 DynLinArr<double> fweight_quan_molec(3, 0.0);
225 fmolec_noth[0] = fmolec_not1;
226 fmolec_noth[1] = fmolec_not2;
227 fmolec_noth[2] = fmolec_not3;
228 fweight_quan_molec[0] = fweight_quan_molec1;
229 fweight_quan_molec[1] = fweight_quan_molec2;
230 fweight_quan_molec[2] = fweight_quan_molec3;
231 {
232 *this = GasDef(fname, fnotation, 3, fmolec_noth, fweight_quan_molec,
233 fpressure, ftemperature, fdensity);
234 }
235}

◆ GasDef() [9/10]

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

Definition at line 237 of file GasDef.cpp.

241 {
242 mfunname("GasDef::GasDef(...3 molecules...)");
243 DynLinArr<String> fmolec_noth(3);
244 DynLinArr<double> fweight_volume_molec(3, 0.0);
245 fmolec_noth[0] = fmolec_not1;
246 fmolec_noth[1] = fmolec_not2;
247 fmolec_noth[2] = fmolec_not3;
248 fweight_volume_molec[0] = fweight_volume_molec1;
249 fweight_volume_molec[1] = fweight_volume_molec2;
250 fweight_volume_molec[2] = fweight_volume_molec3;
251 {
252 *this = GasDef(fname, fnotation, 3, fmolec_noth, fweight_volume_molec,
253 fpressure, ftemperature, s1, s2);
254 }
255}

◆ GasDef() [10/10]

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

Definition at line 257 of file GasDef.cpp.

258 {
259 mfunname("GasDef::GasDef( another GasDef with different pres)");
260 long fqmolec = gd.qmolec();
261 DynLinArr<String> fmolec_not(fqmolec);
262 DynLinArr<double> fweight_quan_molec(fqmolec);
263 for (long n = 0; n < fqmolec; ++n) {
264 fmolec_not[n] = gd.molec(n)->notation();
265 fweight_quan_molec[n] = gd.weight_quan_molec(n);
266 }
267 *this = GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
268 fpressure, ftemperature, fdensity);
269
270}

Member Function Documentation

◆ macro_copy_total()

Heed::GasDef::macro_copy_total ( GasDef  )

◆ molec() [1/2]

PassivePtr< MoleculeDef > Heed::GasDef::molec ( long  n) const
inline

Definition at line 52 of file GasDef.h.

52{ return molech[n]; }

◆ molec() [2/2]

const DynLinArr< PassivePtr< MoleculeDef > > & Heed::GasDef::molec ( void  ) const
inline

Definition at line 49 of file GasDef.h.

49 {
50 return molech;
51 }

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

◆ pressure()

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

Definition at line 47 of file GasDef.h.

47{ return pressureh; }

Referenced by Heed::operator<<().

◆ print()

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

Reimplemented from Heed::MatterDef.

Definition at line 282 of file GasDef.cpp.

282 {
283 if (l > 0) file << (*this);
284}

◆ qmolec()

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

Definition at line 48 of file GasDef.h.

48{ return qmolech; }

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

◆ weight_mass_molec() [1/2]

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

Definition at line 62 of file GasDef.h.

62 {
63 return weight_mass_molech[n];
64 }

◆ weight_mass_molec() [2/2]

const DynLinArr< double > & Heed::GasDef::weight_mass_molec ( void  ) const
inline

Definition at line 56 of file GasDef.h.

56 {
57 return weight_mass_molech;
58 }

Referenced by Heed::operator<<().

◆ weight_quan_molec() [1/2]

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

Definition at line 59 of file GasDef.h.

59 {
60 return weight_quan_molech[n];
61 }

◆ weight_quan_molec() [2/2]

const DynLinArr< double > & Heed::GasDef::weight_quan_molec ( void  ) const
inline

Definition at line 53 of file GasDef.h.

53 {
54 return weight_quan_molech;
55 }

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

◆ Z_mean_molec()

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

Definition at line 273 of file GasDef.cpp.

273 {
274 mfunname("double GasDef::Z_mean_molec(void) const ");
275 double s = 0.0;
276 for (long n = 0; n < qmolech; ++n) {
277 s += molech[n]->Z_total() * weight_quan_molech[n];
278 }
279 return s;
280}

Referenced by Heed::operator<<().


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