Commit fbb51d98 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Read the dithering ration from the parameter file.

parent f3b24f49
......@@ -764,6 +764,13 @@ int main(int argc, char *argv[]) {
params, "InitialConditions:cleanup_velocity_factors", 0);
const int generate_gas_in_ics = parser_get_opt_param_int(
params, "InitialConditions:generate_gas_in_ics", 0);
const int with_dithering =
parser_get_opt_param_int(params, "InitialConditions:dithering", 0);
int dithering_ratio = 0.;
if (with_dithering) {
dithering_ratio =
parser_get_param_double(params, "InitialConditions:dithering_ratio");
}
/* Initialise the cosmology */
if (with_cosmology)
......@@ -992,7 +999,8 @@ int main(int argc, char *argv[]) {
space_init(&s, params, &cosmo, dim, parts, gparts, sparts, bparts, Ngas,
Ngpart, Nspart, Nbpart, periodic, replicate, generate_gas_in_ics,
with_hydro, with_self_gravity, with_star_formation,
with_DM_background_particles, talking, dry_run);
with_DM_background_particles, with_dithering, dithering_ratio,
talking, dry_run);
if (myrank == 0) {
clocks_gettime(&toc);
......
......@@ -511,7 +511,8 @@ int main(int argc, char *argv[]) {
space_init(&s, params, &cosmo, dim, parts, gparts, sparts, bparts, Ngas,
Ngpart, Nspart, Nbpart, periodic, replicate,
/*generate_gas_in_ics=*/0, /*hydro=*/N_total[0] > 0, /*gravity=*/1,
/*with_star_formation=*/0, with_DM_background_particles, talking,
/*with_star_formation=*/0, with_DM_background_particles,
/*with_dithering=*/0, /*dithering_ratio=*/0., talking,
/*dry_run=*/0);
if (myrank == 0) {
......
......@@ -1187,6 +1187,10 @@ void space_rebuild(struct space *s, int repartitioned, int verbose) {
/* Tell everyone what value to use */
MPI_Bcast(s->pos_dithering, 3, MPI_DOUBLE, 0, MPI_COMM_WORLD);
#endif
if (verbose)
message("Dithering the particle positions by [%e %e %e]",
s->pos_dithering[0], s->pos_dithering[1], s->pos_dithering[2]);
}
}
......@@ -4629,8 +4633,8 @@ void space_init(struct space *s, struct swift_params *params,
struct bpart *bparts, size_t Npart, size_t Ngpart,
size_t Nspart, size_t Nbpart, int periodic, int replicate,
int generate_gas_in_ics, int hydro, int self_gravity,
int star_formation, int DM_background, int verbose,
int dry_run) {
int star_formation, int DM_background, int dithering,
double dithering_ratio, int verbose, int dry_run) {
/* Clean-up everything */
bzero(s, sizeof(struct space));
......@@ -4672,6 +4676,8 @@ void space_init(struct space *s, struct swift_params *params,
s->sum_gpart_vel_norm = 0.f;
s->sum_spart_vel_norm = 0.f;
s->sum_bpart_vel_norm = 0.f;
s->dithering = dithering;
s->dithering_ratio = dithering_ratio;
s->nr_queues = 1; /* Temporary value until engine construction */
/* Initialise some randomness */
......
......@@ -321,8 +321,8 @@ void space_init(struct space *s, struct swift_params *params,
struct bpart *bparts, size_t Npart, size_t Ngpart,
size_t Nspart, size_t Nbpart, int periodic, int replicate,
int generate_gas_in_ics, int hydro, int gravity,
int star_formation, int DM_background, int verbose,
int dry_run);
int star_formation, int DM_background, int dithering,
double dithering_ratio, int verbose, int dry_run);
void space_sanitize(struct space *s);
void space_map_cells_pre(struct space *s, int full,
void (*fun)(struct cell *c, void *data), void *data);
......
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