mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
StochasticDispersionRAS: Corrected spherical distribution of UTurb direction
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1650
This commit is contained in:
@ -99,17 +99,11 @@ Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
|
||||
// Calculate a random direction dir distributed uniformly
|
||||
// in spherical coordinates
|
||||
|
||||
const scalar theta = rnd.sample01<scalar>()*pi;
|
||||
const scalar phi = rnd.sample01<scalar>()*twoPi;
|
||||
const scalar theta = rnd.sample01<scalar>()*twoPi;
|
||||
const scalar u = 2*rnd.sample01<scalar>() - 1;
|
||||
|
||||
// Optimising compilers will use the sincos function
|
||||
const scalar sinTheta = sin(theta);
|
||||
const scalar cosTheta = cos(theta);
|
||||
|
||||
const scalar sinPhi = sin(phi);
|
||||
const scalar cosPhi = cos(phi);
|
||||
|
||||
const vector dir(sinTheta*cosPhi, sinTheta*sinPhi, cosTheta);
|
||||
const scalar a = sqrt(1 - sqr(u));
|
||||
const vector dir(a*cos(theta), a*sin(theta), u);
|
||||
|
||||
// Numerical Recipes... Ch. 7. Random Numbers...
|
||||
scalar x1 = 0;
|
||||
|
||||
Reference in New Issue
Block a user