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

Add random velocity initialization functions #696

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

streeve
Copy link
Member

@streeve streeve commented Sep 29, 2023

Related to #692

Pass a second init tag (so far just InitRandom) to create velocities. Version for ParticleList and for Slice, both fused with the particle creation kernel

Needs more testing, more convenience interfaces, potentially more thought on sampling from distributions as compared to fully random creation

@streeve streeve self-assigned this Sep 29, 2023
\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
Copy link
Collaborator

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,
Copy link
Collaborator

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 );
Copy link
Collaborator

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?

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

Successfully merging this pull request may close these issues.

2 participants