-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMusicWrapper.h
141 lines (114 loc) · 4.34 KB
/
MusicWrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*******************************************************************************
* Copyright (c) The JETSCAPE Collaboration, 2018
*
* Modular, task-based framework for simulating all aspects of heavy-ion collisions
*
* For the list of contributors see AUTHORS.
*
* Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
*
* or via email to [email protected]
*
* Distributed under the GNU General Public License 3.0 (GPLv3 or later).
* See COPYING for details.
******************************************************************************/
#ifndef MUSICWRAPPER_H
#define MUSICWRAPPER_H
#include <memory>
#include "FluidDynamics.h"
#include "music.h"
#include "hydro_source_base.h"
#include "LiquefierBase.h"
#include "data_struct.h"
#include "JetScapeConstants.h"
#include "MakeUniqueHelper.h"
using namespace Jetscape;
class HydroSourceJETSCAPE : public HydroSourceBase {
private:
std::weak_ptr<LiquefierBase> liquefier_ptr;
public:
HydroSourceJETSCAPE() = default;
~HydroSourceJETSCAPE() {}
void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liqueifier) {
liquefier_ptr = new_liqueifier;
}
int get_number_of_sources() const {
if (weak_ptr_is_uninitialized(liquefier_ptr)) {
return (0);
} else {
return (liquefier_ptr.lock()->get_dropletlist_size());
}
}
double get_total_E_of_sources() const {
if (weak_ptr_is_uninitialized(liquefier_ptr)) {
return (0.0);
} else {
return (liquefier_ptr.lock()->get_dropletlist_total_energy());
}
}
//! this function returns the energy source term J^\mu at a given point
//! (tau, x, y, eta_s)
void get_hydro_energy_source(const double tau, const double x, const double y,
const double eta_s, const FlowVec &u_mu,
EnergyFlowVec &j_mu) const {
j_mu = {0.0};
if (weak_ptr_is_uninitialized(liquefier_ptr))
return;
std::array<Jetscape::real, 4> jmu_tmp = {0.0};
liquefier_ptr.lock()->get_source(tau, x, y, eta_s, jmu_tmp);
for (int i = 0; i < 4; i++) {
j_mu[i] = jmu_tmp[i]/hbarC; // convert the unit from GeV/fm^4 to 1/fm^5
}
}
};
//! this is wrapper class for MUSIC so that it can be used as a external
//! library for the JETSCAPE integrated framework
class MpiMusic : public FluidDynamics {
private:
// int mode; //!< records running mode
std::unique_ptr<MUSIC> music_hydro_ptr;
Jetscape::real freezeout_temperature; //!< [GeV]
int doCooperFrye; //!< flag to run Cooper-Frye freeze-out
//!< for soft particles
int flag_preEq_output_evo_to_memory;
int flag_output_evo_to_file;
int flag_output_evo_to_memory;
int flag_surface_in_memory;
bool has_source_terms;
std::shared_ptr<HydroSourceJETSCAPE> hydro_source_terms_ptr;
// Allows the registration of the module so that it is available to be
// used by the Jetscape framework.
static RegisterJetScapeModule<MpiMusic> reg;
public:
MpiMusic();
~MpiMusic();
void CalculateTime();
void ExecTime();
void InitializeHydro(Parameter parameter_list);
void InitializeHydroEnergyProfile();
void EvolveHydro();
void EvolveHydroUpto(const double tauEnd);
void GetHydroInfo(Jetscape::real t, Jetscape::real x, Jetscape::real y,
Jetscape::real z,
std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
void
GetHydroInfo_JETSCAPE(Jetscape::real t, Jetscape::real x, Jetscape::real y,
Jetscape::real z,
std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
void GetHydroInfo_MUSIC(Jetscape::real t, Jetscape::real x, Jetscape::real y,
Jetscape::real z,
std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr);
void SetPreEqGridInfo();
void SetHydroGridInfo();
void PassPreEqEvolutionHistoryToFramework();
void PassHydroEvolutionHistoryToFramework();
void PassHydroSurfaceToFramework();
void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liqueifier) {
liquefier_ptr = new_liqueifier;
hydro_source_terms_ptr->add_a_liquefier(liquefier_ptr.lock());
}
void GetHyperSurface(Jetscape::real T_cut,
SurfaceCellInfo *surface_list_ptr){};
void collect_freeze_out_surface();
};
#endif // MUSICWRAPPER_H