26 using namespace Jetscape;
39 JSINFO <<
"Initialize CLVisc ...";
42 std::string s = GetXMLElementText({
"Hydro",
"CLVisc",
"name"});
43 JSDEBUG << s <<
" to be initialized ...";
48 GetXMLElementText({
"Hydro",
"CLVisc",
"device_type"});
50 if (device_type ==
"cpu" || device_type ==
"CPU") {
51 cfg.
block_size = GetXMLElementInt({
"Hydro",
"CLVisc",
"cpu_block_size"});
53 cfg.
block_size = GetXMLElementInt({
"Hydro",
"CLVisc",
"gpu_block_size"});
55 int device_id = GetXMLElementInt({
"Hydro",
"CLVisc",
"device_id"});
56 cfg.
etaos_xmin = GetXMLElementInt({
"Hydro",
"CLVisc",
"etaos_xmin"});
57 cfg.
etaos_ymin = GetXMLElementInt({
"Hydro",
"CLVisc",
"etaos_ymin"});
59 GetXMLElementInt({
"Hydro",
"CLVisc",
"etaos_left_slop"});
61 GetXMLElementInt({
"Hydro",
"CLVisc",
"etaos_right_slop"});
63 GetXMLElementInt({
"Hydro",
"CLVisc",
"result_directory"});
65 GetXMLElementInt({
"Hydro",
"CLVisc",
"Perform_CooperFrye_Feezeout"});
66 cfg.
tau0 = GetXMLElementDouble({
"Hydro",
"CLVisc",
"tau0"});
67 cfg.
dt = GetXMLElementDouble({
"Hydro",
"CLVisc",
"dtau"});
68 cfg.
ntskip = GetXMLElementDouble({
"Hydro",
"CLVisc",
"ntau_skip"});
69 cfg.
nxskip = GetXMLElementDouble({
"Hydro",
"CLVisc",
"nx_skip"});
70 cfg.
nyskip = GetXMLElementDouble({
"Hydro",
"CLVisc",
"ny_skip"});
71 cfg.
nzskip = GetXMLElementDouble({
"Hydro",
"CLVisc",
"netas_skip"});
73 cfg.
dx = ini->GetXStep();
74 cfg.
dy = ini->GetYStep();
75 cfg.
dz = ini->GetZStep();
76 cfg.
nx = ini->GetXSize();
77 cfg.
ny = ini->GetYSize();
78 cfg.
nz = ini->GetZSize();
80 hydro_ = std::unique_ptr<clvisc::CLVisc>(
82 initial_condition_scale_factor =
83 GetXMLElementDouble({
"Hydro",
"CLVisc",
"scale_factor"});
88 JSINFO <<
"Initialize density profiles in CLVisc ...";
89 std::vector<double> entropy_density = ini->GetEntropyDensityDistribution();
90 double dx = ini->GetXStep();
91 if (pre_eq_ptr ==
nullptr) {
92 if (initial_condition_scale_factor == 1.0) {
93 hydro_->read_ini(entropy_density);
96 entropy_density.begin(), entropy_density.end(),
97 [&](
double &sd) { sd = initial_condition_scale_factor * sd; });
98 hydro_->read_ini(entropy_density);
101 std::vector<double> vx_, vy_, vz_;
102 for (
size_t idx = 0;
idx < pre_eq_ptr->ux_.size();
idx++) {
103 vx_.push_back(pre_eq_ptr->ux_.at(
idx) / pre_eq_ptr->utau_.at(
idx));
104 vy_.push_back(pre_eq_ptr->uy_.at(
idx) / pre_eq_ptr->utau_.at(
idx));
105 vz_.push_back(pre_eq_ptr->ueta_.at(
idx) / pre_eq_ptr->utau_.at(
idx));
108 hydro_->read_ini(pre_eq_ptr->e_, vx_, vy_, vz_, pre_eq_ptr->pi00_,
109 pre_eq_ptr->pi01_, pre_eq_ptr->pi02_, pre_eq_ptr->pi03_,
110 pre_eq_ptr->pi11_, pre_eq_ptr->pi12_, pre_eq_ptr->pi13_,
111 pre_eq_ptr->pi22_, pre_eq_ptr->pi23_, pre_eq_ptr->pi33_);
116 JSINFO <<
"running CLVisc ...";
120 auto cfg = hydro_->get_config();
121 float tau_min =
cfg.tau0;
123 float dx =
cfg.dx *
cfg.nxskip;
125 float detas =
cfg.dz *
cfg.nzskip;
126 float x_min = -0.5f *
cfg.nx *
cfg.dx;
127 float y_min = -0.5f *
cfg.ny *
cfg.dy;
128 float etas_min = -0.5f *
cfg.nz *
cfg.dz;
129 int nx = int(floor((
cfg.nx - 1) /
cfg.nxskip)) + 1;
130 int ny = int(floor((
cfg.ny - 1) /
cfg.nyskip)) + 1;
131 int netas = int(floor((
cfg.nz - 1) /
cfg.nzskip)) + 1;
133 bulk_info.FromVector(hydro_->bulkinfo_.get_data(),
134 hydro_->bulkinfo_.get_data_info(), tau_min,
dtau,
135 x_min, dx,
nx, y_min,
dy,
ny, etas_min, detas, netas,
139 if (hydro_status ==
FINISHED && doCooperFrye == 1) {
140 JSINFO <<
"Cooper Frye not implemented yet";
146 std::unique_ptr<FluidCellInfo> &fluid_cell_info_ptr) {
147 fluid_cell_info_ptr = make_unique<FluidCellInfo>();
149 throw std::runtime_error(
"Hydro evolution is not finished ");
152 if (!bulk_info.tau_eta_is_tz) {
155 *fluid_cell_info_ptr = bulk_info.get(tau, x, y, eta);
157 *fluid_cell_info_ptr = bulk_info.get(t, x, y, z);