Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 840-unit-test-testtimeline-fails
  • 875-wendland-c6-missing-neighbour-contributions
  • 887-code-does-not-compile-with-parmetis-installed-locally-but-without-metis
  • CubeTest
  • FS_Del
  • GEARRT_Iliev1
  • GEARRT_Iliev3
  • GEARRT_Iliev4
  • GEARRT_Iliev5
  • GEARRT_Iliev5-fixed-nr-subcycles
  • GEARRT_Iliev7
  • GEARRT_Iliev_static
  • GEARRT_Ivanova
  • GEARRT_fixed_nr_subcycles
  • GEARRT_injection_tests_Iliev0
  • GPU_swift
  • GrackleCoolingUpdates2
  • Lambda-T-table
  • MAGMA2
  • MAGMA2_matthieu
  • MHD_FS
  • MHD_FS_TESTs
  • MHD_FS_VP_AdvectGauge
  • MHD_Orestis
  • MHD_canvas
  • MHD_canvas_RF_128
  • MHD_canvas_RF_growth_rate
  • MHD_canvas_RobertsFlow
  • MHD_canvas_SPH_errors
  • MHD_canvas_matthieu
  • MHD_canvas_nickishch
  • MHD_canvas_nickishch_Lorentz_force_test
  • MHD_canvas_nickishch_track_everything
  • MHD_canvas_sid
  • OAK/CPAW_updates
  • OAK/LoopAdvectionTest
  • OAK/adaptive_divv
  • OAK/kinetic_dedner
  • REMIX_cosmo
  • RT_dualc
  • RT_recombination_radiation
  • RT_test_mladen
  • SIDM
  • SIDM_wKDSDK
  • SNdust
  • SPHM1RT_CosmologicalStromgrenSphere
  • SPHM1RT_bincheck
  • SPHM1RT_smoothedRT
  • TangoSIDM
  • TestPropagation3D
  • Test_fixedhProb
  • activate_fewer_comms
  • active_h_max_optimization
  • adaptive_softening_Lieuwe
  • add_2p5D
  • add_black_holes_checks
  • adding_sidm_to_master
  • agn_crksph
  • agn_crksph_subtask_speedup
  • amd-optimization
  • arm_vec
  • automatic_tasks
  • better_ray_RNG
  • black_holes_accreted_angular_momenta_from_gas
  • burkert-potential
  • c11
  • c11_atomics_copy
  • cancel_all_sorts
  • cell_exchange_improvements
  • cell_types
  • cherry-pick-cd1c39e0
  • comm_tasks_are_special
  • conduction_velocities
  • cpp-fixes
  • cuda_test
  • darwin/adaptive_softening
  • darwin/gear_chemistry_fluxes
  • darwin/gear_mechanical_feedback
  • darwin/gear_preSN_feedback
  • darwin/gear_radiation
  • darwin/simulations
  • darwin/sink_formation_proba
  • darwin/sink_mpi
  • darwin/sink_mpi_physics
  • dead-time-stats
  • derijcke_cooling
  • dev_cms
  • do-not-activate-empty-star-pairs
  • domain_zoom_nometis
  • drift_flag_debug_check
  • driven_turbulence
  • driven_turbulence_forcings
  • engineering
  • eos_updates
  • evrard_disc
  • expand_fof
  • expand_fof_2022
  • explict_bkg_cdim
  • fewer_star_comms
  • fewer_timestep_comms_no_empty_pairs
  • v0.0
  • v0.1
  • v0.1.0-pre
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.7.0
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.8.5
  • v0.9.0
  • v1.0.0
  • v2025.01
  • v2025.04
119 results

Target

Select target project
  • tkchan/swiftsim
  • dc-turn5/swiftsim
  • pdraper/swiftsim
  • dc-oman1/swiftsim
  • swift/swiftsim
