← Back to team overview

yade-users team mailing list archive

Re: [Question #692326]: random algorithm of makecloud

 

Question #692326 on Yade changed:
https://answers.launchpad.net/yade/+question/692326

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

what is "the random algorithm"?

1) the internal random number generator? 
It is std::mt19937 [1]

2) the general method of makeCloud?
have a look at the source code [2].
The algorithm is straightforward, it places randomly spheres and checks overlap with already placed spheres.
In the case of no overlap, it continues with other particles until the finish condition.
If there is an overlap, it retries to place the particle. If the amount of retries is too high, exit.

Roughly:
1. reset try counter
2. increment try counter, take random radius from given distribution, take random center from the makeCloud cube
3. test if there is an overlap with already existing spheres
4. there is NO overlap: go to 8
5. there IS some overlap: go to TODO
6. if try counter is too high: exit with some warning
7. go to 2
8. check terminal condition (number of particles, porosity, ...) according to input parameters
9. terminal condition fulfilled? then exit
10. terminal condition not fulfilled? go to 1

cheers
Jan

[1] https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/SpherePack.cpp#L111

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.