Closed AlexanderSinn closed 8 months ago
Thanks for this PR! Could we set the RNG seed so the results do not change? So when users re-run a previous simulation, they do not get different results.
The default random seed is set in
https://github.com/AMReX-Codes/amrex/blob/3fe7aadc23c94a038b306af54ff732ce5564c3d1/Src/Base/AMReX.cpp#L625
It depends on the ID of the rank. This means that with the old rank order the random seed of the head rank that initializes the beams depended on the number of ranks.
In the spin tracking simulations I made, I added a bit of vacuum before the plasma profile and also changed the number of ranks. The result was different and at the time I thought it was because of the vacuum but it probably was caused by the change to the random seed.
With this PR the head rank always has ID 0 so it will fix this issue for the first time step. The random seed of later time steps will still depend on the number of ranks but that doesn't affect the beams, only plasma, collisions and ionization. The seed issue for the first time step cannot be fixed while being RNG backwards compatible.
Note that users that use random_seed = …
are unaffected.
Good point. Could you add an option for the users to easily recover the previous behavior? e.g. use_previous_rng
(false by default)? Then we'll announce this breaking change on the channel, and hopefully this will be modest pain for them
Since the MPI communication is now all done in HiPACE++, we can reverse the order of the ranks to better reflect the timestep. Additionally, this PR prints the time of the start of a time step relative to the start of the simulation.
Note that this changes the results of functions that use the RNG because the initial random seed depends on the rank ID.
const
isconst
)