Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FluidEvolutionHistory.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FluidEvolutionHistory.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 EVOLUTIONHISTORY_H
18 #define EVOLUTIONHISTORY_H
19 
20 #include <vector>
21 #include <stdexcept>
22 #include "FluidCellInfo.h"
23 #include "RealType.h"
24 
25 namespace Jetscape {
26 
27 // The simplest way for 3rd party hydro to provide evolution history is to
28 // send 2 vectors to the framework. One is a 1D float vector stores all
29 // the evolution history to data_vector.
30 // The other is the description of the content of the data to data_info.
31 // E.g., data_info should store a vector of 3 strings ['energy_density', 'vx, 'vy']
32 // if data_vector = [ed0, vx0, vy0, ed1, vx1, vy1, ..., edN, vxN, vyN, vzN],
33 // where N = ntau * nx * ny * netas is the number of total cells.
34 // One can pass these 3 data or more data to the framework, by storing them in any order,
35 // as long as the description matches the data content.
36 // The following is a list possible valid data names.
37 // ValidNames = [ "energy_density", "entropy_density", "temperature",
38 // "pressure", "qgp_fraction", "mu_b", "mu_c", "mu_s",
39 // "vx", "vy", "vz", "pi00", "pi01", "pi02", "pi03",
40 // "pi11", "pi12", "pi13", "pi22", "pi23", "pi33", "bulk_pi"];
41 //
42 
43 enum EntryName {
67 };
68 
70 
71 class InvalidSpaceTimeRange : public std::invalid_argument {
72  using std::invalid_argument::invalid_argument;
73 };
74 
76 public:
79 
81 
83 
85  int ntau;
86  int nx;
87  int ny;
88  int neta;
89 
92 
94 
97  std::vector<FluidCellInfo> data;
98 
104  std::vector<float> data_vector;
105 
107  std::vector<std::string> data_info;
108 
110  EvolutionHistory() = default;
111 
119  void FromVector(const std::vector<float> &data_,
120  const std::vector<std::string> &data_info_, float tau_min,
121  float dtau, float x_min, float dx, int nx, float y_min,
122  float dy, int ny, float eta_min, float deta, int neta,
123  bool tau_eta_is_tz);
124 
127  data.clear();
128  data_vector.clear();
129  data_info.clear();
130  }
131 
132  void clear_up_evolution_data() { data.clear(); }
133 
134  int get_data_size() const { return (data.size()); }
135  bool is_boost_invariant() const { return (boost_invariant); }
136  bool is_Cartesian() const { return (tau_eta_is_tz); }
137 
138  Jetscape::real Tau0() const { return (tau_min); }
139  Jetscape::real XMin() const { return (x_min); }
140  Jetscape::real YMin() const { return (y_min); }
141  Jetscape::real EtaMin() const { return (eta_min); }
142 
144  inline Jetscape::real TauMax() const { return (tau_min + (ntau - 1) * dtau); }
145 
147  inline Jetscape::real XMax() const { return (x_min + (nx - 1) * dx); }
148 
150  inline Jetscape::real YMax() const { return (y_min + (ny - 1) * dy); }
151 
153  inline Jetscape::real EtaMax() const { return (eta_min + (neta - 1) * deta); }
154 
162  Jetscape::real eta) const;
163 
164  // get the lower bound of the fluid cell along tau
168  inline int GetIdTau(Jetscape::real tau) const {
169  return (static_cast<int>((tau - tau_min) / dtau));
170  }
171 
172  // get the lower bound of the fluid cell along x
176  inline int GetIdX(Jetscape::real x) const {
177  return (static_cast<int>((x - x_min) / dx));
178  }
179 
180  // get the lower bound of the fluid cell along y
184  inline int GetIdY(Jetscape::real y) const {
185  return (static_cast<int>((y - y_min) / dy));
186  }
187 
188  // get the lower bound of the fluid cell along eta
192  inline int GetIdEta(Jetscape::real eta) const {
193  return (static_cast<int>((eta - eta_min) / deta));
194  }
195 
196  // get the coordinate of tau, x, y, eta on grid
200  inline Jetscape::real TauCoord(int id_tau) const {
201  return (tau_min + id_tau * dtau);
202  }
203 
207  inline Jetscape::real XCoord(int id_x) const { return (x_min + id_x * dx); }
208 
212  inline Jetscape::real YCoord(int id_y) const { return (y_min + id_y * dy); }
213 
217  inline Jetscape::real EtaCoord(int id_eta) const {
218  return (eta_min + id_eta * deta);
219  }
220 
221  // get the FluidCellInfo index in data
228  inline int CellIndex(int id_tau, int id_x, int id_y, int id_eta) const {
229  id_tau = std::min(ntau - 1, std::max(0, id_tau));
230  id_x = std::min(nx - 1, std::max(0, id_x));
231  id_y = std::min(ny - 1, std::max(0, id_y));
232  id_eta = std::min(neta - 1, std::max(0, id_eta));
233  return (id_tau * nx * ny * neta + id_x * ny * neta + id_y * neta + id_eta);
234  }
235 
236  /* Read fluid cell info for a given lattice cell*/
237  FluidCellInfo GetFluidCell(int id_tau, int id_x, int id_y, int id_eta) const;
238 
239  // get the FluidCellInfo at space point given time step
247  Jetscape::real etas) const;
248 
249  // get the FluidCellInfo at given space time point
257  Jetscape::real etas) const;
259  Jetscape::real z) const;
260 };
261 
262 } // namespace Jetscape
263 
264 #endif // EVOLUTIONHISTORY_H