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
test_visc.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file test_visc.cc
1
#include "
include/opencl_backend.h
"
2
#include "
include/clideal.h
"
3
#include "
include/clvisc.h
"
4
#include <iostream>
5
6
clvisc::Config
set_hydro_config
() {
7
clvisc::Config
cfg
;
8
cfg.
block_size
= 64;
9
cfg.
nx
= 200;
10
cfg.
ny
= 200;
11
cfg.
nz
= 1;
12
cfg.
nxskip
= 2;
13
cfg.
nyskip
= 2;
14
cfg.
nzskip
= 2;
15
cfg.
tau0
= 0.6;
16
cfg.
dt
= 0.02;
17
cfg.
dx
= 0.16;
18
cfg.
dy
= 0.16;
19
cfg.
dz
= 0.16;
20
cfg.
etaos_xmin
= 0.15;
21
cfg.
etaos_ymin
= 0.15;
22
cfg.
etaos_left_slop
= 0.0;
23
cfg.
etaos_right_slop
= 0.0;
24
cfg.
result_directory
=
"./"
;
25
return
cfg
;
26
}
27
28
29
std::vector<clvisc::cl_real>
trivial_initial_condition
(
const
clvisc::Config
&
cfg
) {
30
std::vector<clvisc::cl_real> ini;
31
long
ngrids = cfg.
nx
* cfg.
ny
* cfg.
nz
;
32
ini.reserve(ngrids);
33
for
(
long
idx
= 0;
idx
< ngrids;
idx
++) {
34
clvisc::cl_real
const_ed = 30.0f;
35
ini.push_back(const_ed);
36
}
37
return
ini;
38
}
39
40
int
main
(
int
argc,
char
** argv) {
41
auto
backend0 =
clvisc::OpenclBackend
(
"cpu"
, 0);
42
backend0.DeviceInfo();
43
44
auto
backend1 =
clvisc::OpenclBackend
(
"gpu"
, 1);
45
backend1.DeviceInfo();
46
47
auto
cfg
=
set_hydro_config
();
48
std::string
device_type =
"gpu"
;
49
int
device_id = 1;
50
clvisc::CLVisc
visc(
cfg
, device_type, device_id);
51
auto
ini =
trivial_initial_condition
(
cfg
);
52
visc.
read_ini
(ini);
53
visc.
evolve
();
54
return
0;
55
}
JETSCAPE
blob
main
external_packages
clvisc_wrapper
test_visc.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:18
using
1.8.2 with
sPHENIX GitHub integration