13 double ftemperature,
double fdensity)
14 : pressureh(fpressure),
17 weight_quan_molech(fqmolec),
18 weight_mass_molech(fqmolec) {
19 mfunname(
"GasDef::GasDef(...many molecules...)");
22 for (
long k = 0; k < fqmolec; ++k) {
25 "No molecule with such notation: " << fmolec_not[k] <<
'\n',
29 mcerr <<
"cannot find molecule with notation " << fmolec_not[k]
30 <<
"\nIn particular, check the sequence of initialization\n";
35 for (
long n = 0; n < fqmolec; ++n) {
36 weight_quan_molech[n] = fweight_quan_molec[n];
38 s += weight_quan_molech[n];
42 for (
long n = 0; n < fqmolec; ++n) {
43 weight_quan_molech[n] /= s;
46 for (
long n = 0; n < fqmolec; ++n) {
47 weight_mass_molech[n] = weight_quan_molech[n] * molech[n]->A_total();
50 for (
long n = 0; n < fqmolec; ++n) {
51 s += weight_mass_molech[n];
55 for (
long n = 0; n < fqmolec; ++n) {
56 weight_mass_molech[n] /= s;
63 for (
long k = 0; k < fqmolec; ++k) {
64 for (
long n = 0; n < molech[k]->qatom(); ++n) {
82 fatom_not[qat] = molech[k]->atom(n)->notation();
83 weight_qa[qat] = fweight_quan_molec[k] * molech[k]->qatom_ps(n);
91 fdensity =
gasdensity(ftemperature, fpressure, molech, weight_quan_molech,
97 fdensity, ftemperature);
104 double ftemperature,
int ,
int ) {
106 mfunname(
"GasDef::GasDef(...many molecules... Waals)");
108 for (
long n = 0; n < fqmolec; ++n) {
111 "No molecule with such notation: " << fmolec_not[n] <<
'\n',
120 for (
long n = 0; n < fqmolec; ++n) {
121 s += fweight_volume_molec[n];
124 for (
long n = 0; n < fqmolec; ++n) {
125 fw[n] = fweight_volume_molec[n] / s;
131 double ridberg = k_Boltzmann * Avogadro;
132 for (
long n = 0; n < fqmolec; ++n) {
133 VanDerVaals* aw = amolec[n]->awls().get();
136 fweight_quan_molec[n] = fw[n] * fpressure / (ridberg * ftemperature);
137 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
143 double number_of_moles =
144 fw[n] * 1.0 / aw->volume_of_mole(ftemperature,
145 fpressure, s_not_single);
147 fweight_quan_molec[n] = number_of_moles;
148 double ms = fweight_quan_molec[n] * amolec[n]->A_total();
153 double density_t = mass_t;
154 *
this =
GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
155 fpressure, ftemperature, density_t);
160 const String& fmolec_not,
double fpressure,
double ftemperature,
162 mfunname(
"GasDef::GasDef(...1 molecule...)");
166 *
this =
GasDef(fname, fnotation, 1, fmolec_noth, fweight_quan_molec,
167 fpressure, ftemperature, fdensity);
172 const String& fmolec_not,
double fpressure,
double ftemperature,
174 mfunname(
"GasDef::GasDef(...1 molecule...)");
178 *
this =
GasDef(fname, fnotation, 1, fmolec_noth, fweight_volume_molec,
179 fpressure, ftemperature, s1, s2);
184 const String& fmolec_not1,
double fweight_quan_molec1,
185 const String& fmolec_not2,
double fweight_quan_molec2,
186 double fpressure,
double ftemperature,
double fdensity) {
187 mfunname(
"GasDef::GasDef(...2 molecules...)");
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;
195 *
this =
GasDef(fname, fnotation, 2, fmolec_noth, fweight_quan_molec,
196 fpressure, ftemperature, fdensity);
201 const String& fmolec_not1,
double fweight_volume_molec1,
202 const String& fmolec_not2,
double fweight_volume_molec2,
203 double fpressure,
double ftemperature,
int s1,
int s2) {
204 mfunname(
"GasDef::GasDef(...2 molecules...)");
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;
212 *
this =
GasDef(fname, fnotation, 2, fmolec_noth, fweight_volume_molec,
213 fpressure, ftemperature, s1, s2);
218 const String& fmolec_not1,
double fweight_quan_molec1,
219 const String& fmolec_not2,
double fweight_quan_molec2,
220 const String& fmolec_not3,
double fweight_quan_molec3,
221 double fpressure,
double ftemperature,
double fdensity) {
222 mfunname(
"GasDef::GasDef(...3 molecules...)");
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;
232 *
this =
GasDef(fname, fnotation, 3, fmolec_noth, fweight_quan_molec,
233 fpressure, ftemperature, fdensity);
238 const String& fmolec_not1,
double fweight_volume_molec1,
239 const String& fmolec_not2,
double fweight_volume_molec2,
240 const String& fmolec_not3,
double fweight_volume_molec3,
241 double fpressure,
double ftemperature,
int s1,
int s2) {
242 mfunname(
"GasDef::GasDef(...3 molecules...)");
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;
252 *
this =
GasDef(fname, fnotation, 3, fmolec_noth, fweight_volume_molec,
253 fpressure, ftemperature, s1, s2);
258 double fpressure,
double ftemperature,
double fdensity) {
259 mfunname(
"GasDef::GasDef( another GasDef with different pres)");
260 long fqmolec = gd.
qmolec();
263 for (
long n = 0; n < fqmolec; ++n) {
264 fmolec_not[n] = gd.
molec(n)->notation();
267 *
this =
GasDef(fname, fnotation, fqmolec, fmolec_not, fweight_quan_molec,
268 fpressure, ftemperature, fdensity);
274 mfunname(
"double GasDef::Z_mean_molec(void) const ");
276 for (
long n = 0; n < qmolech; ++n) {
277 s += molech[n]->Z_total() * weight_quan_molech[n];
283 if (l > 0) file << (*this);
291 mfunname(
"std::ostream& operator << (std::ostream& file, const GasDef& f)");
292 Ifile <<
"GasDef: \n";
298 <<
" pressure/atmosphere * mm_rt_st_in_atmosphere = "
302 file <<
"qmolec()=" << f.
qmolec() <<
'\n';
304 for (
long n = 0; n < f.
qmolec(); ++n) {
305 Ifile <<
"n=" << n <<
" molec(n)->notation=" << f.
molec(n)->notation()
311 <<
" A_total/(gram/mole)=" << f.
molec(n)->A_total() / (gram / mole)
326 for (
long n = 0; n < qmolec; ++n) {
327 sa += weight_quan_molec[n] * molec[n]->A_total();
328 sw += weight_quan_molec[n];
330 double ridberg = k_Boltzmann * Avogadro;
331 return sa * pressure / (ridberg * temperature * sw);
#define check_econd11(a, signb, stream)
#define check_econd11a(a, signb, add, stream)
virtual void print(std::ostream &file, int l=0) const
const DynLinArr< double > & weight_mass_molec(void) const
const DynLinArr< PassivePtr< MoleculeDef > > & molec(void) const
double Z_mean_molec(void) const
double pressure(void) const
const DynLinArr< double > & weight_quan_molec(void) const
static MoleculeDef * get_MoleculeDef(const String &fnotation)
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
double gasdensity(double temperature, double pressure, DynLinArr< ProtPtr< MoleculeDef > > molec, DynLinArr< double > weight_quan_molec, long qmolec)
const double mm_rt_st_in_atmosphere