Commit 07f1e5b1 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'cosmo_io' into 'master'

More cosmology work

Closes #407 and #404

See merge request !516
parents a727dda0 4f946aa2
......@@ -37,15 +37,18 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.85 # Opening angle (Multipole acceptance criterion)
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions
InitialConditions:
file_name: ./EAGLE_ICs_100.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../swift -s -t 16 eagle_100.yml 2>&1 | tee output.log
../swift -c -s -t 16 eagle_100.yml 2>&1 | tee output.log
......@@ -38,16 +38,18 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.85 # Opening angle (Multipole acceptance criterion)
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions
InitialConditions:
file_name: ./EAGLE_ICs_12.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../swift -s -t 16 eagle_12.yml 2>&1 | tee output.log
../swift -c -s -t 16 eagle_12.yml 2>&1 | tee output.log
......@@ -38,16 +38,19 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.85 # Opening angle (Multipole acceptance criterion)
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions
InitialConditions:
file_name: ./EAGLE_ICs_25.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../swift -s -t 16 eagle_25.yml 2>&1 | tee output.log
../swift -c -s -t 16 eagle_25.yml 2>&1 | tee output.log
......@@ -37,16 +37,19 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.85 # Opening angle (Multipole acceptance criterion)
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions
InitialConditions:
file_name: ./EAGLE_ICs_50.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../swift -s -t 16 eagle_50.yml 2>&1 | tee output.log
../swift -c -s -t 16 eagle_50.yml 2>&1 | tee output.log
......@@ -28,7 +28,7 @@ TimeIntegration:
# Parameters governing the snapshots
Snapshots:
basename: eagle # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units)
time_first: 1. # Time of the first output (in internal units)
delta_time: 1e-3 # Time difference between consecutive outputs (in internal units)
compression: 4
......@@ -38,16 +38,19 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.85 # Opening angle (Multipole acceptance criterion)
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions
InitialConditions:
file_name: ./EAGLE_ICs_6.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../swift -s -t 16 eagle_6.yml 2>&1 | tee output.log
../swift -c -s -t 16 eagle_6.yml 2>&1 | tee output.log
......@@ -31,11 +31,10 @@ SPH:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units).
theta: 0.9
a_smooth: 1.25 # (Optional) Smoothing scale in top-level cell sizes to smooth the long-range forces over (this is the default value).
r_cut: 4.5 # (Optional) Cut-off in number of top-level cells beyond which no FMM forces are computed (this is the default value).
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.9
comoving_softening: 0.001 # Comoving softening length (in internal units).
max_physical_softening: 0.001 # Physical softening length (in internal units).
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -31,6 +31,6 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: ./sedov.hdf5 # The file to read
h_scaling: 3.33
file_name: ./sedov.hdf5
smoothing_length_scaling: 3.33
......@@ -484,7 +484,7 @@ int main(int argc, char *argv[]) {
#endif
/* Common variables for restart and IC sections. */
int clean_h_values = 0;
int clean_smoothing_length_values = 0;
int flag_entropy_ICs = 0;
/* Work out where we will read and write restart files. */
......@@ -609,20 +609,32 @@ int main(int argc, char *argv[]) {
if (myrank == 0 && with_cosmology) cosmology_print(&cosmo);
/* Initialise the hydro properties */
if (with_hydro) hydro_props_init(&hydro_properties, params);
if (with_hydro)
hydro_props_init(&hydro_properties, &prog_const, &us, params);
if (with_hydro) eos_init(&eos, params);
/* Initialise the gravity properties */
if (with_self_gravity) gravity_props_init(&gravity_properties, params);
if (with_self_gravity)
gravity_props_init(&gravity_properties, params, &cosmo);
/* Read particles and space information from (GADGET) ICs */
char ICfileName[200] = "";
parser_get_param_string(params, "InitialConditions:file_name", ICfileName);
const int replicate =
parser_get_opt_param_int(params, "InitialConditions:replicate", 1);
clean_h_values =
parser_get_opt_param_int(params, "InitialConditions:cleanup_h", 0);
clean_smoothing_length_values = parser_get_opt_param_int(
params, "InitialConditions:cleanup_smoothing_lengths", 0);
const int cleanup_h = parser_get_opt_param_int(
params, "InitialConditions:cleanup_h_factors", 0);
const int generate_gas_in_ics = parser_get_opt_param_int(
params, "InitialConditions:generate_gas_in_ics", 0);
if (generate_gas_in_ics && flag_entropy_ICs)
error("Can't generate gas if the entropy flag is set in the ICs.");
if (generate_gas_in_ics && !with_cosmology)
error("Can't generate gas if the run is not cosmological.");
if (myrank == 0) message("Reading ICs from file '%s'", ICfileName);
if (myrank == 0 && cleanup_h)
message("Cleaning up h-factors (h=%f)", cosmo.h);
fflush(stdout);
/* Get ready to read particles of all kinds */
......@@ -635,20 +647,20 @@ int main(int argc, char *argv[]) {
read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL,
nr_threads, dry_run);
cleanup_h, cosmo.h, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL, nr_threads, dry_run);
#else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads,
dry_run);
cleanup_h, cosmo.h, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL, nr_threads, dry_run);
#endif
#else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
nr_threads, dry_run);
cleanup_h, cosmo.h, nr_threads, dry_run);
#endif
if (myrank == 0) {
clocks_gettime(&toc);
......@@ -667,6 +679,9 @@ int main(int argc, char *argv[]) {
for (size_t k = 0; k < Ngpart; ++k)
if (gparts[k].type == swift_type_gas) error("Linking problem");
}
/* Check that the other links are correctly set */
part_verify_links(parts, gparts, sparts, Ngas, Ngpart, Nspart, 1);
#endif
/* Get the total number of particles across all nodes. */
......@@ -690,8 +705,9 @@ int main(int argc, char *argv[]) {
/* Initialize the space with these data. */
if (myrank == 0) clocks_gettime(&tic);
space_init(&s, params, dim, parts, gparts, sparts, Ngas, Ngpart, Nspart,
periodic, replicate, with_self_gravity, talking, dry_run);
space_init(&s, params, &cosmo, dim, parts, gparts, sparts, Ngas, Ngpart,
Nspart, periodic, replicate, generate_gas_in_ics,
with_self_gravity, talking, dry_run);
if (myrank == 0) {
clocks_gettime(&toc);
......@@ -836,7 +852,7 @@ int main(int argc, char *argv[]) {
#endif
/* Initialise the particles */
engine_init_particles(&e, flag_entropy_ICs, clean_h_values);
engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values);
/* Write the state of the system before starting time integration. */
engine_dump_snapshot(&e);
......@@ -1000,6 +1016,24 @@ int main(int argc, char *argv[]) {
(double)runner_hist_bins[k]);
#endif
/* Write final time information */
if (myrank == 0) {
/* Print some information to the screen */
printf(" %6d %14e %14e %14e %4d %4d %12zu %12zu %12zu %21.3f %6d\n",
e.step, e.time, e.cosmology->a, e.time_step, e.min_active_bin,
e.max_active_bin, e.updates, e.g_updates, e.s_updates,
e.wallclock_time, e.step_props);
fflush(stdout);
fprintf(e.file_timesteps,
" %6d %14e %14e %14e %4d %4d %12zu %12zu %12zu %21.3f %6d\n",
e.step, e.time, e.cosmology->a, e.time_step, e.min_active_bin,
e.max_active_bin, e.updates, e.g_updates, e.s_updates,
e.wallclock_time, e.step_props);
fflush(e.file_timesteps);
}
/* Write final output. */
engine_drift_all(&e);
engine_print_stats(&e);
......
......@@ -30,15 +30,19 @@ SPH:
h_max: 10. # (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified.
max_volume_change: 1.4 # (Optional) Maximal allowed change of kernel volume over one time-step.
max_ghost_iterations: 30 # (Optional) Maximal number of iterations allowed to converge towards the smoothing length.
initial_temperature: 0 # (Optional) Initial temperature (in internal units) to set the gas particles at start-up. Value is ignored if set to 0.
minimal_temperature: 0 # (Optional) Minimal temperature (in internal units) allowed for the gas particles. Value is ignored if set to 0.
H_mass_fraction: 0.76 # (Optional) Hydrogen mass fraction used for initial conversion from temp to internal energy.
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
epsilon: 0.1 # Softening length (in internal units).
a_smooth: 1.25 # (Optional) Smoothing scale in top-level cell sizes to smooth the long-range forces over (this is the default value).
r_cut_max: 4.5 # (Optional) Cut-off in number of top-level cells beyond which no FMM forces are computed (this is the default value).
r_cut_min: 0.1 # (Optional) Cut-off in number of top-level cells below which no truncation of FMM forces are performed (this is the default value).
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
a_smooth: 1.25 # (Optional) Smoothing scale in top-level cell sizes to smooth the long-range forces over (this is the default value).
r_cut_max: 4.5 # (Optional) Cut-off in number of top-level cells beyond which no FMM forces are computed (this is the default value).
r_cut_min: 0.1 # (Optional) Cut-off in number of top-level cells below which no truncation of FMM forces are performed (this is the default value).
# Parameters for the task scheduling
Scheduler:
......@@ -81,12 +85,14 @@ Statistics:
# Parameters related to the initial conditions
InitialConditions:
file_name: SedovBlast/sedov.hdf5 # The file to read
cleanup_h: 0 # (Optional) Clean the values of h that are read in. Set to 1 to activate.
h_scaling: 1. # (Optional) A scaling factor to apply to all smoothing lengths in the ICs.
generate_gas_in_ics: 0 # (Optional) Generate gas particles from the DM-only ICs (e.g. from panphasia).
cleanup_h_factors: 0 # (Optional) Clean up the h-factors used in the ICs (e.g. in Gadget files).
cleanup_smoothing_lengths: 0 # (Optional) Clean the values of the smoothing lengths that are read in to remove stupid values. Set to 1 to activate.
smoothing_length_scaling: 1. # (Optional) A scaling factor to apply to all smoothing lengths in the ICs.
shift_x: 0. # (Optional) A shift to apply to all particles read from the ICs (in internal units).
shift_y: 0.
shift_z: 0.
replicate: 2 # (Optional) Replicate all particles along each axis a given number of times. Default 1.
replicate: 2 # (Optional) Replicate all particles along each axis a given integer number of times. Default 1.
# Parameters controlling restarts
Restarts:
......
......@@ -1081,23 +1081,6 @@ void cell_sanitize(struct cell *c, int treated) {
c->h_max = h_max;
}
/**
* @brief Converts hydro quantities to a valid state after the initial density
* calculation
*
* @param c Cell to act upon
* @param data Unused parameter
*/
void cell_convert_hydro(struct cell *c, void *data) {
struct part *p = c->parts;
struct xpart *xp = c->xparts;
for (int i = 0; i < c->count; ++i) {
hydro_convert_quantities(&p[i], &xp[i]);
}
}
/**
* @brief Cleans the links in a given cell.
*
......
......@@ -492,7 +492,6 @@ int cell_getsize(struct cell *c);
int cell_link_parts(struct cell *c, struct part *parts);
int cell_link_gparts(struct cell *c, struct gpart *gparts);
int cell_link_sparts(struct cell *c, struct spart *sparts);
void cell_convert_hydro(struct cell *c, void *data);
void cell_clean_links(struct cell *c, void *data);
void cell_make_multipoles(struct cell *c, integertime_t ti_current);
void cell_check_multipole(struct cell *c, void *data);
......
......@@ -457,6 +457,7 @@ void io_convert_part_f_mapper(void* restrict temp, int N,
const struct io_props props = *((const struct io_props*)extra_data);
const struct part* restrict parts = props.parts;
const struct xpart* restrict xparts = props.xparts;
const struct engine* e = props.e;
const size_t dim = props.dimension;
......@@ -465,7 +466,8 @@ void io_convert_part_f_mapper(void* restrict temp, int N,
const ptrdiff_t delta = (temp_f - props.start_temp_f) / dim;
for (int i = 0; i < N; i++)
props.convert_part_f(e, parts + delta + i, &temp_f[i * dim]);
props.convert_part_f(e, parts + delta + i, xparts + delta + i,
&temp_f[i * dim]);
}
/**
......@@ -477,6 +479,7 @@ void io_convert_part_d_mapper(void* restrict temp, int N,
const struct io_props props = *((const struct io_props*)extra_data);
const struct part* restrict parts = props.parts;
const struct xpart* restrict xparts = props.xparts;
const struct engine* e = props.e;
const size_t dim = props.dimension;
......@@ -485,7 +488,8 @@ void io_convert_part_d_mapper(void* restrict temp, int N,
const ptrdiff_t delta = (temp_d - props.start_temp_d) / dim;
for (int i = 0; i < N; i++)
props.convert_part_d(e, parts + delta + i, &temp_d[i * dim]);
props.convert_part_d(e, parts + delta + i, xparts + delta + i,
&temp_d[i * dim]);
}
/**
......@@ -704,7 +708,7 @@ void io_duplicate_hydro_gparts_mapper(void* restrict data, int Ngas,
gparts[i + Ndm].type = swift_type_gas;
/* Link the particles */
gparts[i + Ndm].id_or_neg_offset = -i;
gparts[i + Ndm].id_or_neg_offset = -(long long)(offset + i);
parts[i].gpart = &gparts[i + Ndm];
}
}
......@@ -760,7 +764,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
gparts[i + Ndm].type = swift_type_star;
/* Link the particles */
gparts[i + Ndm].id_or_neg_offset = -i;
gparts[i + Ndm].id_or_neg_offset = -(long long)(offset + i);
sparts[i].gpart = &gparts[i + Ndm];
}
}
......
......@@ -130,9 +130,11 @@ double cosmology_get_time_since_big_bang(const struct cosmology *c, double a) {
* @brief Update the cosmological parameters to the current simulation time.
*
* @param c The #cosmology struct.
* @param phys_const The physical constants in the internal units.
* @param ti_current The current (integer) time.
*/
void cosmology_update(struct cosmology *c, integertime_t ti_current) {
void cosmology_update(struct cosmology *c, const struct phys_const *phys_const,
integertime_t ti_current) {
/* Get scale factor and powers of it */
const double a = c->a_begin * exp(ti_current * c->time_base);
......@@ -173,6 +175,10 @@ void cosmology_update(struct cosmology *c, integertime_t ti_current) {
/* Expansion rate */
c->a_dot = c->H * c->a;
/* Critical density */
c->critical_density =
3. * c->H * c->H / (8. * M_PI * phys_const->const_newton_G);
/* Time-step conversion factor */
c->time_step_factor = c->H;
......@@ -284,8 +290,6 @@ double time_integrand(double a, void *param) {
*/
void cosmology_init_tables(struct cosmology *c) {
const ticks tic = getticks();
#ifdef HAVE_LIBGSL
/* Retrieve some constants */
......@@ -373,9 +377,6 @@ void cosmology_init_tables(struct cosmology *c) {
error("Code not compiled with GSL. Can't compute cosmology integrals.");
#endif
message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
clocks_getunit());
}
/**
......@@ -431,7 +432,7 @@ void cosmology_init(const struct swift_params *params,
cosmology_init_tables(c);
/* Set remaining variables to alid values */
cosmology_update(c, 0);
cosmology_update(c, phys_const, 0);
/* Update the times */
c->time_begin = cosmology_get_time_since_big_bang(c, c->a_begin);
......@@ -454,7 +455,7 @@ void cosmology_init_no_cosmo(struct cosmology *c) {
c->Omega_b = 0.;
c->w_0 = 0.;
c->w_a = 0.;
c->h = 0.;
c->h = 1.;
c->w = 0.;
c->a_begin = 1.;
......@@ -474,6 +475,8 @@ void cosmology_init_no_cosmo(struct cosmology *c) {
c->a_factor_hydro_accel = 1.;
c->a_factor_grav_accel = 1.;
c->critical_density = 0.;
c->time_step_factor = 1.;
c->a_dot = 0.;
......
......@@ -70,6 +70,9 @@ struct cosmology {
/*! Hubble constant at the current redshift (in internal units) */
double H;
/*! The critical density at the current redshift (in internal units) */
double critical_density;
/*! Conversion factor from internal time-step size to cosmological step */
double time_step_factor;
......@@ -160,7 +163,8 @@ struct cosmology {
double universe_age_at_present_day;
};
void cosmology_update(struct cosmology *c, integertime_t ti_current);
void cosmology_update(struct cosmology *c, const struct phys_const *phys_const,
integertime_t ti_current);
double cosmology_get_drift_factor(const struct cosmology *cosmo,
integertime_t ti_start, integertime_t ti_end);
......
......@@ -3665,10 +3665,10 @@ int engine_estimate_nr_tasks(struct engine *e) {
* @brief Rebuild the space and tasks.
*
* @param e The #engine.
* @param clean_h_values Are we cleaning up the values of h before building
* the tasks ?
* @param clean_smoothing_length_values Are we cleaning up the values of
* the smoothing lengths before building the tasks ?
*/
void engine_rebuild(struct engine *e, int clean_h_values) {
void engine_rebuild(struct engine *e, int clean_smoothing_length_values) {
const ticks tic = getticks();
......@@ -3679,7 +3679,7 @@ void engine_rebuild(struct engine *e, int clean_h_values) {
space_rebuild(e->s, e->verbose);
/* Initial cleaning up session ? */
if (clean_h_values) space_sanitize(e->s);
if (clean_smoothing_length_values) space_sanitize(e->s);
/* If in parallel, exchange the cell structure, top-level and neighbouring
* multipoles. */
......@@ -4395,7 +4395,7 @@ void engine_step(struct engine *e) {
if (e->policy & engine_policy_cosmology) {
e->time_old = e->time;
cosmology_update(e->cosmology, e->ti_current);
cosmology_update(e->cosmology, e->physical_constants, e->ti_current);
e->time = e->cosmology->time;
e->time_step = e->time - e->time_old;
} else {
......@@ -4404,6 +4404,10 @@ void engine_step(struct engine *e) {
e->time_step = (e->ti_current - e->ti_old) * e->time_base;
}
/* Update the softening lengths */
if (e->policy & engine_policy_self_gravity)
gravity_update(e->gravity_properties, e->cosmology);
/* Prepare the tasks to be launched, rebuild or repartition if needed. */
engine_prepare(e);
......@@ -5193,7 +5197,7 @@ void engine_init(
long long Ngas, long long Ndm, int policy, int verbose,
struct repartition *reparttype, const struct unit_system *internal_units,
const struct phys_const *physical_constants, struct cosmology *cosmo,
const struct hydro_props *hydro, const struct gravity_props *gravity,
const struct hydro_props *hydro, struct gravity_props *gravity,
const struct external_potential *potential,
const struct cooling_function_data *cooling_func,
const struct chemistry_data *chemistry, struct sourceterms *sourceterms) {
......
Markdown is supported
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