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
c90ffa87
Commit
c90ffa87
authored
Dec 15, 2017
by
Peter W. Draper
Browse files
Merge branch 'gravity_fixes' into 'master'
Correct wrapping of multipoles in FFT task See merge request
!433
parents
55e98e2f
a81a55d2
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/EAGLE_12/eagle_12.yml
View file @
c90ffa87
...
...
@@ -27,7 +27,7 @@ Statistics:
Gravity
:
eta
:
0.025
# Constant dimensionless multiplier for time integration.
epsilon
:
0.001
# Softening length (in internal units).
theta
:
0.
7
# Opening angle (Multipole acceptance criterion)
theta
:
0.
85
# Opening angle (Multipole acceptance criterion)
# Parameters for the hydrodynamics scheme
SPH
:
...
...
examples/EAGLE_25/eagle_25.yml
View file @
c90ffa87
...
...
@@ -13,6 +13,9 @@ TimeIntegration:
dt_min
:
1e-10
# The minimal time-step size of the simulation (in internal units).
dt_max
:
1e-4
# The maximal time-step size of the simulation (in internal units).
Scheduler
:
max_top_level_cells
:
20
# Parameters governing the snapshots
Snapshots
:
basename
:
eagle
# Common part of the name of output files
...
...
@@ -26,8 +29,8 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity
:
eta
:
0.025
# Constant dimensionless multiplier for time integration.
epsilon
:
0.00
0
1
# Softening length (in internal units).
theta
:
0.
7
# Opening angle (Multipole acceptance criterion)
epsilon
:
0.001
# Softening length (in internal units).
theta
:
0.
85
# Opening angle (Multipole acceptance criterion)
# Parameters for the hydrodynamics scheme
SPH
:
...
...
examples/EAGLE_50/eagle_50.yml
View file @
c90ffa87
...
...
@@ -26,8 +26,8 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity
:
eta
:
0.025
# Constant dimensionless multiplier for time integration.
epsilon
:
0.00
0
1
# Softening length (in internal units).
theta
:
0.
7
# Opening angle (Multipole acceptance criterion)
epsilon
:
0.001
# Softening length (in internal units).
theta
:
0.
85
# Opening angle (Multipole acceptance criterion)
# Parameters for the hydrodynamics scheme
SPH
:
...
...
examples/EAGLE_6/eagle_6.yml
View file @
c90ffa87
...
...
@@ -6,6 +6,10 @@ InternalUnitSystem:
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
Scheduler
:
max_top_level_cells
:
8
tasks_per_cell
:
50
# Parameters governing the time integration
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
...
...
@@ -26,8 +30,8 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity
:
eta
:
0.025
# Constant dimensionless multiplier for time integration.
theta
:
0.85
# Opening angle (Multipole acceptance criterion)
epsilon
:
0.001
# Softening length (in internal units).
theta
:
0.85
# Opening angle (Multipole acceptance criterion)
# Parameters for the hydrodynamics scheme
SPH
:
...
...
examples/UniformDMBox/uniformBox.yml
View file @
c90ffa87
...
...
@@ -9,9 +9,9 @@ InternalUnitSystem:
# Parameters governing the time integration
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
time_end
:
1.
# The end time of the simulation (in internal units).
time_end
:
1
00
.
# 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
:
1
e-3
# The maximal time-step size of the simulation (in internal units).
dt_max
:
1
.
# The maximal time-step size of the simulation (in internal units).
Scheduler
:
max_top_level_cells
:
8
...
...
@@ -21,18 +21,18 @@ Scheduler:
Snapshots
:
basename
:
uniformDMBox
# Common part of the name of output files
time_first
:
0.
# Time of the first output (in internal units)
delta_time
:
0.
01
# Time difference between consecutive outputs (in internal units)
delta_time
:
1
0.
# Time difference between consecutive outputs (in internal units)
# Parameters for the self-gravity scheme
Gravity
:
eta
:
0.025
# Constant dimensionless multiplier for time integration.
theta
:
0.
7
# Opening angle (Multipole acceptance criterion)
epsilon
:
0.0
0001
# Softening length (in internal units).
theta
:
0.
8
# Opening angle (Multipole acceptance criterion)
epsilon
:
0.0
1
# Softening length (in internal units).
# Parameters governing the conserved quantities statistics
Statistics
:
delta_time
:
1e-2
# Time between statistics output
delta_time
:
5.
# Time between statistics output
# Parameters related to the initial conditions
InitialConditions
:
file_name
:
./uniformDMBox_
50
.hdf5
# The file to read
file_name
:
./uniformDMBox_
16
.hdf5
# The file to read
examples/analyse_tasks.py
View file @
c90ffa87
...
...
@@ -52,11 +52,10 @@ infile = args.input
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES
=
[
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub_self"
,
"sub_pair"
,
"init_grav"
,
"ghost"
,
"extra_ghost"
,
"drift_part"
,
"drift_gpart"
,
"kick1"
,
"kick2"
,
"timestep"
,
"send"
,
"recv"
,
"grav_top_level"
,
"grav_long_range"
,
"grav_mm"
,
"grav_down"
,
"cooling"
,
"sourceterms"
,
"count"
]
"init_grav"
,
"ghost_in"
,
"ghost"
,
"ghost_out"
,
"extra_ghost"
,
"drift_part"
,
"drift_gpart"
,
"kick1"
,
"kick2"
,
"timestep"
,
"send"
,
"recv"
,
"grav_top_level"
,
"grav_long_range"
,
"grav_ghost_in"
,
"grav_ghost_out"
,
"grav_mm"
,
"grav_down"
,
"cooling"
,
"sourceterms"
,
"count"
]
SUBTYPES
=
[
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"external_grav"
,
"tend"
,
"xv"
,
"rho"
,
"gpart"
,
"multipole"
,
"spart"
,
"count"
]
...
...
examples/check_ngbs.py
View file @
c90ffa87
...
...
@@ -18,8 +18,6 @@ inputFile2 = ""
# Check list of density neighbours and check that they are correct.
def
check_density_neighbours
(
pids
,
ngb_ids_naive
,
ngb_ids_sort
,
mask
,
pos
,
h
,
num_invalid
,
acc
):
error_val
=
False
for
k
in
range
(
0
,
num_invalid
):
# Filter neighbour lists for valid particle ids
...
...
@@ -28,7 +26,21 @@ def check_density_neighbours(pids, ngb_ids_naive, ngb_ids_sort, mask, pos, h, nu
# Check neighbour lists for differences
id_list
=
set
(
filter_neigh_naive
).
symmetric_difference
(
set
(
filter_neigh_sort
))
# Check for duplicate IDs
duplicate_check_naive
=
len
(
filter_neigh_naive
)
!=
len
(
set
(
filter_neigh_naive
))
duplicate_check_sort
=
len
(
filter_neigh_sort
)
!=
len
(
set
(
filter_neigh_sort
))
if
duplicate_check_naive
:
print
"Duplicate neighbour ID found in: "
,
inputFile1
print
filter_neigh_naive
return
True
if
duplicate_check_sort
:
print
"Duplicate neighbour ID found in: "
,
inputFile2
print
filter_neigh_sort
return
True
pid
=
pids
[
mask
][
k
]
# Loop over discrepancies and check if they are actually neighbours
...
...
@@ -53,9 +65,9 @@ def check_density_neighbours(pids, ngb_ids_naive, ngb_ids_sort, mask, pos, h, nu
if
diff
<
acc
*
hig2
:
print
"Missing interaction due to precision issue will be ignored."
else
:
error_val
=
True
return
True
return
error_val
return
False
# Check list of force neighbours and check that they are correct.
def
check_force_neighbours
(
pids
,
ngb_ids_naive
,
ngb_ids_sort
,
mask
,
pos
,
h
,
num_invalid
,
acc
):
...
...
examples/plot_tasks.py
View file @
c90ffa87
...
...
@@ -110,9 +110,9 @@ pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES
=
[
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub_self"
,
"sub_pair"
,
"init_grav"
,
"ghost"
,
"extra_ghost"
,
"drift_part"
,
"drift_gpart"
,
"init_grav"
,
"ghost
_in"
,
"ghost"
,
"ghost_out
"
,
"extra_ghost"
,
"drift_part"
,
"drift_gpart"
,
"kick1"
,
"kick2"
,
"timestep"
,
"send"
,
"recv"
,
"grav_top_level"
,
"grav_long_range"
,
"grav_mm"
,
"grav_down"
,
"cooling"
,
"grav_long_range"
,
"grav_ghost_in"
,
"grav_ghost_out"
,
"grav_mm"
,
"grav_down"
,
"cooling"
,
"sourceterms"
,
"count"
]
SUBTYPES
=
[
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"external_grav"
,
...
...
@@ -123,7 +123,7 @@ FULLTYPES = ["self/force", "self/density", "self/grav", "sub_self/force",
"sub_self/density"
,
"pair/force"
,
"pair/density"
,
"pair/grav"
,
"sub_pair/force"
,
"sub_pair/density"
,
"recv/xv"
,
"send/xv"
,
"recv/rho"
,
"send/rho"
,
"recv/tend"
,
"send/tend"
]
"recv/tend"
,
"send/tend"
,
"recv/gpart"
,
"send/gpart"
]
# A number of colours for the various types. Recycled when there are
# more task types than colours...
...
...
src/active.h
View file @
c90ffa87
...
...
@@ -82,19 +82,19 @@ __attribute__((always_inline)) INLINE static int cell_are_gpart_drifted(
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_active
(
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_active
_hydro
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_end_min
<
e
->
ti_current
)
if
(
c
->
ti_
hydro_
end_min
<
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)"
,
c
->
ti_end_min
,
c
->
ti_end_min
*
e
->
timeBase
,
e
->
ti_current
,
c
->
ti_
hydro_
end_min
,
c
->
ti_
hydro_
end_min
*
e
->
timeBase
,
e
->
ti_current
,
e
->
ti_current
*
e
->
timeBase
);
#endif
return
(
c
->
ti_end_min
==
e
->
ti_current
);
return
(
c
->
ti_
hydro_
end_min
==
e
->
ti_current
);
}
/**
...
...
@@ -104,18 +104,61 @@ __attribute__((always_inline)) INLINE static int cell_is_active(
* @param e The #engine containing information about the current time.
* @return 1 if all particles in a #cell are active, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_all_active
(
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_all_active
_hydro
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_end_max
<
e
->
ti_current
)
if
(
c
->
ti_
hydro_
end_max
<
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld"
,
c
->
ti_end_max
,
e
->
ti_current
);
c
->
ti_
hydro_
end_max
,
e
->
ti_current
);
#endif
return
(
c
->
ti_end_max
==
e
->
ti_current
);
return
(
c
->
ti_hydro_end_max
==
e
->
ti_current
);
}
/**
* @brief Does a cell contain any g-particle finishing their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_active_gravity
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_gravity_end_min
<
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)"
,
c
->
ti_gravity_end_min
,
c
->
ti_gravity_end_min
*
e
->
timeBase
,
e
->
ti_current
,
e
->
ti_current
*
e
->
timeBase
);
#endif
return
(
c
->
ti_gravity_end_min
==
e
->
ti_current
);
}
/**
* @brief Are *all* g-particles in a cell finishing their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if all particles in a #cell are active, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_all_active_gravity
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_gravity_end_max
<
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld"
,
c
->
ti_gravity_end_max
,
e
->
ti_current
);
#endif
return
(
c
->
ti_gravity_end_max
==
e
->
ti_current
);
}
/**
...
...
@@ -215,19 +258,41 @@ __attribute__((always_inline)) INLINE static int spart_is_active(
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_starting
(
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_starting
_hydro
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_beg_max
>
e
->
ti_current
)
if
(
c
->
ti_
hydro_
beg_max
>
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)"
,
c
->
ti_beg_max
,
c
->
ti_beg_max
*
e
->
timeBase
,
e
->
ti_current
,
c
->
ti_
hydro_
beg_max
,
c
->
ti_
hydro_
beg_max
*
e
->
timeBase
,
e
->
ti_current
,
e
->
ti_current
*
e
->
timeBase
);
#endif
return
(
c
->
ti_beg_max
==
e
->
ti_current
);
return
(
c
->
ti_hydro_beg_max
==
e
->
ti_current
);
}
/**
* @brief Does a cell contain any g-particle starting their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_starting_gravity
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
c
->
ti_gravity_beg_max
>
e
->
ti_current
)
error
(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)"
,
c
->
ti_gravity_beg_max
,
c
->
ti_gravity_beg_max
*
e
->
timeBase
,
e
->
ti_current
,
e
->
ti_current
*
e
->
timeBase
);
#endif
return
(
c
->
ti_gravity_beg_max
==
e
->
ti_current
);
}
/**
...
...
src/cell.c
View file @
c90ffa87
This diff is collapsed.
Click to expand it.
src/cell.h
View file @
c90ffa87
...
...
@@ -80,14 +80,23 @@ struct pcell {
/*! Maximal smoothing length. */
double
h_max
;
/*! Minimal integer end-of-timestep in this cell */
integertime_t
ti_end_min
;
/*! Minimal integer end-of-timestep in this cell
for hydro tasks
*/
integertime_t
ti_
hydro_
end_min
;
/*! Maximal integer end-of-timestep in this cell */
integertime_t
ti_end_max
;
/*! Maximal integer end-of-timestep in this cell
for hydro tasks
*/
integertime_t
ti_
hydro_
end_max
;
/*! Maximal integer beginning-of-timestep in this cell */
integertime_t
ti_beg_max
;
/*! Maximal integer beginning-of-timestep in this cell for hydro tasks */
integertime_t
ti_hydro_beg_max
;
/*! Minimal integer end-of-timestep in this cell for gravity tasks */
integertime_t
ti_gravity_end_min
;
/*! Maximal integer end-of-timestep in this cell for gravity tasks */
integertime_t
ti_gravity_end_max
;
/*! Maximal integer beginning-of-timestep in this cell for gravity tasks */
integertime_t
ti_gravity_beg_max
;
/*! Integer time of the last drift of the #part in this cell */
integertime_t
ti_old_part
;
...
...
@@ -95,6 +104,9 @@ struct pcell {
/*! Integer time of the last drift of the #gpart in this cell */
integertime_t
ti_old_gpart
;
/*! Integer time of the last drift of the #multipole in this cell */
integertime_t
ti_old_multipole
;
/*! Number of #part in this cell. */
int
count
;
...
...
@@ -110,6 +122,11 @@ struct pcell {
/*! Relative indices of the cell's progeny. */
int
progeny
[
8
];
#ifdef SWIFT_DEBUG_CHECKS
/* Cell ID (for debugging) */
int
cellID
;
#endif
}
SWIFT_STRUCT_ALIGN
;
/**
...
...
@@ -117,8 +134,17 @@ struct pcell {
*/
struct
pcell_step
{
/*! Minimal integer end-of-timestep in this cell */
integertime_t
ti_end_min
;
/*! Minimal integer end-of-timestep in this cell (hydro) */
integertime_t
ti_hydro_end_min
;
/*! Minimal integer end-of-timestep in this cell (hydro) */
integertime_t
ti_hydro_end_max
;
/*! Minimal integer end-of-timestep in this cell (gravity) */
integertime_t
ti_gravity_end_min
;
/*! Minimal integer end-of-timestep in this cell (gravity) */
integertime_t
ti_gravity_end_max
;
/*! Maximal distance any #part has travelled since last rebuild */
float
dx_max_part
;
...
...
@@ -170,11 +196,16 @@ struct cell {
/*! Parent cell. */
struct
cell
*
parent
;
/*! Super cell, i.e. the highest-level parent cell
that has pair/self
task
s
*/
/*! Super cell, i.e. the highest-level parent cell
with *any*
task */
struct
cell
*
super
;
/*! The task computing this cell's sorts. */
struct
task
*
sorts
;
/*! Super cell, i.e. the highest-level parent cell that has a hydro pair/self
* tasks */
struct
cell
*
super_hydro
;
/*! Super cell, i.e. the highest-level parent cell that has a grav pair/self
* tasks */
struct
cell
*
super_gravity
;
/*! Linked list of the tasks computing this cell's hydro density. */
struct
link
*
density
;
...
...
@@ -188,6 +219,9 @@ struct cell {
/*! Linked list of the tasks computing this cell's gravity forces. */
struct
link
*
grav
;
/*! The task computing this cell's sorts. */
struct
task
*
sorts
;
/*! The multipole initialistation task */
struct
task
*
init_grav
;
...
...
@@ -219,7 +253,7 @@ struct cell {
struct
task
*
timestep
;
/*! Task linking the FFT mesh to the rest of gravity tasks */
struct
task
*
grav_ghost
[
2
]
;
struct
task
*
grav_ghost
_in
,
*
grav_ghost_out
;
/*! Task computing long range non-periodic gravity interactions */
struct
task
*
grav_long_range
;
...
...
@@ -235,27 +269,33 @@ struct cell {
#ifdef WITH_MPI
/* Task receiving data (positions). */
/* Task receiving
hydro
data (positions). */
struct
task
*
recv_xv
;
/* Task receiving data (density). */
/* Task receiving
hydro
data (density). */
struct
task
*
recv_rho
;
/* Task receiving data (gradient). */
/* Task receiving
hydro
data (gradient). */
struct
task
*
recv_gradient
;
/* Task receiving gpart data. */
struct
task
*
recv_grav
;
/* Task receiving data (time-step). */
struct
task
*
recv_ti
;
/* Linked list for sending data (positions). */
/* Linked list for sending
hydro
data (positions). */
struct
link
*
send_xv
;
/* Linked list for sending data (density). */
/* Linked list for sending
hydro
data (density). */
struct
link
*
send_rho
;
/* Linked list for sending data (gradient). */
/* Linked list for sending
hydro
data (gradient). */
struct
link
*
send_gradient
;
/* Linked list for sending gpart data. */
struct
link
*
send_grav
;
/* Linked list for sending data (time-step). */
struct
link
*
send_ti
;
...
...
@@ -273,14 +313,24 @@ struct cell {
#endif
/*! Minimum end of (integer) time step in this cell. */
integertime_t
ti_end_min
;
/*! Minimum end of (integer) time step in this cell for hydro tasks. */
integertime_t
ti_hydro_end_min
;
/*! Maximum end of (integer) time step in this cell for hydro tasks. */
integertime_t
ti_hydro_end_max
;
/*! Maximum beginning of (integer) time step in this cell for hydro tasks. */
integertime_t
ti_hydro_beg_max
;
/*! M
ax
imum end of (integer) time step in this cell. */
integertime_t
ti_end_m
ax
;
/*! M
in
imum end of (integer) time step in this cell
for gravity tasks
. */
integertime_t
ti_
gravity_
end_m
in
;
/*! Maximum beginning of (integer) time step in this cell. */
integertime_t
ti_beg_max
;
/*! Maximum end of (integer) time step in this cell for gravity tasks. */
integertime_t
ti_gravity_end_max
;
/*! Maximum beginning of (integer) time step in this cell for gravity tasks.
*/
integertime_t
ti_gravity_beg_max
;
/*! Last (integer) time the cell's part were drifted forward in time. */
integertime_t
ti_old_part
;
...
...
@@ -397,6 +447,9 @@ struct cell {
char
do_sub_sort
;
#ifdef SWIFT_DEBUG_CHECKS
/* Cell ID (for debugging) */
int
cellID
;
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t
ti_sort
;
...
...
@@ -430,6 +483,8 @@ int cell_pack(struct cell *c, struct pcell *pc);
int
cell_unpack
(
struct
pcell
*
pc
,
struct
cell
*
c
,
struct
space
*
s
);
int
cell_pack_end_step
(
struct
cell
*
c
,
struct
pcell_step
*
pcell
);
int
cell_unpack_end_step
(
struct
cell
*
c
,
struct
pcell_step
*
pcell
);
int
cell_pack_multipoles
(
struct
cell
*
c
,
struct
gravity_tensors
*
m
);
int
cell_unpack_multipoles
(
struct
cell
*
c
,
struct
gravity_tensors
*
m
);
int
cell_getsize
(
struct
cell
*
c
);
int
cell_link_parts
(
struct
cell
*
c
,
struct
part
*
parts
);
int
cell_link_gparts
(
struct
cell
*
c
,
struct
gpart
*
gparts
);
...
...
@@ -443,7 +498,8 @@ void cell_check_part_drift_point(struct cell *c, void *data);
void
cell_check_gpart_drift_point
(
struct
cell
*
c
,
void
*
data
);
void
cell_check_multipole_drift_point
(
struct
cell
*
c
,
void
*
data
);
void
cell_reset_task_counters
(
struct
cell
*
c
);
int
cell_unskip_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
int
cell_unskip_hydro_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
int
cell_unskip_gravity_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
void
cell_set_super
(
struct
cell
*
c
,
struct
cell
*
super
);
void
cell_drift_part
(
struct
cell
*
c
,
const
struct
engine
*
e
,
int
force
);
void
cell_drift_gpart
(
struct
cell
*
c
,
const
struct
engine
*
e
,
int
force
);
...
...
@@ -451,8 +507,8 @@ void cell_drift_multipole(struct cell *c, const struct engine *e);
void
cell_drift_all_multipoles
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_check_timesteps
(
struct
cell
*
c
);
void
cell_store_pre_drift_values
(
struct
cell
*
c
);
void
cell_activate_subcell_tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
);
void
cell_activate_subcell_
hydro_
tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
);
void
cell_activate_subcell_grav_tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
);
void
cell_activate_subcell_external_grav_tasks
(
struct
cell
*
ci
,
...
...
@@ -492,12 +548,8 @@ __attribute__((always_inline)) INLINE static int cell_can_recurse_in_pair_task(
__attribute__
((
always_inline
))
INLINE
static
int
cell_can_recurse_in_self_task
(
const
struct
cell
*
c
)
{
/* Is the cell split ? */
/* Note: No need for more checks here as all the sub-pairs and sub-self */
/* operations will be executed. So no need for the particle to be at exactly
*/
/* the right place. */
return
c
->
split
;
/* Is the cell split and not smaller than the smoothing length? */
return
c
->
split
&&
(
kernel_gamma
*
c
->
h_max_old
<
0
.
5
f
*
c
->
dmin
);
}
/**
...
...
src/collectgroup.c
View file @
c90ffa87
...
...
@@ -37,7 +37,8 @@
/* Local collections for MPI reduces. */
struct
mpicollectgroup1
{
size_t
updates
,
g_updates
,
s_updates
;
integertime_t
ti_end_min
;
integertime_t
ti_hydro_end_min
;
integertime_t
ti_gravity_end_min
;
int
forcerebuild
;
};
...
...
@@ -75,9 +76,15 @@ void collectgroup_init() {
* @param e The #engine
*/
void
collectgroup1_apply
(
struct
collectgroup1
*
grp1
,
struct
engine
*
e
)
{
e
->
ti_end_min
=
grp1
->
ti_end_min
;
e
->
ti_end_max
=
grp1
->
ti_end_max
;
e
->
ti_beg_max
=
grp1
->
ti_beg_max
;
e
->
ti_hydro_end_min
=
grp1
->
ti_hydro_end_min
;
e
->
ti_hydro_end_max
=
grp1
->
ti_hydro_end_max
;
e
->
ti_hydro_beg_max
=
grp1
->
ti_hydro_beg_max
;
e
->
ti_gravity_end_min
=
grp1
->
ti_gravity_end_min
;
e
->
ti_gravity_end_max
=
grp1
->
ti_gravity_end_max
;
e
->
ti_gravity_beg_max
=
grp1
->
ti_gravity_beg_max
;
e
->
ti_end_min
=
min
(
e
->
ti_hydro_end_min
,
e
->
ti_gravity_end_min
);
e
->
ti_end_max
=
max
(
e
->
ti_hydro_end_max
,
e
->
ti_gravity_end_max
);
e
->
ti_beg_max
=
max
(
e
->
ti_hydro_beg_max
,
e
->
ti_gravity_beg_max
);
e
->
updates
=
grp1
->
updates
;
e
->
g_updates
=
grp1
->
g_updates
;
e
->
s_updates
=
grp1
->
s_updates
;
...
...
@@ -92,21 +99,37 @@ void collectgroup1_apply(struct collectgroup1 *grp1, struct engine *e) {
* @param g_updates the number of updated gravity particles on this node this
* step.
* @param s_updates the number of updated star particles on this node this step.
* @param ti_end_min the minimum end time for next time step after this step.
* @param ti_end_max the maximum end time for next time step after this step.
* @param ti_beg_max the maximum begin time for next time step after this step.
* @param ti_hydro_end_min the minimum end time for next hydro time step after
* this step.
* @param ti_hydro_end_max the maximum end time for next hydro time step after
* this step.
* @param ti_hydro_beg_max the maximum begin time for next hydro time step after
* this step.
* @param ti_gravity_end_min the minimum end time for next gravity time step
* after this step.
* @param ti_gravity_end_max the maximum end time for next gravity time step
* after this step.
* @param ti_gravity_beg_max the maximum begin time for next gravity time step
* after this step.
* @param forcerebuild whether a rebuild is required after this step.
*/
void
collectgroup1_init
(
struct
collectgroup1
*
grp1
,
size_t
updates
,
size_t
g_updates
,
size_t
s_updates
,
integertime_t
ti_end_min
,
integertime_t
ti_end_max
,
integertime_t
ti_beg_max
,
int
forcerebuild
)
{
integertime_t
ti_hydro_end_min
,
integertime_t
ti_hydro_end_max
,
integertime_t
ti_hydro_beg_max
,
integertime_t
ti_gravity_end_min
,
integertime_t
ti_gravity_end_max
,
integertime_t
ti_gravity_beg_max
,
int
forcerebuild
)
{
grp1
->
updates
=
updates
;
grp1
->
g_updates
=
g_updates
;
grp1
->
s_updates
=
s_updates
;
grp1
->
ti_end_min
=
ti_end_min
;
grp1
->
ti_end_max
=
ti_end_max
;
grp1
->
ti_beg_max
=
ti_beg_max
;
grp1
->
ti_hydro_end_min
=
ti_hydro_end_min
;
grp1
->
ti_hydro_end_max
=
ti_hydro_end_max
;
grp1
->
ti_hydro_beg_max
=
ti_hydro_beg_max
;
grp1
->
ti_gravity_end_min
=
ti_gravity_end_min
;
grp1
->
ti_gravity_end_max
=
ti_gravity_end_max
;
grp1
->
ti_gravity_beg_max
=
ti_gravity_beg_max
;
grp1
->
forcerebuild
=
forcerebuild
;
}
...
...
@@ -127,7 +150,8 @@ void collectgroup1_reduce(struct collectgroup1 *grp1) {
mpigrp11
.
updates
=
grp1
->
updates
;
mpigrp11
.
g_updates
=
grp1
->
g_updates
;
mpigrp11
.
s_updates
=
grp1
->
s_updates
;
mpigrp11
.
ti_end_min
=
grp1
->
ti_end_min
;