-
Notifications
You must be signed in to change notification settings - Fork 65
Reproducible random generator #346
Copy link
Copy link
Open
Labels
comp-LogicRelated to internal code logicRelated to internal code logichelp wantedShould be doable without understanding the whole code, but not as easy as "good first issue"Should be doable without understanding the whole code, but not as easy as "good first issue"maintainabilitySimplifies further code development (standardization, robustness)Simplifies further code development (standardization, robustness)pri-MediumWorth assigning to a milestoneWorth assigning to a milestoneusabilityMakes using code more convenientMakes using code more convenient
Milestone
Metadata
Metadata
Assignees
Labels
comp-LogicRelated to internal code logicRelated to internal code logichelp wantedShould be doable without understanding the whole code, but not as easy as "good first issue"Should be doable without understanding the whole code, but not as easy as "good first issue"maintainabilitySimplifies further code development (standardization, robustness)Simplifies further code development (standardization, robustness)pri-MediumWorth assigning to a milestoneWorth assigning to a milestoneusabilityMakes using code more convenientMakes using code more convenient
Type
Fields
Give feedbackNo fields configured for Feature.
Is your feature request related to a problem? Please describe.
When granule generator is used (currently, that is the only place in the code, which uses random generator), the inherent randomness breaks the reproducibility. This is important for following scenarios:
Describe the solution you'd like
Fortunately, ADDA uses a reproducible random generator (Mersenne Twister), so only the following functionality should be added:
-seed ...). If not specified, the current default seeding algorithm should be used.logsomething likeAlso, it should be tested, whether this reproducibility holds in MPI mode (should be fine, since random generator is currently called only from ROOT).
Describe alternatives you've considered
Right now, the workaround for granule generator is to store shape file (
-store_geom) and reuse it afterwards (-shape read ...).Moreover, a dirty fix is possible by using any constants (instead of
timeandclock) in the current initialization:adda/src/make_particle.c
Lines 675 to 678 in ff4b449
Additional context
Unfortunately, this will not help immediately for convergence studies (refining discretization), since ADDA granulation algorithm woks on a specific grid (for efficiency in parallel implementation). Thus the only way to make a reproducible refinement is to save granule positions to the file with
-store_gransand then to regenerate the shape based on that. Unfortunately, there are no established tools for the latter step:Note also, that the granule positions are not guaranteed to be completely non-overlapping. ADDA only checks that each newly added granule doesn't overlap with voxel centers that were already intersected by previous granules. So in principle, refining the discretization of this analytic granulated model may lead to effective sintering of granules (although this doesn't seem to be important for any applications).