Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
562e07ea
Commit
562e07ea
authored
Aug 22, 2016
by
Matthieu Schaller
Browse files
Merge branch 'master' into kill_drift
parents
97cf239b
66c5a34a
Changes
77
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
562e07ea
...
...
@@ -36,6 +36,7 @@ examples/*/*/*.xmf
examples/*/*/*.hdf5
examples/*/*/*.txt
examples/*/*/used_parameters.yml
examples/*/*.png
tests/testPair
tests/brute_force_standard.dat
...
...
@@ -72,7 +73,11 @@ tests/testPair.sh
tests/testPairPerturbed.sh
tests/testParser.sh
tests/testReading.sh
tests/testAdiabaticIndex
tests/testRiemannExact
tests/testRiemannTRRS
tests/testRiemannHLLC
tests/testMatrixInversion
theory/latex/swift.pdf
theory/kernel/kernels.pdf
...
...
configure.ac
View file @
562e07ea
...
...
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Init the project.
AC_INIT([SWIFT],[0.
3
.0])
AC_INIT([SWIFT],[0.
4
.0])
AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE
...
...
@@ -466,7 +466,7 @@ if test "$enable_warn" != "no"; then
# We will do this by hand instead and only default to the macro for unknown compilers
case "$ax_cv_c_compiler_vendor" in
gnu | clang)
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wall
-Wextra -Wno-unused-parameter
"
;;
intel)
CFLAGS="$CFLAGS -w2 -Wunused-variable"
...
...
examples/Disk-Patch/GravityOnly/makeIC.py
View file @
562e07ea
...
...
@@ -110,7 +110,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/Disk-Patch/HydroStatic/makeIC.py
View file @
562e07ea
...
...
@@ -175,6 +175,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
entropy_flag
]
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/Gradients/gradientsCartesian.yml
0 → 100644
View file @
562e07ea
# Define the system of units to use internally.
InternalUnitSystem
:
UnitMass_in_cgs
:
1
# Grams
UnitLength_in_cgs
:
1
# Centimeters
UnitVelocity_in_cgs
:
1
# Centimeters per second
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
# Parameters governing the time integration
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
time_end
:
1e-6
# The end time of the simulation (in internal units).
dt_min
:
1e-6
# The minimal time-step size of the simulation (in internal units).
dt_max
:
1e-6
# The maximal time-step size of the simulation (in internal units).
# Parameters governing the snapshots
Snapshots
:
basename
:
gradients_cartesian
# Common part of the name of output files
time_first
:
0.
# Time of the first output (in internal units)
delta_time
:
5e-7
# Time difference between consecutive outputs (in internal units)
# Parameters governing the conserved quantities statistics
Statistics
:
delta_time
:
1e-6
# Time between statistics output
# Parameters for the hydrodynamics scheme
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours
:
0.1
# The tolerance for the targetted number of neighbours.
max_smoothing_length
:
0.01
# Maximal smoothing length allowed (in internal units).
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
# Parameters related to the initial conditions
InitialConditions
:
file_name
:
./Gradients_cartesian.hdf5
# The file to read
examples/Gradients/gradientsRandom.yml
0 → 100644
View file @
562e07ea
# Define the system of units to use internally.
InternalUnitSystem
:
UnitMass_in_cgs
:
1
# Grams
UnitLength_in_cgs
:
1
# Centimeters
UnitVelocity_in_cgs
:
1
# Centimeters per second
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
# Parameters governing the time integration
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
time_end
:
1e-6
# The end time of the simulation (in internal units).
dt_min
:
1e-6
# The minimal time-step size of the simulation (in internal units).
dt_max
:
1e-6
# The maximal time-step size of the simulation (in internal units).
# Parameters governing the snapshots
Snapshots
:
basename
:
gradients_random
# Common part of the name of output files
time_first
:
0.
# Time of the first output (in internal units)
delta_time
:
5e-7
# Time difference between consecutive outputs (in internal units)
# Parameters governing the conserved quantities statistics
Statistics
:
delta_time
:
1e-6
# Time between statistics output
# Parameters for the hydrodynamics scheme
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours
:
0.1
# The tolerance for the targetted number of neighbours.
max_smoothing_length
:
0.01
# Maximal smoothing length allowed (in internal units).
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
# Parameters related to the initial conditions
InitialConditions
:
file_name
:
./Gradients_random.hdf5
# The file to read
examples/Gradients/gradientsStretched.yml
0 → 100644
View file @
562e07ea
# Define the system of units to use internally.
InternalUnitSystem
:
UnitMass_in_cgs
:
1
# Grams
UnitLength_in_cgs
:
1
# Centimeters
UnitVelocity_in_cgs
:
1
# Centimeters per second
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
# Parameters governing the time integration
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
time_end
:
1e-6
# The end time of the simulation (in internal units).
dt_min
:
1e-6
# The minimal time-step size of the simulation (in internal units).
dt_max
:
1e-6
# The maximal time-step size of the simulation (in internal units).
# Parameters governing the snapshots
Snapshots
:
basename
:
gradients_stretched
# Common part of the name of output files
time_first
:
0.
# Time of the first output (in internal units)
delta_time
:
5e-7
# Time difference between consecutive outputs (in internal units)
# Parameters governing the conserved quantities statistics
Statistics
:
delta_time
:
1e-6
# Time between statistics output
# Parameters for the hydrodynamics scheme
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours
:
0.1
# The tolerance for the targetted number of neighbours.
max_smoothing_length
:
0.01
# Maximal smoothing length allowed (in internal units).
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
# Parameters related to the initial conditions
InitialConditions
:
file_name
:
./Gradients_stretched.hdf5
# The file to read
examples/Gradients/makeICs.py
0 → 100644
View file @
562e07ea
################################################################################
# This file is part of SWIFT.
# Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
import
h5py
import
random
import
numpy
as
np
import
sys
# Generates a swift IC file with some density gradients, to check the gradient
# reconstruction
# Parameters
periodic
=
1
# 1 For periodic box
gamma
=
5.
/
3.
# Gas adiabatic index
gridtype
=
"cartesian"
if
len
(
sys
.
argv
)
>
1
:
gridtype
=
sys
.
argv
[
1
]
# stretched cartesian box ######################################################
if
gridtype
==
"stretched"
:
fileName
=
"Gradients_stretched.hdf5"
factor
=
8
boxSize
=
[
1.0
,
1.0
/
factor
,
1.0
/
factor
]
L
=
20
nx1
=
factor
*
L
/
2
ny1
=
L
nz1
=
L
numfac
=
2.
nx2
=
int
(
nx1
/
numfac
)
ny2
=
int
(
ny1
/
numfac
)
nz2
=
int
(
nz1
/
numfac
)
npart
=
nx1
*
ny1
*
nz1
+
nx2
*
ny2
*
nz2
vol
=
boxSize
[
0
]
*
boxSize
[
1
]
*
boxSize
[
2
]
partVol1
=
0.5
*
vol
/
(
nx1
*
ny1
*
nz1
)
partVol2
=
0.5
*
vol
/
(
nx2
*
ny2
*
nz2
)
coords
=
np
.
zeros
((
npart
,
3
))
h
=
np
.
zeros
((
npart
,
1
))
ids
=
np
.
zeros
((
npart
,
1
),
dtype
=
'L'
)
idx
=
0
dcell
=
0.5
/
nx1
for
i
in
range
(
nx1
):
for
j
in
range
(
ny1
):
for
k
in
range
(
nz1
):
coords
[
idx
,
0
]
=
(
i
+
0.5
)
*
dcell
coords
[
idx
,
1
]
=
(
j
+
0.5
)
*
dcell
coords
[
idx
,
2
]
=
(
k
+
0.5
)
*
dcell
h
[
idx
]
=
0.56
/
nx1
ids
[
idx
]
=
idx
idx
+=
1
dcell
=
0.5
/
nx2
for
i
in
range
(
nx2
):
for
j
in
range
(
ny2
):
for
k
in
range
(
nz2
):
coords
[
idx
,
0
]
=
0.5
+
(
i
+
0.5
)
*
dcell
coords
[
idx
,
1
]
=
(
j
+
0.5
)
*
dcell
coords
[
idx
,
2
]
=
(
k
+
0.5
)
*
dcell
h
[
idx
]
=
0.56
/
nx2
ids
[
idx
]
=
idx
idx
+=
1
# cartesian box ################################################################
if
gridtype
==
"cartesian"
:
fileName
=
"Gradients_cartesian.hdf5"
boxSize
=
[
1.0
,
1.0
,
1.0
]
nx
=
20
npart
=
nx
**
3
partVol
=
1.
/
npart
coords
=
np
.
zeros
((
npart
,
3
))
h
=
np
.
zeros
((
npart
,
1
))
ids
=
np
.
zeros
((
npart
,
1
),
dtype
=
'L'
)
idx
=
0
dcell
=
1.
/
nx
for
i
in
range
(
nx
):
for
j
in
range
(
nx
):
for
k
in
range
(
nx
):
coords
[
idx
,
0
]
=
(
i
+
0.5
)
*
dcell
coords
[
idx
,
1
]
=
(
j
+
0.5
)
*
dcell
coords
[
idx
,
2
]
=
(
k
+
0.5
)
*
dcell
h
[
idx
]
=
1.12
/
nx
ids
[
idx
]
=
idx
idx
+=
1
# random box ###################################################################
if
gridtype
==
"random"
:
fileName
=
"Gradients_random.hdf5"
boxSize
=
[
1.0
,
1.0
,
1.0
]
glass
=
h5py
.
File
(
"../Glass/glass_50000.hdf5"
,
"r"
)
coords
=
np
.
array
(
glass
[
"/PartType0/Coordinates"
])
npart
=
len
(
coords
)
partVol
=
1.
/
npart
h
=
np
.
zeros
((
npart
,
1
))
ids
=
np
.
zeros
((
npart
,
1
),
dtype
=
'L'
)
for
i
in
range
(
npart
):
h
[
i
]
=
0.019
ids
[
i
]
=
i
v
=
np
.
zeros
((
npart
,
3
))
m
=
np
.
zeros
((
npart
,
1
))
rho
=
np
.
zeros
((
npart
,
1
))
u
=
np
.
zeros
((
npart
,
1
))
for
i
in
range
(
npart
):
rhox
=
coords
[
i
,
0
]
if
coords
[
i
,
0
]
<
0.75
:
rhox
=
0.75
if
coords
[
i
,
0
]
<
0.25
:
rhox
=
1.
-
coords
[
i
,
0
]
rhoy
=
1.
+
boxSize
[
1
]
-
coords
[
i
,
1
]
if
coords
[
i
,
1
]
<
0.75
*
boxSize
[
1
]:
rhoy
=
1.
+
0.25
*
boxSize
[
1
]
if
coords
[
i
,
1
]
<
0.25
*
boxSize
[
1
]:
rhoy
=
1.
+
coords
[
i
,
1
]
rhoz
=
1.
rho
[
i
]
=
rhox
+
rhoy
+
rhoz
P
=
1.
u
[
i
]
=
P
/
((
gamma
-
1.
)
*
rho
[
i
])
if
gridtype
==
"stretched"
:
if
coords
[
i
,
0
]
<
0.5
:
m
[
i
]
=
rho
[
i
]
*
partVol1
else
:
m
[
i
]
=
rho
[
i
]
*
partVol2
else
:
m
[
i
]
=
rho
[
i
]
*
partVol
#File
file
=
h5py
.
File
(
fileName
,
'w'
)
# Header
grp
=
file
.
create_group
(
"/Header"
)
grp
.
attrs
[
"BoxSize"
]
=
boxSize
grp
.
attrs
[
"NumPart_Total"
]
=
[
npart
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"NumPart_Total_HighWord"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"NumPart_ThisFile"
]
=
[
npart
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Time"
]
=
0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
grp
.
attrs
[
"PeriodicBoundariesOn"
]
=
periodic
#Particle group
grp
=
file
.
create_group
(
"/PartType0"
)
ds
=
grp
.
create_dataset
(
'Coordinates'
,
(
npart
,
3
),
'd'
)
ds
[()]
=
coords
ds
=
grp
.
create_dataset
(
'Velocities'
,
(
npart
,
3
),
'f'
)
ds
[()]
=
v
ds
=
grp
.
create_dataset
(
'Masses'
,
(
npart
,
1
),
'f'
)
ds
[()]
=
m
ds
=
grp
.
create_dataset
(
'Density'
,
(
npart
,
1
),
'd'
)
ds
[()]
=
rho
ds
=
grp
.
create_dataset
(
'SmoothingLength'
,
(
npart
,
1
),
'f'
)
ds
[()]
=
h
ds
=
grp
.
create_dataset
(
'InternalEnergy'
,
(
npart
,
1
),
'd'
)
ds
[()]
=
u
ds
=
grp
.
create_dataset
(
'ParticleIDs'
,
(
npart
,
1
),
'L'
)
ds
[()]
=
ids
[:]
file
.
close
()
examples/Gradients/plot.py
0 → 100644
View file @
562e07ea
################################################################################
# This file is part of SWIFT.
# Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
import
scipy
as
sp
import
pylab
as
pl
import
numpy
as
np
import
h5py
import
sys
# this file plots the gradients of the density in the x and y direction for
# the given input file and saves the result as gradiens_NAME.png
inputfile
=
sys
.
argv
[
1
]
outputfile
=
"gradients_{0}.png"
.
format
(
sys
.
argv
[
2
])
f
=
h5py
.
File
(
inputfile
,
"r"
)
rho
=
np
.
array
(
f
[
"/PartType0/Density"
])
gradrho
=
np
.
array
(
f
[
"/PartType0/GradDensity"
])
coords
=
np
.
array
(
f
[
"/PartType0/Coordinates"
])
fig
,
ax
=
pl
.
subplots
(
1
,
2
,
sharey
=
True
)
ax
[
0
].
plot
(
coords
[:,
0
],
rho
,
"r."
,
label
=
"density"
)
ax
[
0
].
plot
(
coords
[:,
0
],
gradrho
[:,
0
],
"b."
,
label
=
"grad density x"
)
ax
[
0
].
set_xlabel
(
"x"
)
ax
[
0
].
legend
(
loc
=
"best"
)
ax
[
1
].
plot
(
coords
[:,
1
],
rho
,
"r."
,
label
=
"density"
)
ax
[
1
].
plot
(
coords
[:,
1
],
gradrho
[:,
1
],
"b."
,
label
=
"grad density y"
)
ax
[
1
].
set_xlabel
(
"y"
)
ax
[
1
].
legend
(
loc
=
"best"
)
pl
.
tight_layout
()
pl
.
savefig
(
outputfile
)
examples/Gradients/run.sh
0 → 100755
View file @
562e07ea
#! /bin/bash
python makeICs.py stretched
../swift
-s
-t
2 gradientsStretched.yml
python plot.py gradients_stretched_001.hdf5 stretched
python makeICs.py cartesian
../swift
-s
-t
2 gradientsCartesian.yml
python plot.py gradients_cartesian_001.hdf5 cartesian
python makeICs.py random
../swift
-s
-t
2 gradientsRandom.yml
python plot.py gradients_random_001.hdf5 random
examples/main.c
View file @
562e07ea
...
...
@@ -273,18 +273,6 @@ int main(int argc, char *argv[]) {
message
(
"sizeof(struct cell) is %4zi bytes."
,
sizeof
(
struct
cell
));
}
/* Temporary abort to handle absence of vectorized functions */
#ifdef WITH_VECTORIZATION
#ifdef MINIMAL_SPH
error
(
"Vectorized version of Minimal SPH routines not implemented yet. "
"Reconfigure with --disable-vec and recompile or use DEFAULT_SPH."
);
#endif
#endif
/* End temporary fix */
/* How vocal are we ? */
const
int
talking
=
(
verbose
==
1
&&
myrank
==
0
)
||
(
verbose
==
2
);
...
...
@@ -487,6 +475,8 @@ int main(int argc, char *argv[]) {
#endif
if
(
myrank
==
0
)
message
(
"Time integration ready to start. End of dry-run."
);
engine_clean
(
&
e
);
free
(
params
);
return
0
;
}
...
...
@@ -553,7 +543,7 @@ int main(int argc, char *argv[]) {
if
(
!
e
.
sched
.
tasks
[
l
].
skip
&&
!
e
.
sched
.
tasks
[
l
].
implicit
)
{
fprintf
(
file_thread
,
" %03i %i %i %i %i %lli %lli %i %i %i %i %i
\n
"
,
myrank
,
e
.
sched
.
tasks
[
l
].
last_
rid
,
e
.
sched
.
tasks
[
l
].
type
,
myrank
,
e
.
sched
.
tasks
[
l
].
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
subtype
,
(
e
.
sched
.
tasks
[
l
].
cj
==
NULL
),
e
.
sched
.
tasks
[
l
].
tic
,
e
.
sched
.
tasks
[
l
].
toc
,
(
e
.
sched
.
tasks
[
l
].
ci
!=
NULL
)
?
e
.
sched
.
tasks
[
l
].
ci
->
count
...
...
@@ -589,7 +579,7 @@ int main(int argc, char *argv[]) {
if
(
!
e
.
sched
.
tasks
[
l
].
skip
&&
!
e
.
sched
.
tasks
[
l
].
implicit
)
fprintf
(
file_thread
,
" %i %i %i %i %lli %lli %i %i %i %i
\n
"
,
e
.
sched
.
tasks
[
l
].
last_
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
subtype
,
(
e
.
sched
.
tasks
[
l
].
cj
==
NULL
),
e
.
sched
.
tasks
[
l
].
tic
,
e
.
sched
.
tasks
[
l
].
toc
,
(
e
.
sched
.
tasks
[
l
].
ci
==
NULL
)
?
0
:
e
.
sched
.
tasks
[
l
].
ci
->
count
,
...
...
examples/plot_tasks.py
View file @
562e07ea
...
...
@@ -56,9 +56,8 @@ pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES
=
[
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub_self"
,
"sub_pair"
,
"init"
,
"ghost"
,
"drift"
,
"kick"
,
"kick_fixdt"
,
"send"
,
"recv"
,
"grav_gather_m"
,
"grav_fft"
,
"grav_mm"
,
"grav_up"
,
"grav_external"
,
"part_sort"
,
"gpart_sort"
,
"split_cell"
,
"rewait"
,
"count"
]
"kick"
,
"kick_fixdt"
,
"send"
,
"recv"
,
"grav_gather_m"
,
"grav_fft"
,
"grav_mm"
,
"grav_up"
,
"grav_external"
,
"count"
]
TASKCOLOURS
=
{
"none"
:
"black"
,
"sort"
:
"lightblue"
,
...
...
@@ -68,7 +67,6 @@ TASKCOLOURS = {"none": "black",
"sub_pair"
:
"navy"
,
"init"
:
"indigo"
,
"ghost"
:
"cyan"
,
"drift"
:
"maroon"
,
"kick"
:
"green"
,
"kick_fixdt"
:
"green"
,
"send"
:
"yellow"
,
...
...
@@ -78,20 +76,17 @@ TASKCOLOURS = {"none": "black",
"grav_mm"
:
"mediumturquoise"
,
"grav_up"
:
"mediumvioletred"
,
"grav_external"
:
"darkred"
,
"part_sort"
:
"steelblue"
,
"gpart_sort"
:
"teal"
,
"split_cell"
:
"seagreen"
,
"rewait"
:
"olive"
,
"count"
:
"powerblue"
}
SUBTYPES
=
[
"none"
,
"density"
,
"force"
,
"grav"
,
"tend"
,
"count"
]
SUBTYPES
=
[
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"tend"
,
"count"
]
SUBCOLOURS
=
{
"none"
:
"black"
,
"density"
:
"red"
,
"gradient"
:
"powerblue"
,
"force"
:
"blue"
,
"grav"
:
"indigo"
,
"tend"
:
"grey"
"count"
:
"
purple
"
}
"tend"
:
"grey"
,
"count"
:
"
black
"
}
# Show docs if help is requested.
if
len
(
sys
.
argv
)
==
2
and
(
sys
.
argv
[
1
][
0
:
2
]
==
"-h"
or
sys
.
argv
[
1
][
0
:
3
]
==
"--h"
):
...
...
examples/plot_tasks_MPI.py
View file @
562e07ea
...
...
@@ -62,9 +62,8 @@ pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES
=
[
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub_self"
,
"sub_pair"
,
"init"
,
"ghost"
,
"drift"
,
"kick"
,
"kick_fixdt"
,
"send"
,
"recv"
,
"grav_gather_m"
,
"grav_fft"
,
"grav_mm"
,
"grav_up"
,
"grav_external"
,
"part_sort"
,
"gpart_sort"
,
"split_cell"
,
"rewait"
,
"count"
]
"kick"
,
"kick_fixdt"
,
"send"
,
"recv"
,
"grav_gather_m"
,
"grav_fft"
,
"grav_mm"
,
"grav_up"
,
"grav_external"
,
"count"
]
TASKCOLOURS
=
{
"none"
:
"black"
,
"sort"
:
"lightblue"
,
...
...
@@ -74,7 +73,6 @@ TASKCOLOURS = {"none": "black",
"sub_pair"
:
"navy"
,
"init"
:
"indigo"
,
"ghost"
:
"cyan"
,
"drift"
:
"maroon"
,
"kick"
:
"green"
,
"kick_fixdt"
:
"green"
,
"send"
:
"yellow"
,
...
...
@@ -84,20 +82,17 @@ TASKCOLOURS = {"none": "black",
"grav_mm"
:
"mediumturquoise"
,
"grav_up"
:
"mediumvioletred"
,
"grav_external"
:
"darkred"
,
"part_sort"
:
"steelblue"
,
"gpart_sort"
:
"teal"
,
"split_cell"
:
"seagreen"
,
"rewait"
:
"olive"
,
"count"
:
"powerblue"
}
SUBTYPES
=
[
"none"
,
"density"
,
"force"
,
"grav"
,
"tend"
,
"count"
]
SUBTYPES
=
[
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"tend"
,
"count"
]
SUBCOLOURS
=
{
"none"
:
"black"
,
"density"
:
"red"
,
"gradient"
:
"powerblue"
,
"force"
:
"blue"
,
"grav"
:
"indigo"
,
"tend"
:
"grey"
"count"
:
"
purple
"
}
"tend"
:
"grey"
,
"count"
:
"
black
"
}
# Show docs if help is requested.
if
len
(
sys
.
argv
)
==
2
and
(
sys
.
argv
[
1
][
0
:
2
]
==
"-h"
or
sys
.
argv
[
1
][
0
:
3
]
==
"--h"
):
...
...
src/adiabatic_index.h
View file @
562e07ea
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
* Bert Vandenbroucke (bert.vandenbroucke@gmail.com).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
...
...
@@ -34,6 +35,7 @@
/* Local headers. */
#include
"const.h"
#include
"debug.h"
#include
"error.h"
#include
"inline.h"
/* First define some constants */
...
...
@@ -42,18 +44,56 @@
#define hydro_gamma 1.66666666666666667f
#define hydro_gamma_minus_one 0.66666666666666667f
#define hydro_one_over_gamma_minus_one 1.5f
#define hydro_gamma_plus_one_over_two_gamma 0.8f
#define hydro_gamma_minus_one_over_two_gamma 0.2f
#define hydro_gamma_minus_one_over_gamma_plus_one 0.25f
#define hydro_two_over_gamma_plus_one 0.75f
#define hydro_two_over_gamma_minus_one 3.f
#define hydro_gamma_minus_one_over_two 0.33333333333333333f
#define hydro_two_gamma_over_gamma_minus_one 5.f
#define hydro_one_over_gamma 0.6f
#elif defined(HYDRO_GAMMA_7_5)
#define hydro_gamma 1.4f
#define hydro_gamma_minus_one 0.4f
#define hydro_one_over_gamma_minus_one 2.5f
#define hydro_gamma_plus_one_over_two_gamma 0.857142857f
#define hydro_gamma_minus_one_over_two_gamma 0.142857143f
#define hydro_gamma_minus_one_over_gamma_plus_one 0.166666667f
#define hydro_two_over_gamma_plus_one 0.833333333
#define hydro_two_over_gamma_minus_one 5.f
#define hydro_gamma_minus_one_over_two 0.2f
#define hydro_two_gamma_over_gamma_minus_one 7.f
#define hydro_one_over_gamma 0.714285714f
#elif defined(HYDRO_GAMMA_4_3)
#define hydro_gamma 1.33333333333333333f
#define hydro_gamma_minus_one 0.33333333333333333f
#define hydro_one_over_gamma_minus_one 3.f
#define hydro_gamma_plus_one_over_two_gamma 0.875f
#define hydro_gamma_minus_one_over_two_gamma 0.125f
#define hydro_gamma_minus_one_over_gamma_plus_one 0.142857143f
#define hydro_two_over_gamma_plus_one 0.857142857f
#define hydro_two_over_gamma_minus_one 6.f
#define hydro_gamma_minus_one_over_two 0.166666666666666666f
#define hydro_two_gamma_over_gamma_minus_one 8.f
#define hydro_one_over_gamma 0.75f
#elif defined(HYDRO_GAMMA_2_1)
#define hydro_gamma 2.f
#define hydro_gamma_minus_one 1.f