Skip to content

Commit

Permalink
Fixed errors in hydro_source_Tmunu.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
akberovic committed Sep 17, 2024
1 parent 5414c5a commit eb4b3a8
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 24 deletions.
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
57 changes: 57 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp"
},
"C_Cpp.errorSquiggles": "disabled"
}
48 changes: 48 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/g++"
},
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
Binary file added dNchdeta2.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions input.default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EndOfData
119 changes: 95 additions & 24 deletions src/hydro_source_Tmunu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstdlib>
#include <vector>
#include <array>
#include <omp.h> // Include for OpenMP

using Util::hbarc;

Expand Down Expand Up @@ -41,33 +42,103 @@ void HydroSourceTmunu::readIPGevent() {
DATA.ny, std::vector<std::array<double, 10>>(DATA.neta)));

std::string line;
double tau0 = DATA.tau0;
std::ifstream profile(DATA.initName.c_str()); // Fixed the ifstream

std::string dummy;
// read the information line
std::getline(profile, dummy);

const int nx = DATA.nx; // Changed to correct variable from DATA
const int ny = DATA.ny; // Changed to correct variable from DATA
std::vector<double> temp_profile_ed(nx * ny, 0.0);
std::vector<double> temp_profile_utau(nx * ny, 0.0);
std::vector<double> temp_profile_ux(nx * ny, 0.0);
std::vector<double> temp_profile_uy(nx * ny, 0.0);
std::vector<double> temp_profile_ueta(nx * ny, 0.0);
std::vector<double> temp_profile_pitautau(nx * ny, 0.0);
std::vector<double> temp_profile_pitaux(nx * ny, 0.0);
std::vector<double> temp_profile_pitauy(nx * ny, 0.0);
std::vector<double> temp_profile_pitaueta(nx * ny, 0.0);
std::vector<double> temp_profile_pixx(nx * ny, 0.0);
std::vector<double> temp_profile_pixy(nx * ny, 0.0);
std::vector<double> temp_profile_pixeta(nx * ny, 0.0);
std::vector<double> temp_profile_piyy(nx * ny, 0.0);
std::vector<double> temp_profile_piyeta(nx * ny, 0.0);
std::vector<double> temp_profile_pietaeta(nx * ny, 0.0);

// Step2: Reading IP-Glasma data
int ix, iy, ieta;
double pitautau, pitaux, pitauy, pitaueta;
double pixx*DATA.sFactor, pixy*DATA.sFactor, pixeta*DATA.sFactor, piyy*DATA.sFactor, piyeta*DATA.sFactor, pietaeta*DATA.sFactor;
double e*DATA.sFactor/hbarc, utau, ux, uy, ueta;
double tau = DATA.tau0;

while (std::getline(IPGinputFile, line)) {
std::istringstream iss(line);

iss >> ix >> iy >> ieta >> e >> utau >> ux >> uy >> ueta
>> pitautau >> pitaux >> pitauy >> pitaueta
>> pixx*DATA.sFactor >> pixy >> pixeta >> piyy >> piyeta >> pietaeta;


ueta = ueta * tau;


pitaueta *= tau;
pietaeta *= tau * tau*Data.sFactor;
pixeta *= tau*Data.sFactor;
piyeta *= tau*Data.sFactor;

energy_density_[ix][iy][ieta] = e;
velocity_[ix][iy][ieta] = {utau, ux, uy, ueta};
shear_tensor_[ix][iy][ieta] = {pitautau, pitaux, pitauy, pitaueta*tau*Data.sFactor,
pixx*DATA.sFactor, pixy*DATA.sFactor, pixeta*DATA.sFactor, piyy*DATA.sFactor, piyeta*DATA.sFactor, pietaeta}; //multiply Data.sFactor
double e, utau, ux, uy, ueta;
double density, dummy1, dummy2, dummy3;
double pixx, pixy, pixeta, piyy, piyeta, pietaeta, pitautau, pitaux, pitauy, pitaueta;

for (ix = 0; ix < nx; ix++) {
for (iy = 0; iy < ny; iy++) {
int idx = iy + ix * ny;
std::getline(profile, dummy);
std::stringstream ss(dummy); // Fixed the issue with ss and iss
ss >> ix >> iy >> ieta >> e >> utau >> ux >> uy >> ueta
>> pitautau >> pitaux >> pitauy >> pitaueta
>> pixx >> pixy >> pixeta >> piyy >> piyeta >> pietaeta;

ueta = ueta * tau0;
temp_profile_ed[idx] = density * DATA.sFactor / hbarc; // 1/fm^4
temp_profile_ux[idx] = ux;
temp_profile_uy[idx] = uy;
temp_profile_ueta[idx] = ueta;
temp_profile_utau[idx] = sqrt(1. + ux * ux + uy * uy + ueta * ueta);

// Viscous components already in 1/fm^4 from the IP-Glasma output
double visFactor = DATA.sFactor * DATA.preEqVisFactor;
temp_profile_pixx[idx] = pixx * visFactor;
temp_profile_pixy[idx] = pixy * visFactor;
temp_profile_pixeta[idx] = pixeta * tau0 * visFactor;
temp_profile_piyy[idx] = piyy * visFactor;
temp_profile_piyeta[idx] = piyeta * tau0 * visFactor;

utau = temp_profile_utau[idx];
temp_profile_pietaeta[idx] = (
(2. * (ux * uy * temp_profile_pixy[idx]
+ ux * ueta * temp_profile_pixeta[idx]
+ uy * ueta * temp_profile_piyeta[idx])
- (utau * utau - ux * ux) * temp_profile_pixx[idx]
- (utau * utau - uy * uy) * temp_profile_piyy[idx])
/ (utau * utau - ueta * ueta));
temp_profile_pitaux[idx] = (1. / utau
* (temp_profile_pixx[idx] * ux
+ temp_profile_pixy[idx] * uy
+ temp_profile_pixeta[idx] * ueta));
temp_profile_pitauy[idx] = (1. / utau
* (temp_profile_pixy[idx] * ux
+ temp_profile_piyy[idx] * uy
+ temp_profile_piyeta[idx] * ueta));
temp_profile_pitaueta[idx] = (1. / utau
* (temp_profile_pixeta[idx] * ux
+ temp_profile_piyeta[idx] * uy
+ temp_profile_pietaeta[idx] * ueta));
temp_profile_pitautau[idx] = (1. / utau
* (temp_profile_pitaux[idx] * ux
+ temp_profile_pitauy[idx] * uy
+ temp_profile_pitaueta[idx] * ueta));

if (ix == 0 && iy == 0) {
DATA.x_size = -dummy2 * 2;
DATA.y_size = -dummy3 * 2;
if (omp_get_thread_num() == 0) {
music_message << "eta_size=" << DATA.eta_size
<< ", x_size=" << DATA.x_size
<< ", y_size=" << DATA.y_size;
music_message.flush("info");
}
}
}

// Store the data in the containers
double tau = DATA.tau0; // Fixed tau declaration
shear_tensor_[ix][iy][ieta] = {pitautau, pitaux, pitauy, pitaueta * tau * DATA.sFactor,
pixx * DATA.sFactor, pixy * DATA.sFactor, pixeta * DATA.sFactor, piyy * DATA.sFactor, piyeta * DATA.sFactor, pietaeta}; // multiply by DATA.sFactor
}

IPGinputFile.close();
Expand Down

0 comments on commit eb4b3a8

Please sign in to comment.