diff --git a/examples/main.c b/examples/main.c index 3541dd4b7fa2f67f15911868c85d9e20bdb2859d..26eccd898132bc6050bb833a11dbb92cf7d4e90d 100644 --- a/examples/main.c +++ b/examples/main.c @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) { int with_mpole_reconstruction = 0; int with_structure_finding = 0; int with_csds = 0; - int with_sink = 0; + int with_sinks = 0; int with_qla = 0; int with_eagle = 0; int with_gear = 0; @@ -237,8 +237,8 @@ int main(int argc, char *argv[]) { OPT_BOOLEAN('S', "stars", &with_stars, "Run with stars.", NULL, 0, 0), OPT_BOOLEAN('B', "black-holes", &with_black_holes, "Run with black holes.", NULL, 0, 0), - OPT_BOOLEAN('k', "sinks", &with_sink, "Run with sink particles.", NULL, 0, - 0), + OPT_BOOLEAN('k', "sinks", &with_sinks, "Run with sink particles.", NULL, + 0, 0), OPT_BOOLEAN( 'u', "fof", &with_fof, "Run Friends-of-Friends algorithm to perform black hole seeding.", @@ -487,13 +487,13 @@ int main(int argc, char *argv[]) { #endif #ifdef WITH_MPI - if (with_sink) { + if (with_sinks) { printf("Error: sink particles are not available yet with MPI.\n"); return 1; } #endif - if (with_sink && with_star_formation) { + if (with_sinks && with_star_formation) { printf( "Error: The sink particles are not supposed to be run with star " "formation.\n"); @@ -637,7 +637,7 @@ int main(int argc, char *argv[]) { #endif /* idfef RT_NONE */ #ifdef SINK_NONE - if (with_sink) { + if (with_sinks) { error("Running with sink particles but compiled without them!"); } #endif @@ -1123,7 +1123,7 @@ int main(int argc, char *argv[]) { bzero(&black_holes_properties, sizeof(struct black_holes_props)); /* Initialise the sink properties */ - if (with_sink) { + if (with_sinks) { sink_props_init(&sink_properties, &prog_const, &us, params, &cosmo); } else bzero(&sink_properties, sizeof(struct sink_props)); @@ -1211,7 +1211,7 @@ int main(int argc, char *argv[]) { read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sinks, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nnupart, &Nsink, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro, - with_gravity, with_sink, with_stars, with_black_holes, + with_gravity, with_sinks, with_stars, with_black_holes, with_cosmology, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, dry_run, remap_ids, &ics_metadata); @@ -1219,7 +1219,7 @@ int main(int argc, char *argv[]) { read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sinks, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nnupart, &Nsink, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro, - with_gravity, with_sink, with_stars, with_black_holes, + with_gravity, with_sinks, with_stars, with_black_holes, with_cosmology, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, dry_run, remap_ids, &ics_metadata); @@ -1228,7 +1228,7 @@ int main(int argc, char *argv[]) { read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sinks, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nnupart, &Nsink, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro, - with_gravity, with_sink, with_stars, with_black_holes, + with_gravity, with_sinks, with_stars, with_black_holes, with_cosmology, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, dry_run, remap_ids, &ics_metadata); #endif @@ -1266,7 +1266,7 @@ int main(int argc, char *argv[]) { for (size_t k = 0; k < Ngpart; ++k) if (gparts[k].type == swift_type_gas) error("Linking problem"); } - if (!with_sink && !dry_run) { + if (!with_sinks && !dry_run) { for (size_t k = 0; k < Ngpart; ++k) if (gparts[k].type == swift_type_sink) error("Linking problem"); } @@ -1341,7 +1341,7 @@ int main(int argc, char *argv[]) { space_init(&s, params, &cosmo, dim, &hydro_properties, parts, gparts, sinks, sparts, bparts, Ngas, Ngpart, Nsink, Nspart, Nbpart, Nnupart, periodic, replicate, remap_ids, generate_gas_in_ics, with_hydro, - with_self_gravity, with_star_formation, with_sink, + with_self_gravity, with_star_formation, with_sinks, with_DM_particles, with_DM_background_particles, with_neutrinos, talking, dry_run, nr_nodes); @@ -1491,7 +1491,7 @@ int main(int argc, char *argv[]) { if (with_fof) engine_policies |= engine_policy_fof; if (with_csds) engine_policies |= engine_policy_csds; if (with_line_of_sight) engine_policies |= engine_policy_line_of_sight; - if (with_sink) engine_policies |= engine_policy_sinks; + if (with_sinks) engine_policies |= engine_policy_sinks; if (with_rt) engine_policies |= engine_policy_rt; if (with_power) engine_policies |= engine_policy_power_spectra; diff --git a/examples/main_fof.c b/examples/main_fof.c index 3ec2a09b737a8602d0d7d5f761fe7f00a3550c17..3791b78d881175dc3c86ecdb063ea46ccee0fb6b 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -90,6 +90,7 @@ int main(int argc, char *argv[]) { struct pm_mesh mesh; struct gpart *gparts = NULL; struct gravity_props gravity_properties; + struct hydro_props hydro_properties; struct fof_props fof_properties; struct neutrino_props neutrino_properties; struct part *parts = NULL; @@ -435,6 +436,12 @@ int main(int argc, char *argv[]) { cosmology_init_no_cosmo(&cosmo); if (myrank == 0 && with_cosmology) cosmology_print(&cosmo); + /* Initialise the hydro properties */ + if (with_hydro) + hydro_props_init(&hydro_properties, &prog_const, &us, params); + else + bzero(&hydro_properties, sizeof(struct hydro_props)); + /* Initialise the equation of state */ if (with_hydro) eos_init(&eos, &prog_const, &us, params); @@ -646,8 +653,8 @@ int main(int argc, char *argv[]) { N_total[swift_type_count], N_total[swift_type_sink], N_total[swift_type_stars], N_total[swift_type_black_hole], N_total[swift_type_dark_matter_background], N_total[swift_type_neutrino], - engine_policies, talking, &us, &prog_const, &cosmo, - /*hydro_properties=*/NULL, /*entropy_floor=*/NULL, &gravity_properties, + engine_policies, talking, &us, &prog_const, &cosmo, &hydro_properties, + /*entropy_floor=*/NULL, &gravity_properties, /*stars_properties=*/NULL, /*black_holes_properties=*/NULL, /*sink_properties=*/NULL, &neutrino_properties, /*neutrino_response=*/NULL, /*feedback_properties=*/NULL, @@ -699,6 +706,13 @@ int main(int argc, char *argv[]) { engine_fof(&e, /*dump_results=*/1, /*dump_debug=*/0, /*seed_black_holes=*/0, /*buffers allocated=*/1); + /* Update the policies to make sure the particles are written + * if they exist */ + if (with_hydro) e.policy |= engine_policy_hydro; + if (with_stars) e.policy |= engine_policy_stars; + if (with_black_holes) e.policy |= engine_policy_black_holes; + if (with_sinks) e.policy |= engine_policy_sinks; + /* Write output. */ engine_dump_snapshot(&e); diff --git a/src/cosmology.c b/src/cosmology.c index 557e959dc738ad0d31bee859cb222771830cee84..285dfe39cb2c1b6a553fd50c5a5d410fdb0faf82 100644 --- a/src/cosmology.c +++ b/src/cosmology.c @@ -1072,6 +1072,8 @@ void cosmology_init_no_cosmo(struct cosmology *c) { c->neutrino_density_late_table = NULL; c->time_interp_table_offset = 0.; c->scale_factor_interp_table = NULL; + c->comoving_distance_interp_table = NULL; + c->comoving_distance_inverse_interp_table = NULL; c->time_begin = 0.; c->time_end = 0.;