Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FluidDynamics.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FluidDynamics.h
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 #ifndef FLUIDDYNAMICS_H
18 #define FLUIDDYNAMICS_H
19 
20 #include <memory>
21 #include <vector>
22 #include <array>
23 #include <cstring>
24 #include <stdexcept>
25 #include <cmath>
26 #include <iostream>
27 #include <map>
28 
29 #include "InitialState.h"
30 #include "JetScapeModuleBase.h"
31 #include "PreequilibriumDynamics.h"
32 #include "RealType.h"
33 #include "FluidCellInfo.h"
34 #include "FluidEvolutionHistory.h"
35 #include "LiquefierBase.h"
36 #include "SurfaceCellInfo.h"
37 
38 namespace Jetscape {
39 
42 
44 class Parameter {
45 public:
47 };
48 
50 protected:
51  // record hydro start and end proper time [fm/c]
53  // record hydro freeze out temperature [GeV]
55  // record hydro running status
57 
58  // add initial state shared pointer
61  std::shared_ptr<InitialState> ini;
62  std::shared_ptr<PreequilibriumDynamics> pre_eq_ptr;
63 
64  double eta;
67 
68  // How to store this data? In memory or hard disk?
69  // 3D hydro may eat out the memory,
70  // for large dataset, std::deque is better than std::vector.
73 
74  std::weak_ptr<LiquefierBase> liquefier_ptr;
75 
76 public:
80  FluidDynamics();
81 
83  virtual ~FluidDynamics();
84 
88  virtual void Init();
89 
93  virtual void Exec();
94 
95  virtual void Clear();
96 
101 
105  virtual void CollectHeader(weak_ptr<JetScapeWriter> w);
106 
110  virtual double GetEventPlaneAngle() { return (-999); }
111 
119  virtual void GetTemperature(double t, double x, double y, double z,
120  double &mT) {
121  mT = GetTemperature(t, x, y, z);
122  }
123 
131  virtual void GetHydroCell(double t, double x, double y, double z,
132  std::unique_ptr<FluidCellInfo> &fCell) {
133  GetHydroInfo(t, x, y, z, fCell);
134  }
135 
136  // currently we have no standard for passing configurations
137  // pure virtual function; to be implemented by users
138  // should make it easy to save evolution history to bulk_info
142 
144  virtual void EvolveHydro(){};
145 
147  int GetHydroStatus() const { return (hydro_status); }
148 
150  std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr) {
151  bulk_info.data.push_back(*fluid_cell_info_ptr);
152  }
153 
155 
158  void GetHydroStartTime(double &tau0) { tau0 = hydro_tau_0; }
159 
167  }
168 
178  virtual void
181  std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr) {
182  if (hydro_status != FINISHED || bulk_info.data.size() == 0) {
183  throw std::runtime_error("Hydro evolution is not finished "
184  "or EvolutionHistory is empty");
185  }
186  // judge whether to use 2D interpolation or 3D interpolation
187  if (!bulk_info.tau_eta_is_tz) {
188  Jetscape::real tau = std::sqrt(t * t - z * z);
189  Jetscape::real eta = 0.5 * (std::log(t + z) - std::log(t - z));
190  bulk_info.CheckInRange(tau, x, y, eta);
191  //return bulk_info.get(tau, x, y, eta);
192  } else {
193  bulk_info.CheckInRange(t, x, y, z);
194  //return bulk_info.get(t, x, y, z);
195  }
196  }
197 
198  // this function print out the information of the fluid cell to the screen
202  void PrintFluidCellInformation(FluidCellInfo *fluid_cell_info_ptr);
203 
204  // this function returns hypersurface for Cooper-Frye or recombination
205  // the detailed implementation is left to the hydro developper
209  Jetscape::real T_sw, std::vector<SurfaceCellInfo> &surface_cells);
210 
211  // all the following functions will call function GetHydroInfo()
212  // to get thermaldynamic and dynamical information at a space-time point
213  // (time, x, y, z)
214 
223 
232  Jetscape::real z);
233 
242 
251 
252  // These have no default implementation
253  // /** @return 3-component (vx,vy,vz) fluid velocity at point (t or tau, x, y, z or eta).
254  // @param time Time or tau coordinate.
255  // @param x Space coordinate.
256  // @param y Space coordinate.
257  // @param z Space or eta coordinate.
258  // */
259  // virtual real3 Get3FluidVelocity(Jetscape::real time, Jetscape::real x, Jetscape::real y, Jetscape::real z)=0;
260 
261  // /** @return 4-component fluid velocity at point (t or tau, x, y, zor eta).
262  // @param time Time or tau coordinate.
263  // @param x Space coordinate.
264  // @param y Space coordinate.
265  // @param z Space or eta coordinate.
266  // */
267  // virtual real4 Get4FluidVelocity(Jetscape::real time, Jetscape::real x, Jetscape::real y, Jetscape::real z);
268 
269  // /** @return Net baryon density at point (t or tau, x, y, z or eta).
270  // @param time Time or tau coordinate.
271  // @param x Space coordinate.
272  // @param y Space coordinate.
273  // @param z Space or eta coordinate.
274  // */
275  // virtual Jetscape::real GetNetBaryonDensity(Jetscape::real time, Jetscape::real x, Jetscape::real y, Jetscape::real z);
276 
277  // /** @return Net charge density at point (t or tau, x, y, z or eta).
278  // @param time Time or tau coordinate.
279  // @param x Space coordinate.
280  // @param y Space coordinate.
281  // @param z Space or eta coordinate.
282  // */
283  // virtual Jetscape::real GetNetChargeDensity(Jetscape::real time, Jetscape::real x, Jetscape::real y, Jetscape::real z);
284 
285  virtual void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liquefier) {
286  liquefier_ptr = new_liquefier;
287  }
288 
291  std::array<Jetscape::real, 4> jmu) const;
292 
294  virtual void UpdateEnergyDeposit(int t, double edop);
296  virtual void GetEnergyDensity(int t, double &edensity) { edensity = 0.0; }
297 
298  // get a reference to the bulk_info object
299  const EvolutionHistory& get_bulk_info() const { return bulk_info; }
300 
301 }; // end class FluidDynamics
302 
303 } // end namespace Jetscape
304 
305 #endif // FLUIDDYNAMICS_H