Commit 47bc1438 authored by James Willis's avatar James Willis
Browse files

Created a separate variable to hold the step interval between STF outputs.

parent 3eae86b1
...@@ -14,7 +14,7 @@ StructureFinding: ...@@ -14,7 +14,7 @@ StructureFinding:
scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) 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). 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_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 # Cosmological parameters
Cosmology: Cosmology:
......
...@@ -14,7 +14,7 @@ StructureFinding: ...@@ -14,7 +14,7 @@ StructureFinding:
scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) 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). 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_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 # Cosmological parameters
Cosmology: Cosmology:
......
...@@ -14,7 +14,7 @@ StructureFinding: ...@@ -14,7 +14,7 @@ StructureFinding:
scale_factor_first: 0.92 # Scale-factor of the first snaphot (cosmological run) 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). 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_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 # WMAP9 cosmology
Cosmology: Cosmology:
......
...@@ -4780,7 +4780,7 @@ void engine_step(struct engine *e) { ...@@ -4780,7 +4780,7 @@ void engine_step(struct engine *e) {
/* Do we want to perform structure finding? */ /* Do we want to perform structure finding? */
if ((e->policy & engine_policy_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; e->run_stf = 1;
else if(e->stf_output_freq_format == TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) else if(e->stf_output_freq_format == TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0)
e->run_stf = 1; e->run_stf = 1;
...@@ -5791,6 +5791,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, ...@@ -5791,6 +5791,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
e->restart_dt = 0; e->restart_dt = 0;
e->timeFirstSTFOutput = 0; e->timeFirstSTFOutput = 0;
e->deltaTimeSTF = 0; e->deltaTimeSTF = 0;
e->deltaStepSTF = 0;
e->stf_output_freq_format = 0; e->stf_output_freq_format = 0;
e->ti_nextSTF = 0; e->ti_nextSTF = 0;
e->run_stf = 0; e->run_stf = 0;
...@@ -5804,7 +5805,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, ...@@ -5804,7 +5805,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
//velociraptor_init(e); //velociraptor_init(e);
e->stf_output_freq_format = parser_get_param_int(params, "StructureFinding:output_time_format"); e->stf_output_freq_format = parser_get_param_int(params, "StructureFinding:output_time_format");
if(e->stf_output_freq_format == STEPS) { 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) { else if(e->stf_output_freq_format == TIME) {
e->deltaTimeSTF = parser_get_param_double(params, "StructureFinding:delta_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, ...@@ -6089,9 +6090,10 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
"simulation start a=%e.", "simulation start a=%e.",
e->a_first_statistics, e->cosmology->a_begin); 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.) 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) if (e->a_first_stf < e->cosmology->a_begin)
error( error(
...@@ -6122,7 +6124,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, ...@@ -6122,7 +6124,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
"t=%e.", "t=%e.",
e->time_first_statistics, e->time_begin); 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.) if (e->deltaTimeSTF <= 0.)
error("Time between STF (%e) must be positive.", error("Time between STF (%e) must be positive.",
......
...@@ -227,6 +227,7 @@ struct engine { ...@@ -227,6 +227,7 @@ struct engine {
double a_first_stf; double a_first_stf;
double timeFirstSTFOutput; double timeFirstSTFOutput;
double deltaTimeSTF; double deltaTimeSTF;
int deltaStepSTF;
/* Integer time of the next stf output */ /* Integer time of the next stf output */
integertime_t ti_nextSTF; integertime_t ti_nextSTF;
......
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