Randomfiled seed

Hi all,

When I was trying to generate a bunch of randomfields, I observed that the randomfield command was generating the same field again and again.

As it turned out, the seed for random numbers was set to default 1. The quick fix for that is as follows:
Get the current seconds as integers, feed that time as a seed to randomfield:

randomfield -Nx 32 -Ny 33 -Nz 32 -a 1 -g 2 -sd $(date +"%s") u0.nc

It would be better, however, if the randomfield.cpp would do something like this by default.

Thanks.
regards,
Pratik Aghor

Dear Pratik,

thanks for pointing this out and suggesting a quick fix. Sorry that no one was responding for some time.

I created a PR that modifies the tool randomfield to have the desired “random” behaviour if no seed is specified:

Would you like to review it? Send me your GitHub account name to florian.reetz@epfl.ch. I make you a reviewer.

Best,
Florian

PS: The PR will merge with the branch patch_2020 which will merge with the master later this year - after being thoroughly tested.

1 Like

Dear Florian,

Thank you for this input.

It happens that I am currently experiencing some troubles linked to this topic.
I would like to use specific values of the seed for use of the FlowField::addPerturbations function (as used in randomfield.cpp or perturbfield.cpp) for a parallelized flow field.
I observed that certain values of the seed (depending on the number of MPI tasks
) made the addPerturbations function unable to end. I believe this is due to an MPI communication issue, but I am not able to fix it for the moment.
The problem appeared for both available addPerturbations functions :
void FlowField::addPerturbations(int Kx, int Kz, Real mag, Real decay, bool meanflow)
void FlowField::addPerturbations(Real mag, Real decay, bool meanflow)

Have you ever experienced this type of issues?
I would be happy to discuss if you have time.
Thank you in advance

Best,
SĂ©bastien
sebastien.gome@espci.fr

Hi SĂ©bastien,
thanks for reporting this bug. Unfortunately, I have never encountered a similar/related issue and do not know an easy fix.
Fixing bugs related to certain parameter and MPI configurations is typically among the most difficult fixes. It clearly requires a detailed investigation which you already started to do. I will write you an email so we can discuss what you already did and know.

Best wishes,
Florian