Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MusicWrapper.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MusicWrapper.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 
16 #ifndef MUSICWRAPPER_H
17 #define MUSICWRAPPER_H
18 
19 #include <memory>
20 
21 #include "FluidDynamics.h"
22 #include "music.h"
23 #include "hydro_source_base.h"
24 #include "LiquefierBase.h"
25 #include "data_struct.h"
26 #include "JetScapeConstants.h"
27 #include "MakeUniqueHelper.h"
28 
29 using namespace Jetscape;
30 
31 class HydroSourceJETSCAPE : public HydroSourceBase {
32 private:
33  std::weak_ptr<LiquefierBase> liquefier_ptr;
34 
35 public:
36  HydroSourceJETSCAPE() = default;
38 
39  void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liqueifier) {
40  liquefier_ptr = new_liqueifier;
41  }
42 
43  int get_number_of_sources() const {
44  if (weak_ptr_is_uninitialized(liquefier_ptr)) {
45  return (0);
46  } else {
47  return (liquefier_ptr.lock()->get_dropletlist_size());
48  }
49  }
50 
51  double get_total_E_of_sources() const {
52  if (weak_ptr_is_uninitialized(liquefier_ptr)) {
53  return (0.0);
54  } else {
55  return (liquefier_ptr.lock()->get_dropletlist_total_energy());
56  }
57  }
58 
61  void get_hydro_energy_source(const double tau, const double x, const double y,
62  const double eta_s, const FlowVec &u_mu,
63  EnergyFlowVec &j_mu) const {
64  j_mu = {0.0};
65  if (weak_ptr_is_uninitialized(liquefier_ptr))
66  return;
67 
68  std::array<Jetscape::real, 4> jmu_tmp = {0.0};
69  liquefier_ptr.lock()->get_source(tau, x, y, eta_s, jmu_tmp);
70  for (int i = 0; i < 4; i++) {
71  j_mu[i] = jmu_tmp[i]/hbarC; // convert the unit from GeV/fm^4 to 1/fm^5
72  }
73  }
74 };
75 
78 class MpiMusic : public FluidDynamics {
79 private:
80  // int mode; //!< records running mode
81  std::unique_ptr<MUSIC> music_hydro_ptr;
82 
84  int doCooperFrye;
85 
88  std::shared_ptr<HydroSourceJETSCAPE> hydro_source_terms_ptr;
89 
90  // Allows the registration of the module so that it is available to be
91  // used by the Jetscape framework.
93 
94 public:
95  MpiMusic();
96  ~MpiMusic();
97 
98  void InitializeHydro(Parameter parameter_list);
99 
100  void EvolveHydro();
101  void GetHydroInfo(Jetscape::real t, Jetscape::real x, Jetscape::real y,
103  std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
104 
105  void
106  GetHydroInfo_JETSCAPE(Jetscape::real t, Jetscape::real x, Jetscape::real y,
108  std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
109  void GetHydroInfo_MUSIC(Jetscape::real t, Jetscape::real x, Jetscape::real y,
111  std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
112 
113  void SetHydroGridInfo();
114  void PassHydroEvolutionHistoryToFramework();
115 
116  void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liqueifier) {
117  liquefier_ptr = new_liqueifier;
118  hydro_source_terms_ptr->add_a_liquefier(liquefier_ptr.lock());
119  }
120 
121  void GetHyperSurface(Jetscape::real T_cut,
122  SurfaceCellInfo *surface_list_ptr){};
123  void collect_freeze_out_surface();
124 };
125 
126 #endif // MUSICWRAPPER_H