Commit c8671f27 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add --temperature runtime flag to activate the calculation of temperature without the cooling task.

parent b1cf75a3
......@@ -21,21 +21,24 @@ Parameters:
-h, --help show this help message and exit
Simulation options:
-b, --feedback Run with stars feedback
-b, --feedback Run with stars feedback.
-c, --cosmology Run with cosmological time integration.
-C, --cooling Run with cooling
--temperature Run with temperature calculation.
-C, --cooling Run with cooling (also switches on --with-temperature).
-D, --drift-all Always drift all particles even the ones
far from active particles. This emulates
Gadget-[23] and GIZMO's default behaviours.
-F, --star-formation Run with star formation
-F, --star-formation Run with star formation.
-g, --external-gravity Run with an external gravitational potential.
-G, --self-gravity Run with self-gravity.
-M, --multipole-reconstruction Reconstruct the multipoles every time-step.
-s, --hydro Run with hydrodynamics.
-S, --stars Run with stars
-x, --velociraptor Run with structure finding
-S, --stars Run with stars.
-x, --velociraptor Run with structure finding.
Control options:
-a, --pin Pin runners using processor affinity.
-d, --dry-run Dry run. Read the parameter file, allocates
memory but does not read the particles
......
......@@ -69,21 +69,24 @@ Parameters:
-h, --help show this help message and exit
Simulation options:
-b, --feedback Run with stars feedback
-b, --feedback Run with stars feedback.
-c, --cosmology Run with cosmological time integration.
-C, --cooling Run with cooling
--temperature Run with temperature calculation.
-C, --cooling Run with cooling (also switches on --with-temperature).
-D, --drift-all Always drift all particles even the ones
far from active particles. This emulates
Gadget-[23] and GIZMO's default behaviours.
-F, --star-formation Run with star formation
-F, --star-formation Run with star formation.
-g, --external-gravity Run with an external gravitational potential.
-G, --self-gravity Run with self-gravity.
-M, --multipole-reconstruction Reconstruct the multipoles every time-step.
-s, --hydro Run with hydrodynamics.
-S, --stars Run with stars
-x, --velociraptor Run with structure finding
-S, --stars Run with stars.
-x, --velociraptor Run with structure finding.
Control options:
-a, --pin Pin runners using processor affinity.
-d, --dry-run Dry run. Read the parameter file, allocates
memory but does not read the particles
......
......@@ -16,21 +16,24 @@ can be found by typing ``./swift -h``::
-h, --help show this help message and exit
Simulation options:
-b, --feedback Run with stars feedback
-b, --feedback Run with stars feedback.
-c, --cosmology Run with cosmological time integration.
-C, --cooling Run with cooling
--temperature Run with temperature calculation.
-C, --cooling Run with cooling (also switches on --with-temperature).
-D, --drift-all Always drift all particles even the ones
far from active particles. This emulates
Gadget-[23] and GIZMO's default behaviours.
-F, --star-formation Run with star formation
-F, --star-formation Run with star formation.
-g, --external-gravity Run with an external gravitational potential.
-G, --self-gravity Run with self-gravity.
-M, --multipole-reconstruction Reconstruct the multipoles every time-step.
-s, --hydro Run with hydrodynamics.
-S, --stars Run with stars
-x, --velociraptor Run with structure finding
-S, --stars Run with stars.
-x, --velociraptor Run with structure finding.
Control options:
-a, --pin Pin runners using processor affinity.
-d, --dry-run Dry run. Read the parameter file, allocates
memory but does not read the particles
......
......@@ -146,6 +146,7 @@ int main(int argc, char *argv[]) {
int restart = 0;
int with_cosmology = 0;
int with_external_gravity = 0;
int with_temperature = 0;
int with_cooling = 0;
int with_self_gravity = 0;
int with_hydro = 0;
......@@ -173,20 +174,23 @@ int main(int argc, char *argv[]) {
struct argparse_option options[] = {
OPT_HELP(),
OPT_GROUP(" Simulation options:"),
OPT_BOOLEAN('b', "feedback", &with_feedback, "Run with stars feedback",
OPT_GROUP(" Simulation options:\n"),
OPT_BOOLEAN('b', "feedback", &with_feedback, "Run with stars feedback.",
NULL, 0, 0),
OPT_BOOLEAN('c', "cosmology", &with_cosmology,
"Run with cosmological time integration.", NULL, 0, 0),
OPT_BOOLEAN('C', "cooling", &with_cooling, "Run with cooling", NULL, 0,
0),
OPT_BOOLEAN(0, "temperature", &with_temperature,
"Run with temperature calculation.", NULL, 0, 0),
OPT_BOOLEAN('C', "cooling", &with_cooling,
"Run with cooling (also switches on --with-temperature).",
NULL, 0, 0),
OPT_BOOLEAN('D', "drift-all", &with_drift_all,
"Always drift all particles even the ones far from active "
"particles. This emulates Gadget-[23] and GIZMO's default "
"behaviours.",
NULL, 0, 0),
OPT_BOOLEAN('F', "star-formation", &with_star_formation,
"Run with star formation", NULL, 0, 0),
"Run with star formation.", NULL, 0, 0),
OPT_BOOLEAN('g', "external-gravity", &with_external_gravity,
"Run with an external gravitational potential.", NULL, 0, 0),
OPT_BOOLEAN('G', "self-gravity", &with_self_gravity,
......@@ -195,11 +199,11 @@ int main(int argc, char *argv[]) {
"Reconstruct the multipoles every time-step.", NULL, 0, 0),
OPT_BOOLEAN('s', "hydro", &with_hydro, "Run with hydrodynamics.", NULL, 0,
0),
OPT_BOOLEAN('S', "stars", &with_stars, "Run with stars", NULL, 0, 0),
OPT_BOOLEAN('S', "stars", &with_stars, "Run with stars.", NULL, 0, 0),
OPT_BOOLEAN('x', "velociraptor", &with_structure_finding,
"Run with structure finding", NULL, 0, 0),
"Run with structure finding.", NULL, 0, 0),
OPT_GROUP(" Control options:"),
OPT_GROUP(" Control options:\n"),
OPT_BOOLEAN('a', "pin", &with_aff,
"Pin runners using processor affinity.", NULL, 0, 0),
OPT_BOOLEAN('d', "dry-run", &dry_run,
......@@ -854,7 +858,8 @@ int main(int argc, char *argv[]) {
/* Initialise the cooling function properties */
bzero(&cooling_func, sizeof(struct cooling_function_data));
if (with_cooling) cooling_init(params, &us, &prog_const, &cooling_func);
if (with_cooling || with_temperature)
cooling_init(params, &us, &prog_const, &cooling_func);
if (myrank == 0) cooling_print(&cooling_func);
/* Initialise the chemistry */
......@@ -872,6 +877,7 @@ int main(int argc, char *argv[]) {
if (with_external_gravity)
engine_policies |= engine_policy_external_gravity;
if (with_cosmology) engine_policies |= engine_policy_cosmology;
if (with_temperature) engine_policies |= engine_policy_temperature;
if (with_cooling) engine_policies |= engine_policy_cooling;
if (with_stars) engine_policies |= engine_policy_stars;
if (with_star_formation) engine_policies |= engine_policy_star_formation;
......@@ -1209,7 +1215,7 @@ int main(int argc, char *argv[]) {
if (with_verbose_timers) timers_close_file();
if (with_cosmology) cosmology_clean(e.cosmology);
if (with_self_gravity) pm_mesh_clean(e.mesh);
if (with_cooling) cooling_clean(&cooling_func);
if (with_cooling || with_temperature) cooling_clean(&cooling_func);
engine_clean(&e);
free(params);
......
......@@ -671,7 +671,7 @@ float cooling_get_temperature(
if (cooling->Redshifts == NULL)
error(
"Cooling function has not been initialised. Did you forget the "
"--cooling runtime flag?");
"--temperature runtime flag?");
#endif
/* Get physical internal energy */
......
......@@ -108,6 +108,7 @@ const char *engine_policy_names[] = {"none",
"cosmological integration",
"drift everything",
"reconstruct multi-poles",
"temperature",
"cooling",
"stars",
"structure finding",
......@@ -2717,7 +2718,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
space_init_sparts(s, e->verbose);
/* Update the cooling function */
if (e->policy & engine_policy_cooling)
if ((e->policy & engine_policy_cooling) ||
(e->policy & engine_policy_temperature))
cooling_update(e->cosmology, e->cooling_func, /*restart_flag=*/0);
#ifdef WITH_LOGGER
......@@ -2973,7 +2975,8 @@ void engine_step(struct engine *e) {
}
/* Update the cooling function */
if (e->policy & engine_policy_cooling)
if ((e->policy & engine_policy_cooling) ||
(e->policy & engine_policy_temperature))
cooling_update(e->cosmology, e->cooling_func, /*restart_flag=*/0);
/*****************************************************/
......
......@@ -69,13 +69,14 @@ enum engine_policy {
engine_policy_cosmology = (1 << 10),
engine_policy_drift_all = (1 << 11),
engine_policy_reconstruct_mpoles = (1 << 12),
engine_policy_cooling = (1 << 13),
engine_policy_stars = (1 << 14),
engine_policy_structure_finding = (1 << 15),
engine_policy_star_formation = (1 << 16),
engine_policy_feedback = (1 << 17)
engine_policy_temperature = (1 << 13),
engine_policy_cooling = (1 << 14),
engine_policy_stars = (1 << 15),
engine_policy_structure_finding = (1 << 16),
engine_policy_star_formation = (1 << 17),
engine_policy_feedback = (1 << 18)
};
#define engine_maxpolicy 18
#define engine_maxpolicy 19
extern const char *engine_policy_names[engine_maxpolicy + 1];
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment