13VanDerVaals::VanDerVaals(
double fPk,
double fTk) : Pkh(fPk), Tkh(fTk) {
14 double R = k_Boltzmann * Avogadro;
16 Vkh = R * 3.0 / 8.0 * Tkh / Pkh;
17 ah = 3 * Pkh * Vkh * Vkh;
22double VanDerVaals::volume_of_mole(
double T,
double p,
int& s_not_single) {
23 mfunname(
"VanDerVaals::volume_of_mole(...)");
28 Cubic cb(Pr, -1.0 / 3.0 * (Pr + 8 * Tr), 3, -1);
30 int q = cb.find_real_zero(r);
46std::ostream&
operator<<(std::ostream& file,
const VanDerVaals& f) {
48 "std::ostream& operator << (std::ostream& file, const VanDerVaals& f)");
49 Ifile <<
"VanDerVaals:\n";
51 Iprintn(file, f.Pk() / (atmosphere));
52 Iprintn(file, f.Tk() / (kelvin));
54 Ifile <<
"For comparison, the volume of a mole of ideal gas\n";
55 Ifile <<
"at the same conditions takes\n";
56 Iprintn(file, (k_Boltzmann * Avogadro * f.Tk() / f.Pk()) / (cm3 * mole));
57 Iprintn(file, f.a() / (atmosphere * cm3 * cm3));
84MoleculeDef::MoleculeDef(
void) : nameh(
"none"), notationh(
"none") {
111 ActivePtr<VanDerVaals> fawls)
114 notationh(fnotation),
115 qatom_psh(fqatom_ps),
120 mfunname(
"MoleculeDef::MoleculeDef(...)");
122 for (n = 0; n <
qatom(); n++) {
123 Z_totalh += qatom_psh[n] *
atom(n)->Z();
124 A_totalh += qatom_psh[n] *
atom(n)->A();
125 tqatomh += qatom_psh[n];
135 const String& fatom_not,
long fqatom_ps,
136 ActivePtr<VanDerVaals> fawls)
139 notationh(fnotation),
140 qatom_psh(1, fqatom_ps),
145 mfunname(
"MoleculeDef::MoleculeDef(...)");
146 Z_totalh =
atom(0)->Z() * fqatom_ps;
147 A_totalh =
atom(0)->A() * fqatom_ps;
154 const String& fatom_not1,
long fqatom_ps1,
155 const String& fatom_not2,
long fqatom_ps2,
156 ActivePtr<VanDerVaals> fawls)
157 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2),
159 notationh(fnotation),
165 mfunname(
"MoleculeDef::MoleculeDef(...)");
166 qatom_psh[0] = fqatom_ps1;
167 qatom_psh[1] = fqatom_ps2;
169 for (n = 0; n <
qatom(); n++) {
171 Z_totalh += qatom_psh[n] *
atom(n)->Z();
172 A_totalh += qatom_psh[n] *
atom(n)->A();
173 tqatomh += qatom_psh[n];
181 const String& fatom_not1,
long fqatom_ps1,
182 const String& fatom_not2,
long fqatom_ps2,
183 const String& fatom_not3,
long fqatom_ps3,
184 ActivePtr<VanDerVaals> fawls)
185 :
AtomMixDef(fatom_not1, fqatom_ps1, fatom_not2, fqatom_ps2, fatom_not3,
188 notationh(fnotation),
194 mfunname(
"MoleculeDef::MoleculeDef(...)");
195 qatom_psh[0] = fqatom_ps1;
196 qatom_psh[1] = fqatom_ps2;
197 qatom_psh[2] = fqatom_ps3;
199 for (n = 0; n <
qatom(); n++) {
201 Z_totalh += qatom_psh[n] *
atom(n)->Z();
202 A_totalh += qatom_psh[n] *
atom(n)->A();
203 tqatomh += qatom_psh[n];
210 if (l > 0) file << (*this);
214 Ifile <<
"MoleculeDef::printall:\n";
223 mfunnamep(
"void MoleculeDef::verify(void)");
224 if (nameh ==
"none" && notationh ==
"none")
return;
227 if (an->el->nameh == nameh || an->el->notationh == notationh) {
229 mcerr <<
"can not initialize two molecules "
230 <<
"with the same name or notation\n";
231 mcerr <<
"name=" << nameh <<
" notation=" << notationh <<
'\n';
250 if (an->el->notation() == fnotation)
return an->el;
257 "std::ostream& operator << (std::ostream& file, const MoleculeDef& f)");
258 Ifile <<
"MoleculeDef: name=" << std::setw(10) << f.
name()
259 <<
" notation=" << std::setw(3) << f.
notation() <<
'\n';
262 <<
" A_total()/(gram/mole)=" << f.
A_total() / (gram / mole)
263 <<
" tqatom()=" << f.
tqatom() <<
'\n';
267 for (n = 0; n < f.
qatom(); n++) {
268 Ifile <<
"n=" << n <<
" atom(n)->notation=" << f.
atom(n)->notation()
269 <<
" qatom_ps(n)=" << f.
qatom_ps(n) <<
'\n';
272 f.AtomMixDef::print(file, 1);
274 VanDerVaals* at = f.
awls().get();
276 Ifile <<
"Density at the crutial conditions for ideal gas (for debug):\n";
277 double ridberg = k_Boltzmann * Avogadro;
282 f.
A_total() * at->Pk() / (ridberg * at->Tk()) / (gram / cm3));
283 Ifile <<
"For the Waals:\n";
#define macro_copy_body(type)
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
AbsListNode< T > * get_next_node(AbsListNode< T > *an) const
const DynLinArr< PassivePtr< AtomDef > > & atom(void) const
const ActivePtr< VanDerVaals > & awls(void) const
static MoleculeDef * get_MoleculeDef(const String &fnotation)
const DynLinArr< long > & qatom_ps(void) const
static void printall(std::ostream &file)
static AbsList< MoleculeDef * > & get_logbook(void)
void print(std::ostream &file, int l) const
const String & name(void) const
const String & notation(void) const
static const AbsList< MoleculeDef * > & get_const_logbook(void)
double A_total(void) const
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
#define Iprintn(file, name)
#define Iprint2n(file, name1, name2)
std::ostream & operator<<(std::ostream &file, const trajestep &f)