29 using namespace Jetscape;
36 SetId(
"hydroFromFile");
45 JSDEBUG <<
"Initialize hydro from file (Test) ...";
48 string s = GetXMLElementText({
"Hydro",
"hydro_from_file",
"name"});
49 JSDEBUG << s <<
" to be initialized ...";
51 hydro_type_ = GetXMLElementInt({
"Hydro",
"hydro_from_file",
"hydro_type"});
52 int boost_inv = GetXMLElementInt(
53 {
"Hydro",
"hydro_from_file",
"boost_invariant_"});
55 boost_invariant_ =
false;
57 boost_invariant_ =
true;
60 GetXMLElementInt({
"Hydro",
"hydro_from_file",
"load_viscous_info"});
62 GetXMLElementInt({
"Hydro",
"hydro_from_file",
"read_hydro_every_ntau"});
63 T_c_ = GetXMLElementDouble({
"Hydro",
"hydro_from_file",
"T_c"});
64 flag_read_in_multiple_hydro_ =
65 GetXMLElementInt({
"Hydro",
"hydro_from_file",
"read_in_multiple_hydro"});
69 if (hydro_type_ == 1) {
73 JSWARN <<
" : hydro_type == 1 requires the hdf5 library~";
74 JSWARN <<
" : please check your inputs~";
77 }
else if (hydro_type_ == 2 || hydro_type_ == 3
78 || hydro_type_ == 4 || hydro_type_ == 5) {
80 int verbose = GetXMLElementInt({
"vlevel"});
81 hydroinfo_MUSIC_ptr->set_verbose(verbose);
82 }
else if (hydro_type_ == 7) {
85 int verbose = GetXMLElementInt({
"vlevel"});
86 hydroinfo_MUSIC_ptr->set_verbose(verbose);
87 hydroinfo_PreEq_ptr->set_verbose(verbose);
96 JSINFO <<
"read in a VISHNew hydro event from file " << VISH_filename;
97 if (hydro_type_ == 1) {
99 hydroinfo_h5_ptr->readHydroinfoH5(VISH_filename, buffer_size, load_viscous);
107 string MUSIC_hydro_ideal_file,
109 JSINFO <<
"read in a MUSIC hydro event from file " << MUSIC_hydro_ideal_file;
110 string hydro_shear_file =
"";
111 string hydro_bulk_file =
"";
113 if (hydro_type_ == 2) {
115 }
else if (hydro_type_ == 3) {
117 }
else if (hydro_type_ == 4) {
119 }
else if (hydro_type_ == 5) {
122 hydroinfo_MUSIC_ptr->readHydroData(hydro_mode, nskip_tau, MUSIC_input_file,
123 MUSIC_hydro_ideal_file, hydro_shear_file,
132 string MUSIC_hydro_ideal_file,
135 if (hydro_type_ == 8) {
138 string hydro_shear_file =
"";
139 string hydro_bulk_file =
"";
140 JSINFO <<
"read in a PreEq event from file " << PreEq_file;
141 hydroinfo_PreEq_ptr->readHydroData(hydro_mode, nskip_tau, MUSIC_input_file,
142 PreEq_file, hydro_shear_file,
144 JSINFO <<
"read in a MUSIC hydro event from file " << MUSIC_hydro_ideal_file;
145 hydroinfo_MUSIC_ptr->readHydroData(hydro_mode, nskip_tau, MUSIC_input_file,
146 MUSIC_hydro_ideal_file, hydro_shear_file,
154 hydro_event_idx_ = ini->GetEventId();
157 if (hydro_type_ == 1) {
159 if (flag_read_in_multiple_hydro_ == 0) {
160 filename = GetXMLElementText({
"Hydro",
"hydro_from_file",
"VISH_file"});
163 GetXMLElementText({
"Hydro",
"hydro_from_file",
"hydro_files_folder"});
164 std::ostringstream hydro_filename;
165 hydro_filename << folder <<
"/event-" << hydro_event_idx_
167 filename = hydro_filename.str();
170 read_in_hydro_event(filename, 500, load_viscous_);
171 hydro_tau_0 = hydroinfo_h5_ptr->getHydrogridTau0();
172 hydro_tau_max = hydroinfo_h5_ptr->getHydrogridTaumax();
175 }
else if (hydro_type_ < 6) {
177 string hydro_ideal_file;
178 if (flag_read_in_multiple_hydro_ == 0) {
179 input_file = GetXMLElementText(
180 {
"Hydro",
"hydro_from_file",
"MUSIC_input_file"});
181 hydro_ideal_file = GetXMLElementText(
182 {
"Hydro",
"hydro_from_file",
"MUSIC_file"});
184 string folder = GetXMLElementText(
185 {
"Hydro",
"hydro_from_file",
"hydro_files_folder"});
186 std::ostringstream input_filename;
187 std::ostringstream hydro_filename;
188 input_filename << folder <<
"/event-" << hydro_event_idx_
190 hydro_filename << folder <<
"/event-" << hydro_event_idx_
192 input_file = input_filename.str();
193 hydro_ideal_file = hydro_filename.str();
195 read_in_hydro_event(input_file, hydro_ideal_file, nskip_tau_);
196 hydro_tau_0 = hydroinfo_MUSIC_ptr->get_hydro_tau0();
197 hydro_tau_max = hydroinfo_MUSIC_ptr->get_hydro_tau_max();
198 }
else if (hydro_type_ < 9) {
201 string hydro_ideal_file;
202 if (flag_read_in_multiple_hydro_ == 0) {
203 PreEq_file = GetXMLElementText(
204 {
"Hydro",
"hydro_from_file",
"PreEq_file"});
205 hydro_ideal_file = GetXMLElementText(
206 {
"Hydro",
"hydro_from_file",
"MUSIC_file"});
208 string folder = GetXMLElementText(
209 {
"Hydro",
"hydro_from_file",
"hydro_files_folder"});
210 std::ostringstream preEq_filename;
211 std::ostringstream hydro_filename;
212 preEq_filename << folder <<
"/event-" << hydro_event_idx_
214 hydro_filename << folder <<
"/event-" << hydro_event_idx_
216 PreEq_file = preEq_filename.str();
217 hydro_ideal_file = hydro_filename.str();
219 read_in_hydro_event(input_file, PreEq_file, hydro_ideal_file, 1);
220 PreEq_tau0_ = hydroinfo_PreEq_ptr->get_hydro_tau0();
221 PreEq_tauf_ = hydroinfo_PreEq_ptr->get_hydro_tau_max();
222 hydro_tau_0 = hydroinfo_MUSIC_ptr->get_hydro_tau0();
223 hydro_tau_max = hydroinfo_MUSIC_ptr->get_hydro_tau_max();
224 if (std::abs(PreEq_tauf_ - hydro_tau_0) > 1
e-6) {
225 JSWARN << __PRETTY_FUNCTION__
226 <<
"Preequilibrium medium end time is not the same as "
227 <<
"the hydro starting time! "
228 <<
"PreEq: tau_f = " << PreEq_tauf_ <<
" fm/c, "
229 <<
"hydro: tau_0 = " << hydro_tau_0 <<
" fm/c.";
232 JSWARN << __PRETTY_FUNCTION__
233 <<
"unrecognized hydro_type = " << hydro_type_;
240 JSINFO <<
" clean up the loaded hydro event ...";
241 if (hydro_type_ == 1) {
243 hydroinfo_h5_ptr->clean_hydro_event();
246 hydroinfo_MUSIC_ptr->clean_hydro_event();
249 if (hydro_type_ == 7) {
250 hydroinfo_PreEq_ptr->clean_hydro_event();
259 std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr) {
261 JSWARN <<
"Hydro not run yet ...";
265 double t_local =
static_cast<double>(
t);
266 double x_local =
static_cast<double>(
x);
267 double y_local =
static_cast<double>(
y);
268 double z_local =
static_cast<double>(
z);
270 if (t_local < z_local) {
271 JSWARN <<
"Request a space-like point, t = " << t_local
272 <<
", z = " << z_local;
275 double tau_local = sqrt(t * t - z * z);
276 double eta_local = 0.5 * log((t + z) / (t - z + 1
e-15));
277 if (boost_invariant_) {
283 if (hydro_type_ == 1) {
285 eta_local = 0.5 * log((t + z) / (t - z + 1
e-15));
286 hydroinfo_h5_ptr->getHydroinfo(tau_local, x_local, y_local,
287 temp_fluid_cell_ptr);
290 (1. / sqrt(1. - temp_fluid_cell_ptr->
vx * temp_fluid_cell_ptr->
vx -
291 temp_fluid_cell_ptr->
vy * temp_fluid_cell_ptr->
vy));
292 double u0 = u0_perp * cosh(eta_local);
293 temp_fluid_cell_ptr->
vx *= u0_perp / u0;
294 temp_fluid_cell_ptr->
vy *= u0_perp / u0;
295 temp_fluid_cell_ptr->
vz = z / (t + 1
e-15);
297 }
else if (hydro_type_ < 6) {
298 t_local = tau_local*cosh(eta_local);
299 z_local = tau_local*sinh(eta_local);
300 hydroinfo_MUSIC_ptr->getHydroValues(x_local, y_local, z_local, t_local,
301 temp_fluid_cell_ptr);
302 }
else if (hydro_type_ < 9) {
303 t_local = tau_local*cosh(eta_local);
304 z_local = tau_local*sinh(eta_local);
305 if (tau_local < PreEq_tauf_) {
306 hydroinfo_PreEq_ptr->getHydroValues(x_local, y_local, z_local, t_local,
307 temp_fluid_cell_ptr);
309 hydroinfo_MUSIC_ptr->getHydroValues(x_local, y_local, z_local, t_local,
310 temp_fluid_cell_ptr);
316 fluid_cell_info_ptr = make_unique<FluidCellInfo>();
326 double qgp_fraction_local = 1.0;
328 qgp_fraction_local = 0.0;
333 fluid_cell_info_ptr->
mu_B = 0.0;
334 fluid_cell_info_ptr->
mu_C = 0.0;
335 fluid_cell_info_ptr->
mu_S = 0.0;
337 fluid_cell_info_ptr->
vx =
339 fluid_cell_info_ptr->
vy =
341 fluid_cell_info_ptr->
vz =
343 for (
int i = 0;
i < 4;
i++) {
344 for (
int j = 0;
j < 4;
j++) {
345 fluid_cell_info_ptr->
pi[
i][
j] =
351 delete temp_fluid_cell_ptr;
357 if (hydro_type_ == 1) {
358 std::ostringstream angle_filename;
360 GetXMLElementText({
"Hydro",
"hydro_from_file",
"hydro_files_folder"});
361 angle_filename << folder <<
"/event-" << hydro_event_idx_
362 <<
"/EventPlanesFrzout.dat";
363 std::ifstream
inputfile(angle_filename.str().c_str());
368 inputfile >> dummy >> v2 >> dummy >> psi_2;