Lagrangian: Removed more instances of random-number-based perpendicular vector calculations

Perpendicular vectors should be generated using the global
"perpendicular" function, which guarantees a non-zero result without a
random number generator and without looping.
This commit is contained in:
Will Bainbridge
2019-05-28 09:02:39 +01:00
parent aaed26965f
commit 68e9c8eac2
3 changed files with 5 additions and 41 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -173,20 +173,7 @@ void Foam::ParticleCollector<CloudType>::initConcentricCircles()
{
// Set 4 quadrants for single sector cases
nS = 4;
vector tangent = Zero;
scalar magTangent = 0.0;
Random rnd(1234);
while (magTangent < small)
{
vector v = rnd.sample01<vector>();
tangent = v - (v & normal_[0])*normal_[0];
magTangent = mag(tangent);
}
refDir = tangent/magTangent;
refDir = normalised(perpendicular(normal_[0]));
}
scalar dTheta = 5.0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,26 +83,6 @@ Foam::word Foam::ThermoSurfaceFilm<CloudType>::interactionTypeStr
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::vector Foam::ThermoSurfaceFilm<CloudType>::tangentVector
(
const vector& v
) const
{
vector tangent = Zero;
scalar magTangent = 0.0;
while (magTangent < small)
{
vector vTest = rndGen_.sample01<vector>();
tangent = vTest - (vTest & v)*v;
magTangent = mag(tangent);
}
return tangent/magTangent;
}
template<class CloudType>
Foam::vector Foam::ThermoSurfaceFilm<CloudType>::splashDirection
(
@ -358,7 +338,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
const vector& nf = pp.faceNormals()[facei];
// Determine direction vectors tangential to patch normal
const vector tanVec1 = tangentVector(nf);
const vector tanVec1 = normalised(perpendicular(nf));
const vector tanVec2 = nf^tanVec1;
// Retrieve parcel properties

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -151,9 +151,6 @@ protected:
// Protected Member Functions
//- Return a vector tangential to input vector, v
vector tangentVector(const vector& v) const;
//- Return splashed parcel direction
vector splashDirection
(