5 results
Select Git revision
  • 840-unit-test-testtimeline-fails
  • 875-wendland-c6-missing-neighbour-contributions
  • 887-code-does-not-compile-with-parmetis-installed-locally-but-without-metis
  • CubeTest
  • FS_Del
  • GEARRT_Iliev1
  • GEARRT_Iliev3
  • GEARRT_Iliev4
  • GEARRT_Iliev5
  • GEARRT_Iliev5-fixed-nr-subcycles
  • GEARRT_Iliev7
  • GEARRT_Iliev_static
  • GEARRT_Ivanova
  • GEARRT_fixed_nr_subcycles
  • GEARRT_injection_tests_Iliev0
  • GPU_swift
  • GrackleCoolingUpdates2
  • Lambda-T-table
  • MAGMA2
  • MAGMA2_matthieu
  • MHD_FS
  • MHD_FS_TESTs
  • MHD_FS_VP_AdvectGauge
  • MHD_Orestis
  • MHD_canvas
  • MHD_canvas_RF_128
  • MHD_canvas_RF_growth_rate
  • MHD_canvas_RobertsFlow
  • MHD_canvas_SPH_errors
  • MHD_canvas_matthieu
  • MHD_canvas_nickishch
  • MHD_canvas_nickishch_Lorentz_force_test
  • MHD_canvas_nickishch_track_everything
  • MHD_canvas_sid
  • OAK/CPAW_updates
  • OAK/LoopAdvectionTest
  • OAK/adaptive_divv
  • OAK/kinetic_dedner
  • REMIX_cosmo
  • RT_dualc
  • RT_recombination_radiation
  • RT_test_mladen
  • SIDM
  • SIDM_wKDSDK
  • SNdust
  • SPHM1RT_CosmologicalStromgrenSphere
  • SPHM1RT_bincheck
  • SPHM1RT_smoothedRT
  • TangoSIDM
  • TestPropagation3D
  • Test_fixedhProb
  • activate_fewer_comms
  • active_h_max_optimization
  • adaptive_softening_Lieuwe
  • add_2p5D
  • add_black_holes_checks
  • adding_sidm_to_master
  • agn_crksph
  • agn_crksph_subtask_speedup
  • amd-optimization
  • arm_vec
  • automatic_tasks
  • better_ray_RNG
  • black_holes_accreted_angular_momenta_from_gas
  • burkert-potential
  • c11
  • c11_atomics_copy
  • cancel_all_sorts
  • cell_exchange_improvements
  • cell_types
  • cherry-pick-cd1c39e0
  • comm_tasks_are_special
  • conduction_velocities
  • cpp-fixes
  • cuda_test
  • darwin/adaptive_softening
  • darwin/gear_chemistry_fluxes
  • darwin/gear_mechanical_feedback
  • darwin/gear_preSN_feedback
  • darwin/gear_radiation
  • darwin/simulations
  • darwin/sink_formation_proba
  • darwin/sink_mpi
  • darwin/sink_mpi_physics
  • dead-time-stats
  • derijcke_cooling
  • dev_cms
  • do-not-activate-empty-star-pairs
  • domain_zoom_nometis
  • drift_flag_debug_check
  • driven_turbulence
  • driven_turbulence_forcings
  • engineering
  • eos_updates
  • evrard_disc
  • expand_fof
  • expand_fof_2022
  • explict_bkg_cdim
  • fewer_star_comms
  • fewer_timestep_comms_no_empty_pairs
  • v0.0
  • v0.1
  • v0.1.0-pre
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.7.0
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.8.5
  • v0.9.0
  • v1.0.0
  • v2025.01
  • v2025.04
