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: ...@@ -37,15 +37,18 @@ Statistics:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. 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)
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 # Parameters for the hydrodynamics scheme
SPH: SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). 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. CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_100.hdf5 # The file to read 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 ...@@ -7,5 +7,5 @@ then
./getIC.sh ./getIC.sh
fi 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: ...@@ -38,16 +38,18 @@ Statistics:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. 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)
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 # Parameters for the hydrodynamics scheme
SPH: SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). 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. CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_12.hdf5 # The file to read 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 ...@@ -7,5 +7,5 @@ then
./getIC.sh ./getIC.sh
fi 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: ...@@ -38,16 +38,19 @@ Statistics:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. 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)
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 # Parameters for the hydrodynamics scheme
SPH: SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). 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. CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_25.hdf5 # The file to read 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 ...@@ -7,5 +7,5 @@ then
./getIC.sh ./getIC.sh
fi 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: ...@@ -37,16 +37,19 @@ Statistics:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. 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)
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 # Parameters for the hydrodynamics scheme
SPH: SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). 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. CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_50.hdf5 # The file to read 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 ...@@ -7,5 +7,5 @@ then
./getIC.sh ./getIC.sh
fi 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: ...@@ -28,7 +28,7 @@ TimeIntegration:
# Parameters governing the snapshots # Parameters governing the snapshots
Snapshots: Snapshots:
basename: eagle # Common part of the name of output files 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) delta_time: 1e-3 # Time difference between consecutive outputs (in internal units)
compression: 4 compression: 4
...@@ -38,16 +38,19 @@ Statistics: ...@@ -38,16 +38,19 @@ Statistics:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. 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)
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 # Parameters for the hydrodynamics scheme
SPH: SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). 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. CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100 # (internal units)
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_6.hdf5 # The file to read 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 ...@@ -7,5 +7,5 @@ then
./getIC.sh ./getIC.sh
fi 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: ...@@ -31,11 +31,10 @@ SPH:
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. eta: 0.025 # Constant dimensionless multiplier for time integration.
epsilon: 0.001 # Softening length (in internal units). theta: 0.9
theta: 0.9 comoving_softening: 0.001 # Comoving 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). max_physical_softening: 0.001 # Physical softening length (in internal units).
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).
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -31,6 +31,6 @@ SPH: ...@@ -31,6 +31,6 @@ SPH:
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./sedov.hdf5 # The file to read file_name: ./sedov.hdf5
h_scaling: 3.33 smoothing_length_scaling: 3.33
...@@ -484,7 +484,7 @@ int main(int argc, char *argv[]) { ...@@ -484,7 +484,7 @@ int main(int argc, char *argv[]) {
#endif #endif
/* Common variables for restart and IC sections. */ /* Common variables for restart and IC sections. */
int clean_h_values = 0; int clean_smoothing_length_values = 0;
int flag_entropy_ICs = 0; int flag_entropy_ICs = 0;
/* Work out where we will read and write restart files. */ /* Work out where we will read and write restart files. */
...@@ -609,20 +609,32 @@ int main(int argc, char *argv[]) { ...@@ -609,20 +609,32 @@ int main(int argc, char *argv[]) {
if (myrank == 0 && with_cosmology) cosmology_print(&cosmo); if (myrank == 0 && with_cosmology) cosmology_print(&cosmo);
/* Initialise the hydro properties */ /* 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); if (with_hydro) eos_init(&eos, params);
/* Initialise the gravity properties */ /* 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 */ /* Read particles and space information from (GADGET) ICs */
char ICfileName[200] = ""; char ICfileName[200] = "";
parser_get_param_string(params, "InitialConditions:file_name", ICfileName); parser_get_param_string(params, "InitialConditions:file_name", ICfileName);
const int replicate = const int replicate =
parser_get_opt_param_int(params, "InitialConditions:replicate", 1); parser_get_opt_param_int(params, "InitialConditions:replicate", 1);
clean_h_values = clean_smoothing_length_values = parser_get_opt_param_int(
parser_get_opt_param_int(params, "InitialConditions:cleanup_h", 0); 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) message("Reading ICs from file '%s'", ICfileName);
if (myrank == 0 && cleanup_h)
message("Cleaning up h-factors (h=%f)", cosmo.h);
fflush(stdout); fflush(stdout);
/* Get ready to read particles of all kinds */ /* Get ready to read particles of all kinds */
...@@ -635,20 +647,20 @@ int main(int argc, char *argv[]) { ...@@ -635,20 +647,20 @@ int main(int argc, char *argv[]) {
read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro, &Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars, (with_external_gravity || with_self_gravity), with_stars,
myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, cleanup_h, cosmo.h, myrank, nr_nodes, MPI_COMM_WORLD,
nr_threads, dry_run); MPI_INFO_NULL, nr_threads, dry_run);
#else #else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro, &Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars, (with_external_gravity || with_self_gravity), with_stars,
myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, cleanup_h, cosmo.h, myrank, nr_nodes, MPI_COMM_WORLD,
dry_run); MPI_INFO_NULL, nr_threads, dry_run);
#endif #endif
#else #else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas,
&Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro, &Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars, (with_external_gravity || with_self_gravity), with_stars,
nr_threads, dry_run); cleanup_h, cosmo.h, nr_threads, dry_run);
#endif #endif
if (myrank == 0) { if (myrank == 0) {
clocks_gettime(&toc); clocks_gettime(&toc);
...@@ -667,6 +679,9 @@ int main(int argc, char *argv[]) { ...@@ -667,6 +679,9 @@ int main(int argc, char *argv[]) {
for (size_t k = 0; k < Ngpart; ++k) for (size_t k = 0; k < Ngpart; ++k)
if (gparts[k].type == swift_type_gas) error("Linking problem"); 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 #endif
/* Get the total number of particles across all nodes. */ /* Get the total number of particles across all nodes. */
...@@ -690,8 +705,9 @@ int main(int argc, char *argv[]) { ...@@ -690,8 +705,9 @@ int main(int argc, char *argv[]) {
/* Initialize the space with these data. */ /* Initialize the space with these data. */
if (myrank == 0) clocks_gettime(&tic); if (myrank == 0) clocks_gettime(&tic);
space_init(&s, params, dim, parts, gparts, sparts, Ngas, Ngpart, Nspart, space_init(&s, params, &cosmo, dim, parts, gparts, sparts, Ngas, Ngpart,
periodic, replicate, with_self_gravity, talking, dry_run); Nspart, periodic, replicate, generate_gas_in_ics,
with_self_gravity, talking, dry_run);
if (myrank == 0) { if (myrank == 0) {
clocks_gettime(&toc); clocks_gettime(&toc);
...@@ -836,7 +852,7 @@ int main(int argc, char *argv[]) { ...@@ -836,7 +852,7 @@ int main(int argc, char *argv[]) {
#endif #endif
/* Initialise the particles */ /* 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. */ /* Write the state of the system before starting time integration. */
engine_dump_snapshot(&e); engine_dump_snapshot(&e);
...@@ -1000,6 +1016,24 @@ int main(int argc, char *argv[]) { ...@@ -1000,6 +1016,24 @@ int main(int argc, char *argv[]) {
(double)runner_hist_bins[k]); (double)runner_hist_bins[k]);
#endif #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. */ /* Write final output. */
engine_drift_all(&e); engine_drift_all(&e);
engine_print_stats(&e); engine_print_stats(&e);
......
...@@ -30,15 +30,19 @@ SPH: ...@@ -30,15 +30,19 @@ SPH:
h_max: 10. # (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified. 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_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. 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 # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion) theta: 0.7 # Opening angle (Multipole acceptance criterion)
epsilon: 0.1 # Softening length (in internal units). comoving_softening: 0.0026994 # Comoving 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). max_physical_softening: 0.0007 # Physical softening length (in internal units).
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). 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_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). 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 # Parameters for the task scheduling
Scheduler: Scheduler:
...@@ -81,12 +85,14 @@ Statistics: ...@@ -81,12 +85,14 @@ Statistics:
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: SedovBlast/sedov.hdf5 # The file to read 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. generate_gas_in_ics: 0 # (Optional) Generate gas particles from the DM-only ICs (e.g. from panphasia).
h_scaling: 1. # (Optional) A scaling factor to apply to all smoothing lengths in the ICs. 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_x: 0. # (Optional) A shift to apply to all particles read from the ICs (in internal units).
shift_y: 0. shift_y: 0.
shift_z: 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 # Parameters controlling restarts
Restarts: Restarts:
......
...@@ -1081,23 +1081,6 @@ void cell_sanitize(struct cell *c, int treated) { ...@@ -1081,23 +1081,6 @@ void cell_sanitize(struct cell *c, int treated) {
c->h_max = h_max; 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. * @brief Cleans the links in a given cell.
* *
......
...@@ -492,7 +492,6 @@ int cell_getsize(struct cell *c); ...@@ -492,7 +492,6 @@ int cell_getsize(struct cell *c);
int cell_link_parts(struct cell *c, struct part *parts); int cell_link_parts(struct cell *c, struct part *parts);
int cell_link_gparts(struct cell *c, struct gpart *gparts); int cell_link_gparts(struct cell *c, struct gpart *gparts);
int cell_link_sparts(struct cell *c, struct spart *sparts); 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_clean_links(struct cell *c, void *data);
void cell_make_multipoles(struct cell *c, integertime_t ti_current); void cell_make_multipoles(struct cell *c, integertime_t ti_current);
void cell_check_multipole(struct cell *c, void *data); void cell_check_multipole(struct cell *c, void *data);
......
...@@ -457,6 +457,7 @@ void io_convert_part_f_mapper(void* restrict temp, int N, ...@@ -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 io_props props = *((const struct io_props*)extra_data);
const struct part* restrict parts = props.parts; const struct part* restrict parts = props.parts;
const struct xpart* restrict xparts = props.xparts;
const struct engine* e = props.e; const struct engine* e = props.e;
const size_t dim = props.dimension; const size_t dim = props.dimension;
...@@ -465,7 +466,8 @@ void io_convert_part_f_mapper(void* restrict temp, int N, ...@@ -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; const ptrdiff_t delta = (temp_f - props.start_temp_f) / dim;
for (int i = 0; i < N; i++) 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, ...@@ -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 io_props props = *((const struct io_props*)extra_data);
const struct part* restrict parts = props.parts; const struct part* restrict parts = props.parts;
const struct xpart* restrict xparts = props.xparts;
const struct engine* e = props.e; const struct engine* e = props.e;
const size_t dim = props.dimension; const size_t dim = props.dimension;
...@@ -485,7 +488,8 @@ void io_convert_part_d_mapper(void* restrict temp, int N, ...@@ -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; const ptrdiff_t delta = (temp_d - props.start_temp_d) / dim;
for (int i = 0; i < N; i++) 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, ...@@ -704,7 +708,7 @@ void io_duplicate_hydro_gparts_mapper(void* restrict data, int Ngas,
gparts[i + Ndm].type = swift_type_gas; gparts[i + Ndm].type = swift_type_gas;
/* Link the particles */ /* 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]; parts[i].gpart = &gparts[i + Ndm];
} }
} }
...@@ -760,7 +764,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars, ...@@ -760,7 +764,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
gparts[i + Ndm].type = swift_type_star; gparts[i + Ndm].type = swift_type_star;
/* Link the particles */ /* Link the particles */
gparts[i + Ndm].id_or_neg_offset = -i;