From 47bc14383ff965542687c89f5855888e3fbf265d Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Mon, 6 Aug 2018 14:07:20 +0100 Subject: [PATCH] Created a separate variable to hold the step interval between STF outputs. --- examples/EAGLE_25/eagle_25.yml | 2 +- examples/EAGLE_6/eagle_6.yml | 2 +- examples/SmallCosmoVolume/small_cosmo_volume.yml | 2 +- src/engine.c | 12 +++++++----- src/engine.h | 1 + 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/EAGLE_25/eagle_25.yml b/examples/EAGLE_25/eagle_25.yml index 01b58cf115..30567bd25b 100644 --- a/examples/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_25/eagle_25.yml @@ -14,7 +14,7 @@ StructureFinding: scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) time_first: 0.01 # Time of the first structure finding output (in internal units). delta_step: 1000 # Time difference between consecutive structure finding outputs (in internal units) in simulation steps. - delta_time: 1e-4 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. + delta_time: 1.10 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. # Cosmological parameters Cosmology: diff --git a/examples/EAGLE_6/eagle_6.yml b/examples/EAGLE_6/eagle_6.yml index bd456d0834..aae25e360a 100644 --- a/examples/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_6/eagle_6.yml @@ -14,7 +14,7 @@ StructureFinding: scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) time_first: 0.01 # Time of the first structure finding output (in internal units). delta_step: 1000 # Time difference between consecutive structure finding outputs (in internal units) in simulation steps. - delta_time: 1e-4 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. + delta_time: 1.10 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. # Cosmological parameters Cosmology: diff --git a/examples/SmallCosmoVolume/small_cosmo_volume.yml b/examples/SmallCosmoVolume/small_cosmo_volume.yml index db00e6c2e5..fad6d122a7 100644 --- a/examples/SmallCosmoVolume/small_cosmo_volume.yml +++ b/examples/SmallCosmoVolume/small_cosmo_volume.yml @@ -14,7 +14,7 @@ StructureFinding: scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) time_first: 0.01 # Time of the first structure finding output (in internal units). delta_step: 1000 # Time difference between consecutive structure finding outputs (in internal units) in simulation steps. - delta_time: 1e-4 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. + delta_time: 1.02 # Time difference between consecutive structure finding outputs (in internal units) in simulation time intervals. # WMAP9 cosmology Cosmology: diff --git a/src/engine.c b/src/engine.c index 62cbcb51a2..32157c0564 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4780,7 +4780,7 @@ void engine_step(struct engine *e) { /* Do we want to perform structure finding? */ if ((e->policy & engine_policy_structure_finding)) { - if(e->stf_output_freq_format == STEPS && e->step%(int)e->deltaTimeSTF == 0) + if(e->stf_output_freq_format == STEPS && e->step%e->deltaStepSTF == 0) e->run_stf = 1; else if(e->stf_output_freq_format == TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) e->run_stf = 1; @@ -5791,6 +5791,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, e->restart_dt = 0; e->timeFirstSTFOutput = 0; e->deltaTimeSTF = 0; + e->deltaStepSTF = 0; e->stf_output_freq_format = 0; e->ti_nextSTF = 0; e->run_stf = 0; @@ -5804,7 +5805,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, //velociraptor_init(e); e->stf_output_freq_format = parser_get_param_int(params, "StructureFinding:output_time_format"); if(e->stf_output_freq_format == STEPS) { - e->deltaTimeSTF = parser_get_param_int(params, "StructureFinding:delta_step"); + e->deltaStepSTF = parser_get_param_int(params, "StructureFinding:delta_step"); } else if(e->stf_output_freq_format == TIME) { e->deltaTimeSTF = parser_get_param_double(params, "StructureFinding:delta_time"); @@ -6089,9 +6090,10 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, "simulation start a=%e.", e->a_first_statistics, e->cosmology->a_begin); - if (e->policy & engine_policy_structure_finding) { + if ((e->policy & engine_policy_structure_finding) && (e->stf_output_freq_format == TIME)) { + if (e->deltaTimeSTF <= 1.) - error("Time between snapshots (%e) must be > 1.", e->deltaTimeSTF); + error("Time between STF (%e) must be > 1.", e->deltaTimeSTF); if (e->a_first_stf < e->cosmology->a_begin) error( @@ -6122,7 +6124,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, "t=%e.", e->time_first_statistics, e->time_begin); - if (e->policy & engine_policy_structure_finding) { + if ((e->policy & engine_policy_structure_finding) && (e->stf_output_freq_format == TIME)) { if (e->deltaTimeSTF <= 0.) error("Time between STF (%e) must be positive.", diff --git a/src/engine.h b/src/engine.h index 1b8b223b49..38e8fe6190 100644 --- a/src/engine.h +++ b/src/engine.h @@ -227,6 +227,7 @@ struct engine { double a_first_stf; double timeFirstSTFOutput; double deltaTimeSTF; + int deltaStepSTF; /* Integer time of the next stf output */ integertime_t ti_nextSTF; -- GitLab