From 80bbba886d68efdbc313f844cba02e125c7bbbe6 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sun, 27 Oct 2019 18:28:30 +0100
Subject: [PATCH] Put the dithering parameters in the 'Gravity' section of the
 YAML parameter file.

---
 examples/parameter_example.yml | 20 +++++++++++---------
 src/gravity_properties.c       |  6 +++---
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml
index 5ae4235a0d..1eff349e0b 100644
--- a/examples/parameter_example.yml
+++ b/examples/parameter_example.yml
@@ -60,18 +60,20 @@ Stars:
 
 # Parameters for the self-gravity scheme
 Gravity:
-  mesh_side_length:       32               # Number of cells along each axis for the periodic gravity mesh.
-  eta:          0.025                      # Constant dimensionless multiplier for time integration.
-  theta:        0.7                        # Opening angle (Multipole acceptance criterion).
-  comoving_DM_softening:     0.0026994     # Comoving Plummer-equivalent softening length for DM particles (in internal units).
-  max_physical_DM_softening: 0.0007        # Maximal Plummer-equivalent softening length in physical coordinates for DM particles (in internal units).
+  mesh_side_length:              128       # Number of cells along each axis for the periodic gravity mesh.
+  eta:                           0.025     # Constant dimensionless multiplier for time integration.
+  theta:                         0.7       # Opening angle (Multipole acceptance criterion).
+  comoving_DM_softening:         0.0026994 # Comoving Plummer-equivalent softening length for DM particles (in internal units).
+  max_physical_DM_softening:     0.0007    # Maximal Plummer-equivalent softening length in physical coordinates for DM particles (in internal units).
   comoving_baryon_softening:     0.0026994 # Comoving Plummer-equivalent softening length for baryon particles (in internal units).
   max_physical_baryon_softening: 0.0007    # Maximal Plummer-equivalent softening length in physical coordinates for baryon particles (in internal units).
   softening_ratio_background:    0.04      # Fraction of the mean inter-particle separation to use as Plummer-equivalent softening for the background DM particles.
-  rebuild_frequency:      0.01             # (Optional) Frequency of the gravity-tree rebuild in units of the number of g-particles (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_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).
+  rebuild_frequency:             0.01      # (Optional) Frequency of the gravity-tree rebuild in units of the number of g-particles (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_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).
+  dithering:                     1         # (Optional) Activate the dithering of the gravity mesh at every rebuild (this is the default value).
+  dithering_ratio:               1.0       # (Optional) Magnitude of each component of the dithering vector in units of the top-level cell sizes (this is the default value).
 
 # Parameters for the Friends-Of-Friends algorithm
 FOF:
diff --git a/src/gravity_properties.c b/src/gravity_properties.c
index 701a8cc0c9..6b21b20b8e 100644
--- a/src/gravity_properties.c
+++ b/src/gravity_properties.c
@@ -92,10 +92,10 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
   /* Mesh dithering */
   if (periodic && !with_external_potential) {
     p->with_dithering =
-        parser_get_opt_param_int(params, "InitialConditions:dithering", 1);
+        parser_get_opt_param_int(params, "Gravity:dithering", 1);
     if (p->with_dithering) {
-      p->dithering_ratio = parser_get_opt_param_double(
-          params, "InitialConditions:dithering_ratio", 1.0);
+      p->dithering_ratio =
+          parser_get_opt_param_double(params, "Gravity:dithering_ratio", 1.0);
     }
   }
 
-- 
GitLab