Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
clideal.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file clideal.h
1
/*******************************************************************************
2
* Copyright (c) 2018-2019 LongGang Pang, lgpang@qq.com
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and/or associated documentation files (the
6
* "Materials"), to deal in the Materials without restriction, including
7
* without limitation the rights to use, copy, modify, merge, publish,
8
* distribute, sublicense, and/or sell copies of the Materials, and to
9
* permit persons to whom the Materials are furnished to do so, subject to
10
* the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be included
13
* in all copies or substantial portions of the Materials.
14
*
15
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22
******************************************************************************/
23
24
25
#ifndef __CL_IDEAL__
26
#define __CL_IDEAL__
27
28
#define __CL_ENABLE_EXCEPTIONS
29
// System includes
30
//#include <CL/cl.hpp>
31
#include <cstdlib>
32
#include <cstdio>
33
#include <string>
34
#include <vector>
35
#include <cmath>
36
#include <iostream>
37
#include <fstream>
38
#include <sstream>
39
#include <cassert>
40
#include <ctime>
41
#include <algorithm>
42
#include <map>
43
44
#include <random>
45
46
#include "
Config.h
"
47
#include "
opencl_backend.h
"
48
49
namespace
clvisc {
50
51
typedef
struct
52
{
53
int
block_size
;
// num of threads along one dim on gpu
54
int
nx
;
// number of grids along x
55
int
ny
;
// number of grids along y
56
int
nz
;
// number of grids along etas
57
double
tau0
;
// initial thermalization time
58
double
dt
;
// time step
59
float
dx
;
// x step
60
float
dy
;
// y step
61
float
dz
;
// etas step
62
float
etaos_xmin
;
// parameterized eta/s (T for minimum etaos)
63
float
etaos_ymin
;
// parameterized eta/s (minumum etaos)
64
float
etaos_left_slop
;
// parameterized eta/s (left slop)
65
float
etaos_right_slop
;
// parameterized eta/s (left slop)
66
int
ntskip
;
// number of grids to skip for output along tau
67
int
nxskip
;
// number of grids to skip for output along x
68
int
nyskip
;
// number of grids to skip for output along y
69
int
nzskip
;
// number of grids to skip for output along etas
70
std::string
result_directory
;
71
}
Config
;
72
75
class
CLIdeal
76
{
77
private
:
78
// initial starting time
79
double
tau0_
;
80
// time for the current time step
81
double
tau_
;
82
Config
cfg_
;
83
OpenclBackend
backend_
;
84
85
std::string
compile_option_
;
86
// d_submax is used to compute the maximum
87
// energy density of the fluctuating QGP
88
cl::Buffer
d_submax_
;
89
90
// stores the maximum energy density history
91
std::vector<cl_real>
max_ed_history_
;
92
93
cl::Kernel
kernel_kt_src_christoffel_
;
94
cl::Kernel
kernel_kt_src_alongx_
;
95
cl::Kernel
kernel_kt_src_alongy_
;
96
cl::Kernel
kernel_kt_src_alongz_
;
97
cl::Kernel
kernel_update_ev_
;
98
cl::Kernel
kernel_reduction_
;
99
100
void
read_eos_table_
(
std::string
fname
,
CompileOption
&opts_);
101
102
void
initialize_gpu_buffer_
();
103
104
// update half step using Runge-Kutta method, step = {1, 2}
105
void
half_step_
(
int
step
);
106
107
public
:
108
// h_ev_, d_ev_, eos_table_ will be used in class CLVisc
109
// it would be good to make them public
110
std::vector<cl_real4>
h_ev_
;
111
cl::Buffer
d_ev_
[3];
112
cl::Buffer
d_src_
;
113
// image2d_t for eos_table
114
cl::Image2D
eos_table_
;
115
116
CLIdeal
(
const
Config
&
cfg
,
std::string
device_type,
int
device_id);
117
118
inline
const
Config
&
get_config
() {
return
cfg_
;}
119
120
// read initial energy density from external vector
121
template
<
typename
ValueType>
122
void
read_ini
(
const
std::vector<ValueType> & ed);
123
124
// read initial ed, vx, vy, vz vector
125
template
<
typename
ValueType>
126
void
read_ini
(
const
std::vector<ValueType> & ed,
127
const
std::vector<ValueType> &
vx
,
128
const
std::vector<ValueType> &
vy
,
129
const
std::vector<ValueType> &
vz
);
130
131
// run hydrodynamic evolution for one time step
132
void
one_step
();
133
134
// predict the first step to get u^{mu} for viscous hydro
135
void
predict_first_step
();
136
137
// return the maximum energy density,
138
float
max_energy_density
();
139
140
// run hydrodynamic evolution for all time steps
141
// stop when max_T < freeze_out_temperature
142
void
evolve
();
143
144
OpenclBackend
&
get_backend
();
145
std::string
&
get_compile_option
();
146
147
~CLIdeal
();
148
149
};
150
151
}
// end namespace clvisc
152
153
#endif
154
155
JETSCAPE
blob
main
external_packages
clvisc_wrapper
include
clideal.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:18
using
1.8.2 with
sPHENIX GitHub integration