119 results
Show changes
......@@ -1230,7 +1230,7 @@ int main(int argc, char *argv[]) {
/* Write final output. */
if (!force_stop) {
engine_drift_all(&e);
engine_drift_all(&e, /*drift_mpole=*/0);
engine_print_stats(&e);
#ifdef WITH_LOGGER
logger_log_all(e.logger, &e);
......
......@@ -3245,6 +3245,21 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
if (ti_current < ti_old_part) error("Attempt to drift to the past");
#endif
/* Early abort? */
if (c->hydro.count == 0) {
/* Clear the drift flags. */
c->hydro.do_drift = 0;
c->hydro.do_sub_drift = 0;
/* Update the time of the last drift */
c->hydro.ti_old_part = ti_current;
return;
}
/* Ok, we have some particles somewhere in the hierarchy to drift */
/* Are we not in a leaf ? */
if (c->split && (force || c->hydro.do_sub_drift)) {
......@@ -3415,6 +3430,21 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
if (ti_current < ti_old_gpart) error("Attempt to drift to the past");
#endif
/* Early abort? */
if (c->grav.count == 0) {
/* Clear the drift flags. */
c->grav.do_drift = 0;
c->grav.do_sub_drift = 0;
/* Update the time of the last drift */
c->grav.ti_old_part = ti_current;
return;
}
/* Ok, we have some particles somewhere in the hierarchy to drift */
/* Are we not in a leaf ? */
if (c->split && (force || c->grav.do_sub_drift)) {
......
......@@ -2131,7 +2131,7 @@ void engine_prepare(struct engine *e) {
if (e->forcerepart) {
/* Let's start by drifting everybody to the current time */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
drifted_all = 1;
/* And repartition */
......@@ -2143,7 +2143,7 @@ void engine_prepare(struct engine *e) {
if (e->forcerebuild) {
/* Let's start by drifting everybody to the current time */
if (!e->restarting && !drifted_all) engine_drift_all(e);
if (!e->restarting && !drifted_all) engine_drift_all(e, /*drift_mpole=*/0);
/* And rebuild */
engine_rebuild(e, repartitioned, 0);
......@@ -2924,7 +2924,7 @@ void engine_step(struct engine *e) {
e->step_props = engine_step_prop_none;
/* When restarting, move everyone to the current time. */
if (e->restarting) engine_drift_all(e);
if (e->restarting) engine_drift_all(e, /*drift_mpole=*/1);
/* Get the physical value of the time and time-step size */
if (e->policy & engine_policy_cosmology) {
......@@ -2963,7 +2963,7 @@ void engine_step(struct engine *e) {
/* Are we drifting everything (a la Gadget/GIZMO) ? */
if (e->policy & engine_policy_drift_all && !e->forcerebuild)
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/1);
/* Are we reconstructing the multipoles or drifting them ?*/
if ((e->policy & engine_policy_self_gravity) && !e->forcerebuild) {
......@@ -3107,7 +3107,7 @@ void engine_check_for_dumps(struct engine *e) {
}
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump everything */
engine_print_stats(e);
......@@ -3131,7 +3131,7 @@ void engine_check_for_dumps(struct engine *e) {
}
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump stats */
engine_print_stats(e);
......@@ -3143,7 +3143,7 @@ void engine_check_for_dumps(struct engine *e) {
e->time = e->ti_next_snapshot * e->time_base + e->time_begin;
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump snapshot */
#ifdef WITH_LOGGER
......@@ -3166,7 +3166,7 @@ void engine_check_for_dumps(struct engine *e) {
}
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump snapshot */
#ifdef WITH_LOGGER
......@@ -3183,7 +3183,7 @@ void engine_check_for_dumps(struct engine *e) {
e->time = e->ti_next_stats * e->time_base + e->time_begin;
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump stats */
engine_print_stats(e);
......@@ -3206,7 +3206,7 @@ void engine_check_for_dumps(struct engine *e) {
}
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump... */
#ifdef WITH_LOGGER
......@@ -3232,7 +3232,7 @@ void engine_check_for_dumps(struct engine *e) {
}
/* Drift everyone */
engine_drift_all(e);
engine_drift_all(e, /*drift_mpole=*/0);
/* Dump */
engine_print_stats(e);
......@@ -3329,7 +3329,7 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) {
restart_remove_previous(e->restart_file);
/* Drift all particles first (may have just been done). */
if (!drifted_all) engine_drift_all(e);
if (!drifted_all) engine_drift_all(e, /*drift_mpole=*/1);
restart_write(e, e->restart_file);
if (e->verbose)
......@@ -3401,69 +3401,153 @@ void engine_unskip(struct engine *e) {
}
/**
* @brief Mapper function to drift *all* particle types and multipoles forward
* in time.
* @brief Mapper function to drift *all* the #part to the current time.
*
* @param map_data An array of #cell%s.
* @param num_elements Chunk size.
* @param extra_data Pointer to an #engine.
*/
void engine_do_drift_all_mapper(void *map_data, int num_elements,
void *extra_data) {
void engine_do_drift_all_part_mapper(void *map_data, int num_elements,
void *extra_data) {
const struct engine *e = (const struct engine *)extra_data;
const int restarting = e->restarting;
struct space *s = e->s;
struct cell *cells_top;
int *local_cells_with_tasks_top;
int *local_cells_top;
if (restarting) {
/* When restarting, we loop over all top-level cells */
cells_top = (struct cell *)map_data;
local_cells_with_tasks_top = NULL;
local_cells_top = NULL;
} else {
/* In any other case, we use th list of local cells with tasks */
/* In any other case, we use the list of local cells with tasks */
cells_top = s->cells_top;
local_cells_with_tasks_top = (int *)map_data;
local_cells_top = (int *)map_data;
}
for (int ind = 0; ind < num_elements; ind++) {
struct cell *c;
/* When restarting, the list of local cells with tasks does not
/* When restarting, the list of local cells does not
yet exist. We use the raw list of top-level cells instead */
if (restarting)
c = &cells_top[ind];
else
c = &cells_top[local_cells_with_tasks_top[ind]];
c = &cells_top[local_cells_top[ind]];
if (c->nodeID == e->nodeID) {
/* Drift all the particles */
cell_drift_part(c, e, 1);
/* Drift all the g-particles */
cell_drift_gpart(c, e, 1);
cell_drift_part(c, e, /* force the drift=*/1);
}
}
}
/* Drift the multipoles */
if (e->policy & engine_policy_self_gravity) {
cell_drift_all_multipoles(c, e);
/**
* @brief Mapper function to drift *all* the #gpart to the current time.
*
* @param map_data An array of #cell%s.
* @param num_elements Chunk size.
* @param extra_data Pointer to an #engine.
*/
void engine_do_drift_all_gpart_mapper(void *map_data, int num_elements,
void *extra_data) {
const struct engine *e = (const struct engine *)extra_data;
const int restarting = e->restarting;
struct space *s = e->s;
struct cell *cells_top;
int *local_cells_top;
if (restarting) {
/* When restarting, we loop over all top-level cells */
cells_top = (struct cell *)map_data;
local_cells_top = NULL;
} else {
/* In any other case, we use the list of local cells with tasks */
cells_top = s->cells_top;
local_cells_top = (int *)map_data;
}
for (int ind = 0; ind < num_elements; ind++) {
struct cell *c;
/* When restarting, the list of local cells does not
yet exist. We use the raw list of top-level cells instead */
if (restarting)
c = &cells_top[ind];
else
c = &cells_top[local_cells_top[ind]];
if (c->nodeID == e->nodeID) {
/* Drift all the particles */
cell_drift_gpart(c, e, /* force the drift=*/1);
}
}
}
/**
* @brief Mapper function to drift *all* the multipoles to the current time.
*
* @param map_data An array of #cell%s.
* @param num_elements Chunk size.
* @param extra_data Pointer to an #engine.
*/
void engine_do_drift_all_multipole_mapper(void *map_data, int num_elements,
void *extra_data) {
const struct engine *e = (const struct engine *)extra_data;
const int restarting = e->restarting;
struct space *s = e->s;
struct cell *cells_top;
int *local_cells_with_tasks_top;
if (restarting) {
/* When restarting, we loop over all top-level cells */
cells_top = (struct cell *)map_data;
local_cells_with_tasks_top = NULL;
} else {
/* In any other case, we use the list of local cells with tasks */
cells_top = s->cells_top;
local_cells_with_tasks_top = (int *)map_data;
}
for (int ind = 0; ind < num_elements; ind++) {
struct cell *c;
/* When restarting, the list of local cells does not
yet exist. We use the raw list of top-level cells instead */
if (restarting)
c = &cells_top[ind];
else
c = &cells_top[local_cells_with_tasks_top[ind]];
cell_drift_all_multipoles(c, e);
}
}
/**
* @brief Drift *all* particles and multipoles at all levels
* forward to the current time.
*
* @param e The #engine.
* @param drift_mpoles Do we want to drift all the multipoles as well?
*/
void engine_drift_all(struct engine *e) {
void engine_drift_all(struct engine *e, const int drift_mpoles) {
const ticks tic = getticks();
......@@ -3481,15 +3565,44 @@ void engine_drift_all(struct engine *e) {
if (!e->restarting) {
/* Normal case: We have a list of local cells with tasks to play with */
threadpool_map(&e->threadpool, engine_do_drift_all_mapper,
e->s->local_cells_with_tasks_top,
e->s->nr_local_cells_with_tasks, sizeof(int), 0, e);
if (e->s->nr_parts > 0) {
threadpool_map(&e->threadpool, engine_do_drift_all_part_mapper,
e->s->local_cells_top, e->s->nr_local_cells, sizeof(int),
/* default chunk */ 0, e);
}
if (e->s->nr_gparts > 0) {
threadpool_map(&e->threadpool, engine_do_drift_all_gpart_mapper,
e->s->local_cells_top, e->s->nr_local_cells, sizeof(int),
/* default chunk */ 0, e);
}
if (drift_mpoles && (e->policy & engine_policy_self_gravity)) {
threadpool_map(&e->threadpool, engine_do_drift_all_multipole_mapper,
e->s->local_cells_with_tasks_top,
e->s->nr_local_cells_with_tasks, sizeof(int),
/* default chunk */ 0, e);
}
} else {
/* When restarting, the list of local cells with tasks does not yet
exist. We use the raw list of top-level cells instead */
threadpool_map(&e->threadpool, engine_do_drift_all_mapper, e->s->cells_top,
e->s->nr_cells, sizeof(struct cell), 0, e);
if (e->s->nr_parts > 0) {
threadpool_map(&e->threadpool, engine_do_drift_all_part_mapper,
e->s->cells_top, e->s->nr_cells, sizeof(struct cell),
/* default chunk */ 0, e);
}
if (e->s->nr_gparts > 0) {
threadpool_map(&e->threadpool, engine_do_drift_all_gpart_mapper,
e->s->cells_top, e->s->nr_cells, sizeof(struct cell),
/* default chunk */ 0, e);
}
if (e->policy & engine_policy_self_gravity) {
threadpool_map(&e->threadpool, engine_do_drift_all_multipole_mapper,
e->s->cells_top, e->s->nr_cells, sizeof(struct cell),
/* default chunk */ 0, e);
}
}
/* Synchronize particle positions */
......@@ -3497,8 +3610,9 @@ void engine_drift_all(struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time. */
space_check_drift_point(e->s, e->ti_current,
e->policy & engine_policy_self_gravity);
space_check_drift_point(
e->s, e->ti_current,
drift_mpoles && (e->policy & engine_policy_self_gravity));
part_verify_links(e->s->parts, e->s->gparts, e->s->sparts, e->s->nr_parts,
e->s->nr_gparts, e->s->nr_sparts, e->verbose);
#endif
......
......@@ -400,7 +400,7 @@ void engine_compute_next_stf_time(struct engine *e);
void engine_compute_next_statistics_time(struct engine *e);
void engine_recompute_displacement_constraint(struct engine *e);
void engine_unskip(struct engine *e);
void engine_drift_all(struct engine *e);
void engine_drift_all(struct engine *e, const int drift_mpoles);
void engine_drift_top_multipoles(struct engine *e);
void engine_reconstruct_multipoles(struct engine *e);
void engine_print_stats(struct engine *e);
......