Commit 088bbbfc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only activate dithering when running periodic BCs without external gravity.

parent 2ab35ac5
......@@ -1005,9 +1005,9 @@ int main(int argc, char *argv[]) {
bzero(&gravity_properties, sizeof(struct gravity_props));
if (with_self_gravity)
gravity_props_init(&gravity_properties, params, &prog_const, &cosmo,
with_cosmology, with_baryon_particles,
with_DM_particles, with_DM_background_particles,
periodic);
with_cosmology, with_external_gravity,
with_baryon_particles, with_DM_particles,
with_DM_background_particles, periodic);
/* Initialise the external potential properties */
bzero(&potential, sizeof(struct external_potential));
......
......@@ -524,8 +524,9 @@ int main(int argc, char *argv[]) {
/* Initialise the gravity scheme */
bzero(&gravity_properties, sizeof(struct gravity_props));
gravity_props_init(&gravity_properties, params, &prog_const, &cosmo,
/*with_cosmology=*/1, with_baryon_particles,
with_DM_particles, with_DM_background_particles, periodic);
/*with_cosmology=*/1, /*with_external_gravity=*/0,
with_baryon_particles, with_DM_particles,
with_DM_background_particles, periodic);
/* Initialise the long-range gravity mesh */
if (periodic) {
......
......@@ -41,6 +41,7 @@
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
const struct phys_const *phys_const,
const struct cosmology *cosmo, const int with_cosmology,
const int with_external_potential,
const int has_baryons, const int has_DM,
const int is_zoom_simulation, const int periodic) {
......@@ -88,12 +89,15 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
p->theta_crit2 = p->theta_crit * p->theta_crit;
p->theta_crit_inv = 1. / p->theta_crit;
/* Mesh dithering */
if (periodic && !with_external_potential) {
p->with_dithering =
parser_get_opt_param_int(params, "InitialConditions:dithering", 1);
if (p->with_dithering) {
p->dithering_ratio = parser_get_opt_param_double(
params, "InitialConditions:dithering_ratio", 1.0);
}
}
/* Softening parameters */
if (with_cosmology) {
......
......@@ -126,6 +126,7 @@ void gravity_props_print(const struct gravity_props *p);
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
const struct phys_const *phys_const,
const struct cosmology *cosmo, const int with_cosmology,
const int with_external_potential,
const int has_baryons, const int has_DM,
const int is_zoom_simulation, const int periodic);
void gravity_props_update(struct gravity_props *p,
......
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