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
fluid_dynamics.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file fluid_dynamics.cc
1
/*******************************************************************************
2
* Copyright (c) The JETSCAPE Collaboration, 2018
3
*
4
* Modular, task-based framework for simulating all aspects of heavy-ion collisions
5
*
6
* For the list of contributors see AUTHORS.
7
*
8
* Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9
*
10
* or via email to bugs.jetscape@gmail.com
11
*
12
* Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13
* See COPYING for details.
14
******************************************************************************/
15
16
#include "
FluidDynamics.h
"
17
#include "
FluidEvolutionHistory.h
"
18
#include "
gtest/gtest.h
"
19
20
using namespace
Jetscape;
21
22
void
test_not_in_range
(
EvolutionHistory
hist
,
real
tau
,
real
x
,
real
y
,
real
eta
) {
23
try
{
24
hist.
CheckInRange
(tau, x, y, eta);
25
}
catch
(
InvalidSpaceTimeRange
&
e
) {
26
auto
estr =
std::string
(e.what());
27
ASSERT_TRUE
(estr.find(
"not in range"
) != estr.npos);
28
}
29
}
30
31
// test EvolutionHistory Class
32
TEST
(EvolutionHistoryTest, TEST_WRITE){
33
auto
hist
=
EvolutionHistory
();
34
hist
.tau_min = 0.6;
35
hist
.dtau = 0.1;
36
hist
.x_min = -10;
37
hist
.y_min = -10;
38
hist
.eta_min = -10;
39
hist
.dx = 0.5;
40
hist
.dy = 0.5;
41
hist
.deta = 0.5;
42
hist
.ntau = 11;
43
hist
.nx = 41;
44
hist
.ny = 41;
45
hist
.neta = 41;
46
hist
.tau_eta_is_tz =
false
;
47
48
EXPECT_EQ
(
hist
.TauMax(),
static_cast<
real
>
(1.6));
49
EXPECT_EQ
(
hist
.XMax(),
static_cast<
real
>
(10.0));
50
EXPECT_EQ
(
hist
.YMax(),
static_cast<
real
>
(10.0));
51
EXPECT_EQ
(
hist
.EtaMax(),
static_cast<
real
>
(10.0));
52
53
// check range test
54
test_not_in_range
(
hist
, 0.5, 0.3, 0.3, 0.3);
55
test_not_in_range
(
hist
, 20.5, 0.3, 0.3, 0.3);
56
test_not_in_range
(
hist
, 10.5, 10.3, 0.3, 0.3);
57
test_not_in_range
(
hist
, 10.5, 10., 10.3, 0.3);
58
test_not_in_range
(
hist
, 10.5, 10., 10., 10.3);
59
60
real
const_ed = 0.8;
61
for
(
int
n
=0;
n
!=
hist
.ntau;
n
++)
62
for
(
int
i
=0;
i
!=
hist
.nx;
i
++)
63
for
(
int
j
=0;
j
!=
hist
.ny;
j
++)
64
for
(
int
k
=0;
k
!=
hist
.neta;
k
++) {
65
auto
cell =
FluidCellInfo
();
66
cell.energy_density = const_ed;
67
hist
.data.emplace_back(
std::move
(cell));
68
}
69
// check almost equal for two float numbers
70
ASSERT_NEAR
(
hist
.get(0.8, 0.0, 0.0, 0.0).energy_density,
static_cast<
real
>
(const_ed), 1.0
E
-6);
71
}
JETSCAPE
blob
main
examples
unittests
fluid_dynamics.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:17
using
1.8.2 with
sPHENIX GitHub integration