Skip to content

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 requested a review from kwitaechong September 29, 2023 17:43
@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