Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CenterIdx in VoronoiTessellator consistent/seed-dependent #43

Open
lamoreel opened this issue Oct 17, 2024 · 4 comments
Open

Make CenterIdx in VoronoiTessellator consistent/seed-dependent #43

lamoreel opened this issue Oct 17, 2024 · 4 comments
Assignees

Comments

@lamoreel
Copy link
Contributor

lamoreel commented Oct 17, 2024

@ilateur : Should be consistent, if ever we wanted to implement a moving frame.

How though? user defined maxRegion, and otherwise an educated guess?

After some thought, I would suggest to simply take a region between 0 and maxRegion. The educated guess can be an extra python function, which the user can call themselves. For example a function to guess the total number of regions that would be generated, or a function that guesses how many regions you need in order to almost never have a "region collision" (I'm guessing this is is huge though).

@lamoreel lamoreel self-assigned this Oct 17, 2024
@lamoreel
Copy link
Contributor Author

lamoreel commented Oct 17, 2024

I've done the math; in order to have a 95% chance of never having a "region collision", you'd need at least (approx) 156 region indices (i.e. draw numbers from a uniform distribution with an upper limit of 156). This seems low enough as a default value for maxRegion and is also an overestimate.

(For a 99% chance, you'd need 796 region indices...).

In case of a 3D tessellation, you'd need 273 as maxRegion (for a 95% chance of no collision).

@lamoreel
Copy link
Contributor Author

This number is also reduced when grainsize is large in relation to the size of the grid. This means that mumax3's upper limit of 256 regions is a (very safe) overestimate (something I wasn't sure about before).
Now the question becomes, what do we want? Our interParameter buffers are filled "bottom-up" starting at zero. This means we want as less regions as possible. How much is physics altered when we set a default upper limit on region indices at 156 (the number of regions can of course be much larger, but regions are assured to be uncorrelated, I think?).

@ilateur
Copy link
Collaborator

ilateur commented Oct 17, 2024

What kind of magnet length to grainsize ratio did you use to get to this number? 🤔
Also 156 is a gross number, 256 is right there! (or 128?)

But good to hear that an upper limit is probably physically fine. I still don't like bottom-up-filling due to the history dependency, so I would take some "random" number modulo maxRegions? Although this leaves a lot of "holes" in InterParameter

@lamoreel
Copy link
Contributor Author

The number 156 comes from the fact that a certain region typically has no more than 6-7 neighboring regions (2D). The upper limit of 156 of a uniform integer distribution assures that the chance of 2 neighboring regions having the same region index is less than 5%. If the grainsize is relatively big, this typical number of neighbors decreases, leading to a smaller upper limit.

I don't want to use a modulo operator because this is very susceptible for correlations between different region indices, screwing with the (pseudo) randomness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants