initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / preProcessing / molConfig / velocityDistributions / uniform.H
blob9c178af262aabb88a239f9711b1c334cdd39e4e1
1 scalar initVelMag =
2     sqrt
3     (
4         3.0*(1.0 - 1.0 / totalZoneMols)
5        *moleculeCloud::kb*temperature
6        /mass
7     );
9 for (molN = totalMols; molN < totalMols + totalZoneMols; molN++)
11     // Assign velocity: random direction, magnitude determined by desired
12     // temperature
14     // Temperature gradients could be created by specifying a gradient in the
15     // zone subDict, or by reading a field from a mesh.
17     // The velocities are treated on a zone-by-zone basis for the purposes of
18     // removal of bulk momentum - hence nMols becomes totalZoneMols
20     velocity = (2.0*rand.vector01() - vector::one);
22     velocity *= initVelMag/mag(velocity);
24     momentumSum += mass*velocity;
26     initialVelocities.append(velocity);