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));
67 long fqatom,
const std::vector<std::string>& fatom_not,
68 const std::vector<long>& fqatom_ps,
69 std::shared_ptr<VanDerWaals> fvdw)
73 qatom_psh(fqatom_ps) {
74 mfunname(
"MoleculeDef::MoleculeDef(...)");
75 m_vdw = std::move(fvdw);
76 for (
long n = 0; n <
qatom(); n++) {
77 Z_totalh += qatom_psh[n] *
atom(n)->Z();
78 A_totalh += qatom_psh[n] *
atom(n)->A();
79 tqatomh += qatom_psh[n];
88 const std::string& fatom_not,
long fqatom_ps,
89 std::shared_ptr<VanDerWaals> fvdw)
93 qatom_psh(1, fqatom_ps),
95 mfunname(
"MoleculeDef::MoleculeDef(...)");
96 m_vdw = std::move(fvdw);
97 Z_totalh =
atom(0)->Z() * fqatom_ps;
98 A_totalh =
atom(0)->A() * fqatom_ps;
105 const std::string& fatom_not1,
long fqatom_ps1,
106 const std::string& fatom_not2,
long fqatom_ps2,
107 std::shared_ptr<VanDerWaals> fvdw)
108 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2),
110 notationh(fnotation),
112 mfunname(
"MoleculeDef::MoleculeDef(...)");
113 m_vdw = std::move(fvdw);
114 qatom_psh[0] = fqatom_ps1;
115 qatom_psh[1] = fqatom_ps2;
116 for (
long n = 0; n <
qatom(); n++) {
118 Z_totalh += qatom_psh[n] *
atom(n)->Z();
119 A_totalh += qatom_psh[n] *
atom(n)->A();
120 tqatomh += qatom_psh[n];
128 const std::string& fatom_not1,
long fqatom_ps1,
129 const std::string& fatom_not2,
long fqatom_ps2,
130 const std::string& fatom_not3,
long fqatom_ps3,
131 std::shared_ptr<VanDerWaals> fvdw)
132 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2, fatom_not3,
135 notationh(fnotation),
137 mfunname(
"MoleculeDef::MoleculeDef(...)");
138 m_vdw = std::move(fvdw);
139 qatom_psh[0] = fqatom_ps1;
140 qatom_psh[1] = fqatom_ps2;
141 qatom_psh[2] = fqatom_ps3;
142 for (
long n = 0; n <
qatom(); n++) {
144 Z_totalh += qatom_psh[n] *
atom(n)->Z();
145 A_totalh += qatom_psh[n] *
atom(n)->A();
146 tqatomh += qatom_psh[n];
153 if (l > 0) file << (*this);
157 Ifile <<
"MoleculeDef::printall:\n";
165 if (nameh ==
"none" && notationh ==
"none")
return;
167 if (molecule->nameh != nameh && molecule->notationh != notationh)
continue;
169 mcerr <<
"cannot initialize two molecules with the same name or notation\n";
170 mcerr <<
"name=" << nameh <<
" notation=" << notationh <<
'\n';
176 static std::list<MoleculeDef*> logbook;
186 if (molecule->notation() == fnotation)
return molecule;
192 mfunnamep(
"std::ostream& operator << (std::ostream&, const MoleculeDef&)");
193 constexpr double gpm = gram / mole;
194 Ifile <<
"MoleculeDef: name=" << std::setw(10) << f.
name()
195 <<
" notation=" << std::setw(3) << f.
notation() <<
'\n';
198 <<
" A_total()/(gram/mole)=" << f.
A_total() / gpm
199 <<
" tqatom()=" << f.
tqatom() <<
'\n';
202 for (
long n = 0; n < f.
qatom(); n++) {
203 Ifile <<
"n=" << n <<
" atom(n)->notation=" << f.
atom(n)->notation()
204 <<
" qatom_ps(n)=" << f.
qatom_ps(n) <<
'\n';
207 f.AtomMixDef::print(file, 1);
210 Ifile <<
"Density at the crucial conditions for ideal gas (for debug):\n";
211 double rydberg = k_Boltzmann * Avogadro;
216 f.
A_total() * at->
Pk() / (rydberg * at->
Tk()) / (gram / cm3));
217 Ifile <<
"For the Waals:\n";
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
const std::vector< 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
static std::list< MoleculeDef * > & get_logbook()
static const std::list< MoleculeDef * > & get_const_logbook()
const std::shared_ptr< VanDerWaals > & vdw() const
Helper class for Van-der-Waals equation.
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)