Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ic.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ic.cpp
1 #include <fstream>
2 #include <iomanip>
3 #include <iomanip>
4 #include <TF1.h>
5 #include <TF2.h>
6 #include <TGraph.h>
7 
8 #include "fld.h"
9 #include "eos.h"
10 #include "ic.h"
11 #include "inc.h"
12 #include "s95p.h"
13 
14 using namespace std;
15 
16 
18 {
19  s95p::loadSongIC(icInputFile, s0ScaleFactor);
20 }
21 
22 IC::~IC(void) {}
23 
24 
25 void IC::setIC(Fluid *f, EoS *eos, double tau) {
26  double e, nb, nq, vx = 0., vy = 0., vz = 0.;
27  Cell *c;
28 
29  double avv_num = 0., avv_den = 0.;
30  double Etotal = 0.0;
31 
32  for (int ix = 0; ix < f->getNX(); ix++)
33  for (int iy = 0; iy < f->getNY(); iy++)
34  for (int iz = 0; iz < f->getNZ(); iz++) {
35  c = f->getCell(ix, iy, iz);
36  double x = f->getX(ix);
37  double y = f->getY(iy);
38  double eta = f->getZ(iz);
39 
40  double eta1 = fabs(eta) < 1.3 ? 0.0 : fabs(eta) - 1.3;
41  double etaFactor =
42  exp(-eta1 * eta1 / 2.1 / 2.1) * (fabs(eta) < 5.3 ? 1.0 : 0.0);
43  e = s95p::getSongEps(x, y) * etaFactor;
44  if (e < 0.5) e = 0.0;
45  vx = vy = 0.0;
46  nb = nq = 0.0;
47  vz = 0.0;
48 
49  avv_num += sqrt(vx * vx + vy * vy) * e;
50  avv_den += e;
51 
52  c->setPrimVar(eos, tau, e, nb, nq, 0., vx, vy, vz);
53  double _p = eos->p(e, nb, nq, 0.);
54  const double gamma2 = 1.0 / (1.0 - vx * vx - vy * vy - vz * vz);
55  Etotal +=
56  ((e + _p) * gamma2 * (cosh(eta) + vz * sinh(eta)) - _p * cosh(eta));
57  c->saveQprev();
58 
59  if (e > 0.) c->setAllM(1.);
60  }
61  cout << "average initial flow = " << avv_num / avv_den << endl;
62  cout << "total energy = " << Etotal *f->getDx() * f->getDy() * f->getDz() *
63  tau << endl;
64 }