Skip to main content
`Ctrl`+`K`

# DMSwarmInitializeVelocities

Set the initial velocities of particles using a distribution.

## Synopsis

    #include "petscdmswarm.h"
    PetscErrorCode DMSwarmInitializeVelocities(DM sw, PetscProbFn *sampler, const PetscReal v0[])

Collective

## Input Parameters

- sw - The `DMSWARM` object

- sampler - A function which uniformly samples the velocity PDF

- v0 - The velocity scale for nondimensionalization for each species

## Note

If `v0` is zero for the first species, all velocities are set to zero. If it is zero for any other species, the effect will be to give that species zero velocity.

## See Also

`DMSWARM`, `DMSwarmComputeLocalSize()`, `DMSwarmInitializeCoordinates()`, `DMSwarmInitializeVelocitiesFromOptions()`

## Level

advanced

## Location

src/dm/impls/swarm/swarmpic.c

Index of all DMSwarm routines
Table of Contents for all manual pages
Index of all manual pages