11using CLHEP::k_Boltzmann;
19 const double R = k_Boltzmann * Avogadro;
21 Vkh = R * 3.0 / 8.0 * Tkh / Pkh;
22 ah = 3 * Pkh * Vkh * Vkh;
27 mfunname(
"VanDerWaals::volume_of_mole(...)");
32 Cubic cb(Pr, -1.0 / 3.0 * (Pr + 8 * Tr), 3, -1);
39 s_not_single = q == 2 ? 1 : 0;
47 "std::ostream& operator << (std::ostream& file, const VanDerWaals& f)");
48 Ifile <<
"VanDerWaals:\n";
50 Iprintn(file, f.
Pk() / (CLHEP::atmosphere));
53 Ifile <<
"For comparison, the volume of a mole of ideal gas\n";
54 Ifile <<
"at the same conditions takes\n";
55 Iprintn(file, (k_Boltzmann * Avogadro * f.
Tk() / f.
Pk()) / (cm3 * mole));
56 Iprintn(file, f.
a() / (CLHEP::atmosphere * cm3 * cm3));
80 long fqatom,
const std::vector<std::string>& fatom_not,
81 const std::vector<long>& fqatom_ps,
91 mfunname(
"MoleculeDef::MoleculeDef(...)");
92 for (
long n = 0; n <
qatom(); n++) {
93 Z_totalh += qatom_psh[n] *
atom(n)->Z();
94 A_totalh += qatom_psh[n] *
atom(n)->A();
95 tqatomh += qatom_psh[n];
104 const std::string& fatom_not,
long fqatom_ps,
108 notationh(fnotation),
109 qatom_psh(1, fqatom_ps),
114 mfunname(
"MoleculeDef::MoleculeDef(...)");
115 Z_totalh =
atom(0)->Z() * fqatom_ps;
116 A_totalh =
atom(0)->A() * fqatom_ps;
123 const std::string& fatom_not1,
long fqatom_ps1,
124 const std::string& fatom_not2,
long fqatom_ps2,
126 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2),
128 notationh(fnotation),
134 mfunname(
"MoleculeDef::MoleculeDef(...)");
135 qatom_psh[0] = fqatom_ps1;
136 qatom_psh[1] = fqatom_ps2;
137 for (
long n = 0; n <
qatom(); n++) {
139 Z_totalh += qatom_psh[n] *
atom(n)->Z();
140 A_totalh += qatom_psh[n] *
atom(n)->A();
141 tqatomh += qatom_psh[n];
149 const std::string& fatom_not1,
long fqatom_ps1,
150 const std::string& fatom_not2,
long fqatom_ps2,
151 const std::string& fatom_not3,
long fqatom_ps3,
153 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2, fatom_not3,
156 notationh(fnotation),
162 mfunname(
"MoleculeDef::MoleculeDef(...)");
163 qatom_psh[0] = fqatom_ps1;
164 qatom_psh[1] = fqatom_ps2;
165 qatom_psh[2] = fqatom_ps3;
166 for (
long n = 0; n <
qatom(); n++) {
168 Z_totalh += qatom_psh[n] *
atom(n)->Z();
169 A_totalh += qatom_psh[n] *
atom(n)->A();
170 tqatomh += qatom_psh[n];
177 if (l > 0) file << (*this);
181 Ifile <<
"MoleculeDef::printall:\n";
183 std::list<MoleculeDef*>::const_iterator it;
184 std::list<MoleculeDef*>::const_iterator end = logbook.end();
185 for (it = logbook.begin(); it != end; ++it) file << (*it);
190 if (nameh ==
"none" && notationh ==
"none")
return;
192 std::list<MoleculeDef*>::const_iterator it;
193 std::list<MoleculeDef*>::const_iterator end = logbook.end();
194 for (it = logbook.begin(); it != end; ++it) {
195 if ((*it)->nameh == nameh || (*it)->notationh == notationh) {
197 mcerr <<
"can not initialize two molecules "
198 <<
"with the same name or notation\n";
199 mcerr <<
"name=" << nameh <<
" notation=" << notationh <<
'\n';
206 static std::list<MoleculeDef*> logbook;
216 std::list<MoleculeDef*>::const_iterator it;
217 std::list<MoleculeDef*>::const_iterator end = logbook.end();
218 for (it = logbook.begin(); it != end; ++it) {
219 if ((*it)->notation() == fnotation)
return *it;
226 "std::ostream& operator << (std::ostream& file, const MoleculeDef& f)");
227 Ifile <<
"MoleculeDef: name=" << std::setw(10) << f.
name()
228 <<
" notation=" << std::setw(3) << f.
notation() <<
'\n';
231 <<
" A_total()/(gram/mole)=" << f.
A_total() / (gram / mole)
232 <<
" tqatom()=" << f.
tqatom() <<
'\n';
235 for (
long n = 0; n < f.
qatom(); n++) {
236 Ifile <<
"n=" << n <<
" atom(n)->notation=" << f.
atom(n)->notation()
237 <<
" qatom_ps(n)=" << f.
qatom_ps(n) <<
'\n';
240 f.AtomMixDef::print(file, 1);
244 Ifile <<
"Density at the crucial conditions for ideal gas (for debug):\n";
245 double rydberg = k_Boltzmann * Avogadro;
250 f.
A_total() * at->
Pk() / (rydberg * at->
Tk()) / (gram / cm3));
251 Ifile <<
"For the Waals:\n";
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
Active pointer or automatic container or controlling pointer.
const std::vector< PassivePtr< AtomDef > > & atom() const
Find solution to cubic equation.
int find_real_zero(double z[3]) const
const std::vector< long > & qatom_ps() const
const std::string & name() const
void verify()
Check that there is no molecule with the same name in the container.
static MoleculeDef * get_MoleculeDef(const std::string &fnotation)
static void printall(std::ostream &file)
void print(std::ostream &file, int l) const
const std::string & notation() const
const ActivePtr< VanDerWaals > & awls() const
static std::list< MoleculeDef * > & get_logbook()
static const std::list< MoleculeDef * > & get_const_logbook()
Helper class for Van-der-Waals equation.
virtual VanDerWaals * copy() const
double volume_of_mole(double T, double p, int &s_not_single)
VanDerWaals(double fPk, double fTk)
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
#define Iprintn(file, name)
#define Iprint2n(file, name1, name2)