From 407d304485198b8ca9bebf0dbd0208ec3ed5f69f Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Thu, 28 Nov 2019 16:32:57 +0100
Subject: [PATCH] add comment on seeding the random numbers for the kraichnan
 field

---
 cpp/full_code/kraichnan_field.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/cpp/full_code/kraichnan_field.cpp b/cpp/full_code/kraichnan_field.cpp
index 212ba9b8..fcfcee10 100644
--- a/cpp/full_code/kraichnan_field.cpp
+++ b/cpp/full_code/kraichnan_field.cpp
@@ -136,12 +136,19 @@ int kraichnan_field<rnumber>::generate_random_velocity(void)
     make_gaussian_random_field(
         this->kk,
         this->velocity,
-        this->iteration, // not an ideal choice because resulting field sequence depends on MPI/OpenMP configuration
+        this->iteration, // not an ideal choice because resulting field sequence depends on MPI/OpenMP configuration. See note below
         this->spectrum_slope,
         this->spectrum_k_cutoff,
         this->spectrum_coefficient * 3./2.); // incompressibility projection factor
     // this->velocity is now in Fourier space
     // project divfree, requires field in Fourier space
+    // Note on the choice of random seed:
+    // If in the future the simulation will continue with a smaller number of total threads (number of processes times number of threads per process),
+    // then during that run some of the threads will be seeded with a seed that has already been used for a previous iteration.
+    // So some sequences of Fourier modes will be identical to sequences of Fourier modes that occured in the past.
+    // Also see implementation of "make_gaussian_random_field".
+    // One work-around would be to multiply "this->iteration" with 10 or so ---
+    // it is unlikely the simulation will be continued with less than 0.1 of the initial total number of threads.
     DEBUG_MSG("L2Norm before: %g\n",
             this->velocity->L2norm(this->kk));
     this->kk->template project_divfree<rnumber>(this->velocity->get_cdata());
-- 
GitLab