...
  View open merge request
Commits (33)
......@@ -1617,16 +1617,30 @@ case "$with_gravity" in
;;
esac
AC_ARG_ENABLE([gravitational-potential],
[AS_HELP_STRING([--disable-gravitational-potential],
[Disable calculation of the gravitational potential (only makes sense for the multi-softening gravity scheme).]
)],
[enable_gravitational_potential="$enableval"],
[enable_gravitational_potential="yes"]
)
if test "$enable_gravitational_potential" = "no"; then
AC_DEFINE([SWIFT_GRAVITY_NO_POTENTIAL],1,[Disable calculation of the gravitational potential])
fi
# Hydro scheme.
AC_ARG_WITH([hydro],
[AS_HELP_STRING([--with-hydro=<scheme>],
[Hydro dynamics to use @<:@gadget2, minimal, pressure-entropy, pressure-energy, pressure-energy-monaghan, default, gizmo-mfv, gizmo-mfm, shadowfax, planetary, sphenix, anarchy-pu default: gadget2@:>@]
[Hydro dynamics to use @<:@none, gadget2, minimal, pressure-entropy, pressure-energy, pressure-energy-monaghan, default, gizmo-mfv, gizmo-mfm, shadowfax, planetary, sphenix, anarchy-pu default: gadget2@:>@]
)],
[with_hydro="$withval"],
[with_hydro="gadget2"]
)
case "$with_hydro" in
none)
AC_DEFINE([NONE_SPH], [1], [No hydro])
;;
gadget2)
AC_DEFINE([GADGET2_SPH], [1], [Gadget-2 SPH])
;;
......@@ -2373,6 +2387,7 @@ AC_MSG_RESULT([
Gravity scheme : $with_gravity
Multipole order : $with_multipole_order
Compute potential : $enable_gravitational_potential
No gravity below ID : $no_gravity_below_id
Make gravity glass : $gravity_glass_making
External potential : $with_potential
......
......@@ -84,7 +84,7 @@ LineOfSight:
scale_factor_first: 0.1
delta_time: 1.1
# Quick Lyman-alpha cooling (EAGLE with fixed primoridal Z)
# Quick Lyman-alpha cooling (EAGLE-XL with fixed primoridal Z)
QLACooling:
dir_name: ./UV_dust1_CR1_G1_shield1.hdf5 # Location of the cooling tables
H_reion_z: 7.5 # Redshift of Hydrogen re-ionization (Planck 2018)
......
......@@ -968,6 +968,12 @@ int main(int argc, char *argv[]) {
else
bzero(&stars_properties, sizeof(struct stars_props));
if (with_hydro) {
#ifdef NONE_SPH
error("Can't run with hydro when compiled without hydro model!");
#endif
}
/* Initialise the feedback properties */
if (with_feedback) {
#ifdef FEEDBACK_NONE
......
......@@ -792,7 +792,7 @@ black_holes_store_potential_in_bpart(struct bpart* bp, const struct gpart* gp) {
if (bp->gpart != gp) error("Copying potential to the wrong black hole!");
#endif
bp->reposition.potential = gp->potential;
bp->reposition.potential = gravity_get_comoving_potential(gp);
}
/**
......@@ -805,7 +805,7 @@ black_holes_store_potential_in_bpart(struct bpart* bp, const struct gpart* gp) {
__attribute__((always_inline)) INLINE static void
black_holes_store_potential_in_part(struct black_holes_part_data* p_data,
const struct gpart* gp) {
p_data->potential = gp->potential;
p_data->potential = gravity_get_comoving_potential(gp);
}
/**
......
......@@ -2101,7 +2101,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
j++;
bucket_count[bid]++;
}
memswap(&gparts[j], &gpart, sizeof(struct gpart));
memswap_unaligned(&gparts[j], &gpart, sizeof(struct gpart));
memswap(&gbuff[j], &temp_buff, sizeof(struct cell_buff));
if (gparts[j].type == swift_type_gas) {
parts[-gparts[j].id_or_neg_offset - parts_offset].gpart =
......@@ -4580,8 +4580,8 @@ int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s) {
if (cell_need_rebuild_for_black_holes_pair(ci, cj)) rebuild = 1;
if (cell_need_rebuild_for_black_holes_pair(cj, ci)) rebuild = 1;
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost_0);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost_0);
#ifdef WITH_MPI
/* Activate the send/recv tasks. */
......@@ -4762,12 +4762,12 @@ int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s) {
if (c->black_holes.density_ghost != NULL)
scheduler_activate(s, c->black_holes.density_ghost);
if (c->black_holes.swallow_ghost[0] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[0]);
if (c->black_holes.swallow_ghost[1] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[1]);
if (c->black_holes.swallow_ghost[2] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[2]);
if (c->black_holes.swallow_ghost_0 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_0);
if (c->black_holes.swallow_ghost_1 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_1);
if (c->black_holes.swallow_ghost_2 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_2);
if (c->black_holes.black_holes_in != NULL)
scheduler_activate(s, c->black_holes.black_holes_in);
if (c->black_holes.black_holes_out != NULL)
......@@ -6987,7 +6987,8 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts,
#endif
/* Swap everything (including pointers) */
memswap(&gparts[i], &gparts[first_not_extra], sizeof(struct gpart));
memswap_unaligned(&gparts[i], &gparts[first_not_extra],
sizeof(struct gpart));
if (gparts[i].type == swift_type_gas) {
parts[-gparts[i].id_or_neg_offset].gpart = &gparts[i];
} else if (gparts[i].type == swift_type_stars) {
......
This diff is collapsed.
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leidenuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_CELL_BLACK_HOLES_H
#define SWIFT_CELL_BLACK_HOLES_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "task.h"
#include "timeline.h"
struct cell_black_holes {
#ifdef BLACK_HOLES_NONE
union {
#endif
/*! Pointer to the #bpart data. */
struct bpart *parts;
/*! The drift task for bparts */
struct task *drift;
/*! Implicit tasks marking the entry of the BH physics block of tasks
*/
struct task *black_holes_in;
/*! Implicit tasks marking the exit of the BH physics block of tasks */
struct task *black_holes_out;
/*! The density ghost task itself */
struct task *density_ghost;
/*! The other ghost tasks themselves */
struct task *swallow_ghost_0;
struct task *swallow_ghost_1;
struct task *swallow_ghost_2;
/*! Linked list of the tasks computing this cell's BH density. */
struct link *density;
/*! Linked list of the tasks computing this cell's BH swallowing and
* merging. */
struct link *swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_gas_swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_bh_swallow;
/*! Linked list of the tasks computing this cell's BH feedback. */
struct link *feedback;
/*! Last (integer) time the cell's bpart were drifted forward in time. */
integertime_t ti_old_part;
/*! Maximum end of (integer) time step in this cell for black hole tasks. */
integertime_t ti_end_max;
/*! Nr of #bpart this cell can hold after addition of new #bpart. */
int count_total;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
#ifdef BLACK_HOLES_NONE
};
#endif
/*! Maximum end of (integer) time step in this cell for black tasks. */
integertime_t ti_end_min;
/*! Maximum beginning of (integer) time step in this cell for black hole
* tasks. */
integertime_t ti_beg_max;
/*! Spin lock for various uses (#bpart case). */
swift_lock_type lock;
/*! Max smoothing length in this cell. */
float h_max;
/*! Number of #bpart updated in this cell. */
int updated;
/*! Is the #bpart data of this cell being used in a sub-cell? */
int hold;
/*! Nr of #bpart in this cell. */
int count;
};
#endif /* SWIFT_CELL_BLACK_HOLES_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leidenuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_CELL_HYDRO_H
#define SWIFT_CELL_HYDRO_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "task.h"
#include "timeline.h"
struct cell_hydro {
#ifdef NONE_SPH
union {
#endif
/*! Pointer to the #part data. */
struct part *parts;
/*! Pointer to the #xpart data. */
struct xpart *xparts;
/*! Pointer for the sorted indices. */
struct sort_entry *sort;
/*! Super cell, i.e. the highest-level parent cell that has a hydro
* pair/self tasks */
struct cell *super;
/*! The task computing this cell's sorts. */
struct task *sorts;
/*! The drift task for parts */
struct task *drift;
/*! Linked list of the tasks computing this cell's hydro density. */
struct link *density;
/* Linked list of the tasks computing this cell's hydro gradients. */
struct link *gradient;
/*! Linked list of the tasks computing this cell's hydro forces. */
struct link *force;
/*! Linked list of the tasks computing this cell's limiter. */
struct link *limiter;
/*! Dependency implicit task for the ghost (in->ghost->out)*/
struct task *ghost_in;
/*! Dependency implicit task for the ghost (in->ghost->out)*/
struct task *ghost_out;
/*! The ghost task itself */
struct task *ghost;
/*! The extra ghost task for complex hydro schemes */
struct task *extra_ghost;
/*! The task to end the force calculation */
struct task *end_force;
/*! Dependency implicit task for cooling (in->cooling->out) */
struct task *cooling_in;
/*! Dependency implicit task for cooling (in->cooling->out) */
struct task *cooling_out;
/*! Task for cooling */
struct task *cooling;
/*! Task for star formation */
struct task *star_formation;
/*! Task for sorting the stars again after a SF event */
struct task *stars_resort;
/*! Last (integer) time the cell's part were drifted forward in time. */
integertime_t ti_old_part;
/*! Maximum end of (integer) time step in this cell for hydro tasks. */
integertime_t ti_end_max;
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
#endif
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Maximum particle movement in this cell since the last sort. */
float dx_max_sort;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Values of dx_max_sort before the drifts, used for sub-cell tasks. */
float dx_max_sort_old;
/*! Nr of #part this cell can hold after addition of new #part. */
int count_total;
/*! Bit mask of sort directions that will be needed in the next timestep. */
uint16_t requires_sorts;
/*! Bit mask of sorts that need to be computed for this cell. */
uint16_t do_sort;
/*! Bit-mask indicating the sorted directions */
uint16_t sorted;
/*! Bit-mask indicating the sorted directions */
uint16_t sort_allocated;
#ifdef NONE_SPH
};
#endif
/*! Minimum end of (integer) time step in this cell for hydro tasks. */
integertime_t ti_end_min;
/*! Maximum beginning of (integer) time step in this cell for hydro tasks.
*/
integertime_t ti_beg_max;
/*! Spin lock for various uses (#part case). */
swift_lock_type lock;
/*! Max smoothing length in this cell. */
float h_max;
/*! Nr of #part in this cell. */
int count;
/*! Number of #part updated in this cell. */
int updated;
/*! Is the #part data of this cell being used in a sub-cell? */
int hold;
};
#endif /* SWIFT_CELL_HYDRO_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leidenuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_CELL_SINKS_H
#define SWIFT_CELL_SINKS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "timeline.h"
struct cell_sinks {
#ifdef SINK_NONE
union {
#endif
/*! Pointer to the #sink data. */
struct sink *parts;
/*! The drift task for sinks */
struct task *drift;
/*! Last (integer) time the cell's sink were drifted forward in time. */
integertime_t ti_old_part;
/*! Maximum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_max;
/*! Nr of #sink this cell can hold after addition of new one. */
int count_total;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
#ifdef SINK_NONE
};
#endif
/*! Minimum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_min;
/*! Maximum beginning of (integer) time step in this cell for sink
* tasks. */
integertime_t ti_beg_max;
/*! Spin lock for various uses (#sink case). */
swift_lock_type lock;
/*! Number of #sink updated in this cell. */
int updated;
/*! Is the #sink data of this cell being used in a sub-cell? */
int hold;
/*! Nr of #sink in this cell. */
int count;
};
#endif /* SWIFT_CELL_SINKS_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leidenuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_CELL_STARS_H
#define SWIFT_CELL_STARS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "star_formation_logger_struct.h"
#include "task.h"
#include "timeline.h"
struct cell_stars {
#ifdef STARS_NONE
union {
#endif
/*! Pointer to the #spart data. */
struct spart *parts;
/*! Pointer to the #spart data at rebuild time. */
struct spart *parts_rebuild;
/*! The star ghost task itself */
struct task *ghost;
/*! Linked list of the tasks computing this cell's star density. */
struct link *density;
/*! Linked list of the tasks computing this cell's star feedback. */
struct link *feedback;
/*! The task computing this cell's sorts before the density. */
struct task *sorts;
/*! The drift task for sparts */
struct task *drift;
/*! Implicit tasks marking the entry of the stellar physics block of tasks
*/
struct task *stars_in;
/*! Implicit tasks marking the exit of the stellar physics block of tasks */
struct task *stars_out;
/*! Pointer for the sorted indices. */
struct sort_entry *sort;
/*! Last (integer) time the cell's spart were drifted forward in time. */
integertime_t ti_old_part;
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_max;
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
#endif
/*! Star formation history struct */
struct star_formation_history sfh;
/*! Nr of #spart this cell can hold after addition of new #spart. */
int count_total;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Maximum particle movement in this cell since the last sort. */
float dx_max_sort;
/*! Values of dx_max_sort before the drifts, used for sub-cell tasks. */
float dx_max_sort_old;
/*! Spin lock for star formation use. */
swift_lock_type star_formation_lock;
/*! Bit mask of sort directions that will be needed in the next timestep. */
uint16_t requires_sorts;
/*! Bit-mask indicating the sorted directions */
uint16_t sorted;
/*! Bit-mask indicating the sorted directions */
uint16_t sort_allocated;
/*! Bit mask of sorts that need to be computed for this cell. */
uint16_t do_sort;
#ifdef STARS_NONE
};
#endif
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_min;
/*! Maximum beginning of (integer) time step in this cell for star tasks.
*/
integertime_t ti_beg_max;
/*! Spin lock for various uses (#spart case). */
swift_lock_type lock;
/*! Max smoothing length in this cell. */
float h_max;
/*! Number of #spart updated in this cell. */
int updated;
/*! Nr of #spart in this cell. */
int count;
/*! Is the #spart data of this cell being used in a sub-cell? */
int hold;
};
#endif /* SWIFT_CELL_STARS_H */
......@@ -40,7 +40,9 @@
#include "space.h"
/* Import the right hydro definition */
#if defined(MINIMAL_SPH)
#if defined(NONE_SPH)
#include "./hydro/None/hydro_debug.h"
#elif defined(MINIMAL_SPH)
#include "./hydro/Minimal/hydro_debug.h"
#elif defined(GADGET2_SPH)
#include "./hydro/Gadget2/hydro_debug.h"
......
......@@ -141,6 +141,16 @@ int engine_current_step;
extern int engine_max_parts_per_ghost;
extern int engine_max_sparts_per_ghost;
long long sort_array_counts;
long long sort_array_memory;
long long sort_array_directions;
long long max_ghost_memory;
long long max_dopair2_memory;
long long max_doself1_memory;
long long max_doself2_memory;
/**
* @brief Link a density/force task to a cell.
*
......@@ -265,11 +275,12 @@ void engine_repartition(struct engine *e) {
*/
void engine_repartition_trigger(struct engine *e) {
static int opened = 0;
if (e->restarting) opened = 1;
#ifdef WITH_MPI
const ticks tic = getticks();
static int opened = 0;
if (e->restarting) opened = 1;
/* Do nothing if there have not been enough steps since the last repartition
* as we don't want to repeat this too often or immediately after a
......@@ -429,7 +440,8 @@ void engine_repartition_trigger(struct engine *e) {
if (abs_trigger > 1.f) abs_trigger = 0.f; /* Not relevant. */
fprintf(timelog,
"# %d balance: %f, expected: %f (sys: %f, total: %f)\n",
e->step, balance, abs_trigger, (smaxtime - smintime) / smean,
e->step, balance, abs_trigger,
(smaxtime - smintime) / (smean + FLT_MIN),
(tmaxtime - tmintime) / tmean);
fclose(timelog);
......@@ -450,6 +462,28 @@ void engine_repartition_trigger(struct engine *e) {
if (e->verbose)
message("took %.3f %s", clocks_from_ticks(getticks() - tic),
clocks_getunit());
#else
/* Get the resident size of the process for the memory logs. */
long size, resident, shared, text, library, data, dirty;
memuse_use(&size, &resident, &shared, &text, &data, &library, &dirty);
/* Keep logs of all CPU times and resident memory size for debugging
* load issues. */
FILE *memlog = NULL;
if (!opened) {
memlog = fopen("rank_memory_balance.log", "w");
fprintf(memlog, "# step rank resident\n");
opened = 1;
} else {
memlog = fopen("rank_memory_balance.log", "a");
}
fprintf(memlog, "# %d mean resident memory: %f, balance: %f\n", e->step,
(double)resident, 0.);
fclose(memlog);
#endif
}
......@@ -1309,6 +1343,7 @@ void engine_allocate_foreign_particles(struct engine *e) {
tic = getticks();
/* Allocate space for the foreign particles we will receive */
size_t old_size_parts_foreign = s->size_parts_foreign;
if (count_parts_in > s->size_parts_foreign) {
if (s->parts_foreign != NULL) swift_free("parts_foreign", s->parts_foreign);
s->size_parts_foreign = engine_foreign_alloc_margin * count_parts_in;
......@@ -1318,6 +1353,7 @@ void engine_allocate_foreign_particles(struct engine *e) {
}
/* Allocate space for the foreign particles we will receive */
size_t old_size_gparts_foreign = s->size_gparts_foreign;
if (count_gparts_in > s->size_gparts_foreign) {
if (s->gparts_foreign != NULL)
swift_free("gparts_foreign", s->gparts_foreign);
......@@ -1329,6 +1365,7 @@ void engine_allocate_foreign_particles(struct engine *e) {
}
/* Allocate space for the foreign particles we will receive */
size_t old_size_sparts_foreign = s->size_sparts_foreign;
if (count_sparts_in > s->size_sparts_foreign) {
if (s->sparts_foreign != NULL)
swift_free("sparts_foreign", s->sparts_foreign);
......@@ -1340,6 +1377,7 @@ void engine_allocate_foreign_particles(struct engine *e) {
}
/* Allocate space for the foreign particles we will receive */
size_t old_size_bparts_foreign = s->size_bparts_foreign;
if (count_bparts_in > s->size_bparts_foreign) {
if (s->bparts_foreign != NULL)
swift_free("bparts_foreign", s->bparts_foreign);
......@@ -1350,7 +1388,7 @@ void engine_allocate_foreign_particles(struct engine *e) {
error("Failed to allocate foreign bpart data.");
}
if (e->verbose)
if (e->verbose) {
message(
"Allocating %zd/%zd/%zd/%zd foreign part/gpart/spart/bpart "
"(%zd/%zd/%zd/%zd MB)",
......@@ -1361,6 +1399,28 @@ void engine_allocate_foreign_particles(struct engine *e) {
s->size_sparts_foreign * sizeof(struct spart) / (1024 * 1024),
s->size_bparts_foreign * sizeof(struct bpart) / (1024 * 1024));
if ((s->size_parts_foreign - old_size_parts_foreign) > 0 ||
(s->size_gparts_foreign - old_size_gparts_foreign) > 0 ||
(s->size_sparts_foreign - old_size_sparts_foreign) > 0 ||
(s->size_bparts_foreign - old_size_bparts_foreign) > 0) {
message(
"Re-allocations %zd/%zd/%zd/%zd part/gpart/spart/bpart "
"(%zd/%zd/%zd/%zd MB)",
(s->size_parts_foreign - old_size_parts_foreign),
(s->size_gparts_foreign - old_size_gparts_foreign),
(s->size_sparts_foreign - old_size_sparts_foreign),
(s->size_bparts_foreign - old_size_bparts_foreign),
(s->size_parts_foreign - old_size_parts_foreign) *
sizeof(struct part) / (1024 * 1024),
(s->size_gparts_foreign - old_size_gparts_foreign) *
sizeof(struct gpart) / (1024 * 1024),
(s->size_sparts_foreign - old_size_sparts_foreign) *
sizeof(struct spart) / (1024 * 1024),
(s->size_bparts_foreign - old_size_bparts_foreign) *
sizeof(struct bpart) / (1024 * 1024));
}
}
/* Unpack the cells and link to the particle data. */
struct part *parts = s->parts_foreign;
struct gpart *gparts = s->gparts_foreign;
......@@ -2122,6 +2182,11 @@ void engine_launch(struct engine *e, const char *call) {
space_reset_task_counters(e->s);
#endif
max_ghost_memory = 0;
max_dopair2_memory = 0;
max_doself1_memory = 0;
max_doself2_memory = 0;
/* Prepare the scheduler. */
atomic_inc(&e->sched.waiting);
......@@ -2616,10 +2681,10 @@ void engine_step(struct engine *e) {
engine_drift_top_multipoles(e);
}
#ifdef WITH_MPI
//#ifdef WITH_MPI
/* Repartition the space amongst the nodes? */
engine_repartition_trigger(e);
#endif
//#endif
/* Prepare the tasks to be launched, rebuild or repartition if needed. */
engine_prepare(e);
......@@ -2702,6 +2767,17 @@ void engine_step(struct engine *e) {
e->systime_last_step = end_systime - start_systime;
#endif
message(
"SORT number of arrays: %lld number of directions: %lld mem usage: %lld "
"MB",
sort_array_counts, sort_array_directions,
sort_array_memory / (1024 * 1024));
message("GHOST max mem usage: %lld MB", max_ghost_memory / (1024 * 1024));
message("DOPAIR2 max mem usage: %lld MB", max_dopair2_memory/ (1024 * 1024));
message("DOSELF1 max mem usage: %lld MB", max_doself1_memory/ (1024 * 1024));
message("DOSELF2 max mem usage: %lld MB", max_doself2_memory/ (1024 * 1024));
/* Since the time-steps may have changed because of the limiter's
* action, we need to communicate the new time-step sizes */
if ((e->policy & engine_policy_timestep_sync) ||
......@@ -3179,7 +3255,8 @@ void engine_makeproxies(struct engine *e) {
/* Prepare the proxies and the proxy index. */
if (e->proxy_ind == NULL)
if ((e->proxy_ind = (int *)malloc(sizeof(int) * e->nr_nodes)) == NULL)
if ((e->proxy_ind = (int *)swift_malloc("engine.proxy_ind",
sizeof(int) * e->nr_nodes)) == NULL)
error("Failed to allocate proxy index.");
for (int k = 0; k < e->nr_nodes; k++) e->proxy_ind[k] = -1;
e->nr_proxies = 0;
......@@ -3883,6 +3960,10 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
struct fof_props *fof_properties,
struct los_props *los_properties) {
sort_array_counts = 0;
sort_array_memory = 0;
sort_array_directions = 0;
/* Clean-up everything */
bzero(e, sizeof(struct engine));
......@@ -4265,8 +4346,8 @@ void engine_config(int restart, int fof, struct engine *e,
error("SWIFT was not compiled with MPI support.");
#else
e->policy |= engine_policy_mpi;
if ((e->proxies = (struct proxy *)calloc(sizeof(struct proxy),
engine_maxproxies)) == NULL)
if ((e->proxies = (struct proxy *)swift_calloc(
"engine.proxy", sizeof(struct proxy), engine_maxproxies)) == NULL)
error("Failed to allocate memory for proxies.");
e->nr_proxies = 0;
......@@ -5387,8 +5468,8 @@ void engine_clean(struct engine *e, const int fof, const int restart) {
for (int i = 0; i < e->nr_proxies; ++i) {
proxy_clean(&e->proxies[i]);
}
free(e->proxy_ind);
free(e->proxies);
swift_free("engine.proxy_ind", e->proxy_ind);
swift_free("engine.proxy", e->proxies);
/* Free types */
part_free_mpi_types();
......@@ -5397,6 +5478,7 @@ void engine_clean(struct engine *e, const int fof, const int restart) {
proxy_free_mpi_type();
task_free_mpi_comms();
mpicollect_free_MPI_type();
partition_free_celllist(e->reparttype);
#endif
/* Close files */
......
This diff is collapsed.
......@@ -51,6 +51,7 @@
#include "debug.h"
#include "error.h"
#include "proxy.h"
#include "star_formation.h"
#include "timers.h"
/**
......@@ -709,8 +710,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if (cell_need_rebuild_for_black_holes_pair(ci, cj)) *rebuild_space = 1;
if (cell_need_rebuild_for_black_holes_pair(cj, ci)) *rebuild_space = 1;
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost_0);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost_0);
#ifdef WITH_MPI
/* Activate the send/recv tasks. */
......@@ -983,7 +984,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
else if (t_type == task_type_star_formation) {
if (cell_is_active_hydro(t->ci, e)) {
cell_activate_star_formation_tasks(t->ci, s, with_feedback);
cell_activate_super_spart_drifts(t->ci, s);
if (swift_star_formation_model_creates_stars)
cell_activate_super_spart_drifts(t->ci, s);
}
}
}
......
......@@ -615,7 +615,8 @@ void engine_redistribute(struct engine *e) {
nr_gparts -= 1;
/* Swap the particle */
memswap(&s->gparts[k], &s->gparts[nr_gparts], sizeof(struct gpart));
memswap_unaligned(&s->gparts[k], &s->gparts[nr_gparts],
sizeof(struct gpart));
/* Swap the link with part/spart */
if (s->gparts[k].type == swift_type_gas) {
......@@ -646,7 +647,8 @@ void engine_redistribute(struct engine *e) {
/* Allocate temporary arrays to store the counts of particles to be sent
* and the destination of each particle */
int *counts;
if ((counts = (int *)calloc(sizeof(int), nr_nodes * nr_nodes)) == NULL)
if ((counts = (int *)swift_calloc("counts", sizeof(int),
nr_nodes * nr_nodes)) == NULL)
error("Failed to allocate counts temporary buffer.");
int *dest;
......@@ -655,7 +657,7 @@ void engine_redistribute(struct engine *e) {
/* Simple index of node IDs, used for mappers over nodes. */
int *nodes = NULL;
if ((nodes = (int *)malloc(sizeof(int) * nr_nodes)) == NULL)
if ((nodes = (int *)swift_malloc("nodes", sizeof(int) * nr_nodes)) == NULL)
error("Failed to allocate nodes temporary buffer.");
for (int k = 0; k < nr_nodes; k++) nodes[k] = k;
......@@ -725,7 +727,8 @@ void engine_redistribute(struct engine *e) {
/* Get destination of each s-particle */
int *s_counts;
if ((s_counts = (int *)calloc(sizeof(int), nr_nodes * nr_nodes)) == NULL)
if ((s_counts = (int *)swift_calloc("s_counts", sizeof(int),
nr_nodes * nr_nodes)) == NULL)
error("Failed to allocate s_counts temporary buffer.");
int *s_dest;
......@@ -791,7 +794,8 @@ void engine_redistribute(struct engine *e) {
/* Get destination of each b-particle */
int *b_counts;
if ((b_counts = (int *)calloc(sizeof(int), nr_nodes * nr_nodes)) == NULL)
if ((b_counts = (int *)swift_calloc("b_counts", sizeof(int),
nr_nodes * nr_nodes)) == NULL)
error("Failed to allocate b_counts temporary buffer.");
int *b_dest;
......@@ -857,7 +861,8 @@ void engine_redistribute(struct engine *e) {
/* Get destination of each g-particle */
int *g_counts;
if ((g_counts = (int *)calloc(sizeof(int), nr_nodes * nr_nodes)) == NULL)
if ((g_counts = (int *)swift_calloc("g_counts", sizeof(int),
nr_nodes * nr_nodes)) == NULL)
error("Failed to allocate g_gcount temporary buffer.");
int *g_dest;
......@@ -1144,13 +1149,13 @@ void engine_redistribute(struct engine *e) {
threadpool_map(&e->threadpool, engine_redistribute_relink_mapper, nodes,
nr_nodes, sizeof(int), 1, &relink_data);
free(nodes);
swift_free("nodes", nodes);
/* Clean up the counts now we are done. */
free(counts);
free(g_counts);
free(s_counts);
free(b_counts);
swift_free("counts", counts);
swift_free("g_counts", g_counts);
swift_free("s_counts", s_counts);
swift_free("b_counts", b_counts);
#ifdef SWIFT_DEBUG_CHECKS
/* Verify that all parts are in the right place. */
......
......@@ -28,6 +28,7 @@
#include "active.h"
#include "cell.h"
#include "memswap.h"
#include "star_formation.h"
/* Load the profiler header, if needed. */
#ifdef WITH_PROFILER
......@@ -257,7 +258,8 @@ void engine_do_unskip_mapper(void *map_data, int num_elements,
struct cell *const cells_top = e->s->cells_top;
/* What policies are we running? */
const int with_star_formation = e->policy & engine_policy_star_formation;
const int with_star_formation = swift_star_formation_model_creates_stars &&
(e->policy & engine_policy_star_formation);
/* The current chunk of active cells */
const int *const local_cells = (int *)map_data;
......
......@@ -101,7 +101,6 @@ struct gpart {
long long num_interacted_p2p;
long long num_interacted_pm;
#endif
} SWIFT_STRUCT_ALIGN;
};
#endif /* SWIFT_DEFAULT_GRAVITY_PART_H */
......@@ -60,7 +60,9 @@ __attribute__((always_inline)) INLINE static float gravity_get_softening(
__attribute__((always_inline)) INLINE static void
gravity_add_comoving_potential(struct gpart* restrict gp, float pot) {
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
gp->potential += pot;
#endif
}
/**
......@@ -71,7 +73,11 @@ gravity_add_comoving_potential(struct gpart* restrict gp, float pot) {
__attribute__((always_inline)) INLINE static float
gravity_get_comoving_potential(const struct gpart* restrict gp) {
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
return gp->potential;
#else
return 0.f;
#endif
}
/**
......@@ -84,7 +90,11 @@ __attribute__((always_inline)) INLINE static float
gravity_get_physical_potential(const struct gpart* restrict gp,
const struct cosmology* cosmo) {
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
return gp->potential * cosmo->a_inv;
#else
return 0.f;
#endif
}
/**
......@@ -141,7 +151,9 @@ __attribute__((always_inline)) INLINE static void gravity_init_gpart(
gp->a_grav[0] = 0.f;
gp->a_grav[1] = 0.f;
gp->a_grav[2] = 0.f;
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
gp->potential = 0.f;
#endif
#ifdef SWIFT_GRAVITY_FORCE_CHECKS
gp->potential_PM = 0.f;
......@@ -186,8 +198,10 @@ __attribute__((always_inline)) INLINE static void gravity_end_force(
struct gpart* gp, const float const_G, const float potential_normalisation,
const int periodic, const int with_self_gravity) {
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
/* Apply the periodic correction to the peculiar potential */
if (periodic) gp->potential += potential_normalisation;
#endif
/* Record the norm of the acceleration for the adaptive opening criteria.
* Will always be an (active) timestep behind. */
......@@ -206,7 +220,9 @@ __attribute__((always_inline)) INLINE static void gravity_end_force(
gp->a_grav[0] *= const_G;
gp->a_grav[1] *= const_G;
gp->a_grav[2] *= const_G;
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
gp->potential *= const_G;
#endif
#ifdef SWIFT_GRAVITY_FORCE_CHECKS
gp->potential_PM *= const_G;
......
......@@ -27,7 +27,7 @@ __attribute__((always_inline)) INLINE static void gravity_debug_particle(
"a=[%.5e,%.5e,%.5e], pot=%.5e\n",
p->mass, p->time_bin, p->x[0], p->x[1], p->x[2], p->v_full[0],
p->v_full[1], p->v_full[2], (int)p->type, p->a_grav[0], p->a_grav[1],
p->a_grav[2], p->potential);
p->a_grav[2], gravity_get_comoving_potential(p));
#ifdef SWIFT_DEBUG_CHECKS
printf("num_interacted=%lld ti_drift=%lld ti_kick=%lld\n", p->num_interacted,
p->ti_drift, p->ti_kick);
......
......@@ -37,8 +37,10 @@ struct gpart {
/*! Particle acceleration. */
float a_grav[3];
#ifndef SWIFT_GRAVITY_NO_POTENTIAL
/*! Gravitational potential */
float potential;
#endif
/*! Particle mass. */
float mass;
......@@ -105,7 +107,6 @@ struct gpart {
long long num_interacted_p2p;
long long num_interacted_pm;
#endif
} SWIFT_STRUCT_ALIGN;
};
#endif /* SWIFT_MULTI_SOFTENING_GRAVITY_PART_H */
......@@ -87,7 +87,6 @@ struct gpart {
/* Brute-force particle potential. */
double potential_exact;
#endif
} SWIFT_STRUCT_ALIGN;
};
#endif /* SWIFT_POTENTIAL_GRAVITY_PART_H */
......@@ -29,7 +29,11 @@
#include "part.h"
/* Import the right functions */
#if defined(MINIMAL_SPH)
#if defined(NONE_SPH)
#include "./hydro/None/hydro.h"
#include "./hydro/None/hydro_iact.h"
#define SPH_IMPLEMENTATION "No hydro scheme"
#elif defined(MINIMAL_SPH)
#include "./hydro/Minimal/hydro.h"
#include "./hydro/Minimal/hydro_iact.h"
#define SPH_IMPLEMENTATION "Minimal version of SPH (e.g. Price 2010)"
......
This diff is collapsed.
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leideuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_NONE_HYDRO_DEBUG_H
#define SWIFT_NONE_HYDRO_DEBUG_H
/**
* @file None/hydro_debug.h
* @brief Empty implementation.
*/
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
const struct part* p, const struct xpart* xp) {
error("Empty implementation");
}
#endif /* SWIFT_NONE_HYDRO_DEBUG_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leideuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_NONE_HYDRO_IACT_H
#define SWIFT_NONE_HYDRO_IACT_H
/**
* @file None/hydro_iact.h
* @brief Empty implementation
*/
#include "adiabatic_index.h"
#include "hydro_parameters.h"
#include "minmax.h"
/**
* @brief Density interaction between two particles.
*
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle.
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_density(
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {}
/**
* @brief Density interaction between two particles (non-symmetric).
*
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle (not updated).
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
const struct part *restrict pj, float a, float H) {}
/**
* @brief Force interaction between two particles.
*
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle.
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_force(
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {}
/**
* @brief Force interaction between two particles (non-symmetric).
*
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle (not updated).
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
const struct part *restrict pj, float a, float H) {}
#endif /* SWIFT_NONE_HYDRO_IACT_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leideuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_NONE_HYDRO_IO_H
#define SWIFT_NONE_HYDRO_IO_H
/**
* @file None/hydro_io.h
* @brief Empty implementation.
*/
#include "adiabatic_index.h"
#include "hydro.h"
#include "hydro_parameters.h"
#include "io_properties.h"
#include "kernel_hydro.h"
/**
* @brief Specifies which particle fields to read from a dataset
*
* @param parts The particle array.
* @param list The list of i/o properties to read.
* @param num_fields The number of i/o fields to read.
*/
INLINE static void hydro_read_particles(struct part* parts,
struct io_props* list,
int* num_fields) {
*num_fields = 0;
}
INLINE static void convert_part_pos(const struct engine* e,
const struct part* p,
const struct xpart* xp, double* ret) {
const struct space* s = e->s;
if (s->periodic) {
ret[0] = box_wrap(p->x[0] - s->pos_dithering[0], 0.0, s->dim[0]);
ret[1] = box_wrap(p->x[1] - s->pos_dithering[1], 0.0, s->dim[1]);
ret[2] = box_wrap(p->x[2] - s->pos_dithering[2], 0.0, s->dim[2]);
} else {
ret[0] = p->x[0];
ret[1] = p->x[1];
ret[2] = p->x[2];
}
}
INLINE static void convert_part_vel(const struct engine* e,
const struct part* p,
const struct xpart* xp, float* ret) {
const int with_cosmology = (e->policy & engine_policy_cosmology);
const struct cosmology* cosmo = e->cosmology;
const integertime_t ti_current = e->ti_current;
const double time_base = e->time_base;
const integertime_t ti_beg = get_integer_time_begin(ti_current, p->time_bin);
const integertime_t ti_end = get_integer_time_end(ti_current, p->time_bin);
/* Get time-step since the last kick */
float dt_kick_grav, dt_kick_hydro;
if (with_cosmology) {
dt_kick_grav = cosmology_get_grav_kick_factor(cosmo, ti_beg, ti_current);
dt_kick_grav -=
cosmology_get_grav_kick_factor(cosmo, ti_beg, (ti_beg + ti_end) / 2);
dt_kick_hydro = cosmology_get_hydro_kick_factor(cosmo, ti_beg, ti_current);
dt_kick_hydro -=
cosmology_get_hydro_kick_factor(cosmo, ti_beg, (ti_beg + ti_end) / 2);
} else {
dt_kick_grav = (ti_current - ((ti_beg + ti_end) / 2)) * time_base;
dt_kick_hydro = (ti_current - ((ti_beg + ti_end) / 2)) * time_base;
}
/* Extrapolate the velocites to the current time */
hydro_get_drifted_velocities(p, xp, dt_kick_hydro, dt_kick_grav, ret);
/* Conversion from internal units to peculiar velocities */
ret[0] *= cosmo->a_inv;
ret[1] *= cosmo->a_inv;
ret[2] *= cosmo->a_inv;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
* @param parts The particle array.
* @param xparts The extended particle array.
* @param list The list of i/o properties to write.
* @param num_fields The number of i/o fields to write.
*/
INLINE static void hydro_write_particles(const struct part* parts,
const struct xpart* xparts,
struct io_props* list,
int* num_fields) {
*num_fields = 0;
}
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
*/
INLINE static void hydro_write_flavour(hid_t h_grpsph) {}
/**
* @brief Are we writing entropy in the internal energy field ?
*
* @return 1 if entropy is in 'internal energy', 0 otherwise.
*/
INLINE static int writeEntropyFlag(void) { return 0; }
#endif /* SWIFT_NONE_HYDRO_IO_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Matthieu Schaller (schaller@strw.leideuniv.nl)
*
* 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/>.
*
******************************************************************************/
#ifndef SWIFT_NONE_HYDRO_PARAMETERS_H
#define SWIFT_NONE_HYDRO_PARAMETERS_H
/* Configuration file */
#include "config.h"
/* Global headers */
#if defined(HAVE_HDF5)
#include <hdf5.h>
#endif
/* Local headers */
#include "common_io.h"
#include "error.h"
#include "inline.h"
/**
* @file None/hydro_parameters.h
* @brief Empty implementation
*
* This file defines a number of things that are used in
* hydro_properties.c as defaults for run-time parameters
* as well as a number of compile-time parameters.
*/
/* Viscosity parameters -- FIXED -- MUST BE DEFINED AT COMPILE-TIME */
/* Cosmology default beta=3.0.
* Alpha can be set in the parameter file.
* Beta is defined as in e.g. Price (2010) Eqn (103) */
/* Structs that store the relevant variables */
/*! Artificial viscosity parameters */
struct viscosity_global_data {};
/*! Thermal diffusion parameters */
struct diffusion_global_data {};
/* Functions for reading from parameter file */
/* Forward declartions */
struct swift_params;
struct phys_const;
struct unit_system;
/* Viscosity */
/**
* @brief Initialises the viscosity parameters in the struct from
* the parameter file, or sets them to defaults.
*
* @param params: the pointer to the swift_params file
* @param us: pointer to the internal unit system
* @param phys_const: pointer to the physical constants system
* @param viscosity: pointer to the viscosity_global_data struct to be filled.
**/
static INLINE void viscosity_init(struct swift_params* params,
const struct unit_system* us,
const struct phys_const* phys_const,
struct viscosity_global_data* viscosity) {}
/**
* @brief Initialises a viscosity struct to sensible numbers for mocking
* purposes.
*
* @param viscosity: pointer to the viscosity_global_data struct to be filled.
**/
static INLINE void viscosity_init_no_hydro(
struct viscosity_global_data* viscosity) {}
/**
* @brief Prints out the viscosity parameters at the start of a run.
*
* @param viscosity: pointer to the viscosity_global_data struct found in
* hydro_properties
**/
static INLINE void viscosity_print(
const struct viscosity_global_data* viscosity) {}
#if defined(HAVE_HDF5)
/**