userFuncVelGen

userFuncVelGen

Velocity generator that determines the velocity components based on a user-specified UserFunc (as function of particle position and time, as well as the surface normal for particle emission).

userFuncVelGen Parameters

velocityGenerator (block, required)

<UserFunc velocityGenerator> is a UserFunc that takes arguments (t, x, n) where t is a scalar (the time, in seconds), x is an NDIM-dimensional vector of floats (position), and n is also an NDIM-dimensional vector of floats (surface normal). The UserFunc should return as many floats as the <Species> has internal variables: generally, this is 3 (velocities) plus 1 (if tagged) plus 1 (if variable weight). The return value sets the particle’s internal variables.

However, if the last internal variable is particle weight, that can be omitted, in which case, the weight will be determined via the PositionGenerator.

The surface normal is set to zero when a particle is “loaded”, but is set to the surface normal when a particle is “emitted.”

userFuncVelGen Example Block

<VelocityGenerator velgen>
   kind = userFuncVelGen
   <Expression velocityGenerator>
     kind = expression
     # don't forget the particle weight--the last element
     # the tag (penultimate element) will be overwritten by Species,
     #   as we requested
     expression = vector(\
       boostInX(randRelMaxwellSpeed() * rand3dUnitVec(), BETA_DRIFT), 0, 1)
   </Expression>
</VelocityGenerator>