Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FluidDynamics.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FluidDynamics.cc
1 /*******************************************************************************
2  * Copyright (c) The JETSCAPE Collaboration, 2018
3  *
4  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
5  *
6  * For the list of contributors see AUTHORS.
7  *
8  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9  *
10  * or via email to bugs.jetscape@gmail.com
11  *
12  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13  * See COPYING for details.
14  ******************************************************************************/
15 // This is a general basic class for hydrodynamics
16 
17 #include <iostream>
18 #include <array>
19 #include "FluidDynamics.h"
20 #include "LinearInterpolation.h"
21 #include "JetScapeSignalManager.h"
22 #include "MakeUniqueHelper.h"
23 #include "SurfaceFinder.h"
24 
25 #define MAGENTA "\033[35m"
26 
27 using namespace std;
28 
29 namespace Jetscape {
30 
31 FluidDynamics::FluidDynamics() {
32  VERBOSE(8);
33  eta = -99.99;
34  boost_invariant_ = true;
35  SetId("FluidDynamics");
36 }
37 
38 FluidDynamics::~FluidDynamics() {
39  VERBOSE(8);
40  disconnect_all();
41 }
42 
45 
46  JSINFO << "Initialize FluidDynamics : " << GetId() << " ...";
47 
48  VERBOSE(8);
49  ini = JetScapeSignalManager::Instance()->GetInitialStatePointer().lock();
50  if (!ini) {
51  JSWARN << "No initialization module, "
52  << "try: auto trento = make_shared<TrentoInitial>(); "
53  << "jetscape->Add(trento);";
54  }
55 
56  pre_eq_ptr =
57  JetScapeSignalManager::Instance()->GetPreEquilibriumPointer().lock();
58  if (!pre_eq_ptr) {
59  JSWARN << "No Pre-equilibrium module";
60  }
61 
62  InitializeHydro(parameter_list);
63  InitTask();
64 
65  JetScapeTask::InitTasks();
66 }
67 
68 void FluidDynamics::Exec() {
69  VERBOSE(2) << "Run Hydro : " << GetId() << " ...";
70  VERBOSE(8) << "Current Event #" << GetCurrentEvent();
71 
72  if (ini) {
73  VERBOSE(3) << "length of entropy density vector="
74  << ini->GetEntropyDensityDistribution().size();
75  }
76 
77  EvolveHydro();
78  JetScapeTask::ExecuteTasks();
79 }
80 
82  clear_up_evolution_data();
83  if (!weak_ptr_is_uninitialized(liquefier_ptr)) {
84  liquefier_ptr.lock()->Clear();
85  }
86 }
87 
88 void FluidDynamics::CollectHeader(weak_ptr<JetScapeWriter> w) {
89  auto f = w.lock();
90  if (f) {
91  auto &header = f->GetHeader();
92  header.SetEventPlaneAngle(GetEventPlaneAngle());
93  }
94 }
95 
96 void FluidDynamics::FindAConstantTemperatureSurface(
97  Jetscape::real T_sw, std::vector<SurfaceCellInfo> &surface_cells) {
98  std::unique_ptr<SurfaceFinder> surface_finder_ptr(
99  new SurfaceFinder(T_sw, bulk_info));
100  surface_finder_ptr->Find_full_hypersurface();
101  surface_cells = surface_finder_ptr->get_surface_cells_vector();
102  JSINFO << "number of surface cells: " << surface_cells.size();
103 }
104 
105 // this function returns the energy density [GeV] at a space time point
106 // (time, x, y, z)
107 Jetscape::real FluidDynamics::GetEnergyDensity(Jetscape::real time,
110  Jetscape::real z) {
111  std::unique_ptr<FluidCellInfo> fluid_cell_ptr;
112  GetHydroInfo(time, x, y, z, fluid_cell_ptr);
113  real energy_density = fluid_cell_ptr->energy_density;
114  return (energy_density);
115 }
116 
117 // this function returns the entropy density [GeV] at a space time point
118 // (time, x, y, z)
119 Jetscape::real FluidDynamics::GetEntropyDensity(Jetscape::real time,
122  Jetscape::real z) {
123  std::unique_ptr<FluidCellInfo> fluid_cell_ptr;
124  GetHydroInfo(time, x, y, z, fluid_cell_ptr);
125  real entropy_density = fluid_cell_ptr->entropy_density;
126  return (entropy_density);
127 }
128 
129 // this function returns the temperature [GeV] at a space time point
130 // (time, x, y, z)
131 Jetscape::real FluidDynamics::GetTemperature(Jetscape::real time,
133  Jetscape::real z) {
134  std::unique_ptr<FluidCellInfo> fluid_cell_ptr;
135  GetHydroInfo(time, x, y, z, fluid_cell_ptr);
136  real temperature = fluid_cell_ptr->temperature;
137  return (temperature);
138 }
139 
140 // this function returns the QGP fraction at a space time point
141 // (time, x, y, z)
142 Jetscape::real FluidDynamics::GetQgpFraction(Jetscape::real time,
144  Jetscape::real z) {
145  std::unique_ptr<FluidCellInfo> fluid_cell_ptr;
146  GetHydroInfo(time, x, y, z, fluid_cell_ptr);
147  real qgp_fraction = fluid_cell_ptr->qgp_fraction;
148  return (qgp_fraction);
149 }
150 
151 void FluidDynamics::get_source_term(Jetscape::real tau, Jetscape::real x,
153  std::array<Jetscape::real, 4> jmu) const {
154  liquefier_ptr.lock()->get_source(tau, x, y, eta, jmu);
155 }
156 
157 void FluidDynamics::PrintFluidCellInformation(
158  FluidCellInfo *fluid_cell_info_ptr) {
159  // this function print out the information of the fluid cell to the screen
160  JSINFO << "=======================================================";
161  JSINFO << "print out cell information:";
162  JSINFO << "=======================================================";
163  JSINFO << "energy density = " << fluid_cell_info_ptr->energy_density
164  << " GeV/fm^3.";
165  JSINFO << "entropy density = " << fluid_cell_info_ptr->entropy_density
166  << " 1/fm^3.";
167  JSINFO << "temperature = " << fluid_cell_info_ptr->temperature << " GeV.";
168  JSINFO << "pressure = " << fluid_cell_info_ptr->pressure << " GeV/fm^3.";
169  JSINFO << "QGP_fraction = " << fluid_cell_info_ptr->qgp_fraction;
170  JSINFO << "mu_B = " << fluid_cell_info_ptr->mu_B << " GeV.";
171  JSINFO << "mu_S = " << fluid_cell_info_ptr->mu_S << " GeV.";
172  JSINFO << "mu_C = " << fluid_cell_info_ptr->mu_C << " GeV.";
173  JSINFO << "vx = " << fluid_cell_info_ptr->vx;
174  JSINFO << "vy = " << fluid_cell_info_ptr->vy;
175  JSINFO << "vz = " << fluid_cell_info_ptr->vz;
176  JSINFO << "shear viscous pi^{munu} (GeV/fm^3): ";
177  for (int i = 0; i < 4; i++) {
178  for (int j = 0; j < 4; j++) {
179  JSINFO << fluid_cell_info_ptr->pi[i][j];
180  }
181  }
182  JSINFO << "bulk_Pi = " << fluid_cell_info_ptr->bulk_Pi << " GeV/fm^3";
183  JSINFO << "=======================================================";
184 }
185 
186 void FluidDynamics::UpdateEnergyDeposit(int t, double edop) {
187  //sigslot::lock_block<multi_threaded_local> lock(this);
188  JSDEBUG << MAGENTA << "Jet Signal received : " << t << " " << edop;
189 }
190 
191 } // end namespace Jetscape