-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add random velocity initialization functions #696
base: master
Are you sure you want to change the base?
Conversation
using counter for particle init will give non-intuitive results based on active threads
\brief Initialize random particles given an initialization functor. | ||
|
||
\param tag Initialization type tag. | ||
\param create_functor A functor which populates a particle given the logical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
template <class ExecutionSpace, class InitFunctor, class ParticleListType, | ||
class PositionTag, class VelocityTag, class ArrayType> | ||
int createParticles( | ||
InitRandom tag, InitRandom, ExecutionSpace exec_space, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the last InitRandom
? or one is for position and the other is for velocity?
auto gen = pool.get_state(); | ||
for ( int d = 0; d < 3; ++d ) | ||
Cabana::get( particle, VelocityTag(), d ) = | ||
Kokkos::rand<RandomType, double>::draw( gen, 0.0, 1.0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't necessarily assume its value between 0.0 and 1.0. Can we assign this value from the argument?
Related to #692
Pass a second init tag (so far just
InitRandom
) to create velocities. Version forParticleList
and forSlice
, both fused with the particle creation kernelNeeds more testing, more convenience interfaces, potentially more thought on sampling from distributions as compared to fully random creation