mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated diesel library for updated pdf/random containers
This commit is contained in:
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "commonRailInjector.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Random.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -175,13 +174,13 @@ Foam::commonRailInjector::~commonRailInjector()
|
||||
|
||||
void Foam::commonRailInjector::setTangentialVectors()
|
||||
{
|
||||
Random rndGen(label(0));
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
scalar magV = 0.0;
|
||||
vector tangent;
|
||||
|
||||
while (magV < SMALL)
|
||||
{
|
||||
vector testThis = rndGen.vector01();
|
||||
vector testThis = rndGen.sample01<vector>();
|
||||
|
||||
tangent = testThis - (testThis & direction_)*direction_;
|
||||
magV = mag(tangent);
|
||||
@ -223,7 +222,7 @@ Foam::vector Foam::commonRailInjector::position
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
if (twoD)
|
||||
@ -241,8 +240,8 @@ Foam::vector Foam::commonRailInjector::position
|
||||
else
|
||||
{
|
||||
// otherwise, disc injection
|
||||
scalar iRadius = d_*rndGen.scalar01();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
|
||||
scalar iRadius = d_*rndGen.sample01<scalar>();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.sample01<scalar>();
|
||||
|
||||
return
|
||||
(
|
||||
|
||||
@ -138,7 +138,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "definedInjector.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Random.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -158,13 +157,13 @@ Foam::definedInjector::~definedInjector()
|
||||
|
||||
void Foam::definedInjector::setTangentialVectors()
|
||||
{
|
||||
Random rndGen(label(0));
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
scalar magV = 0.0;
|
||||
vector tangent;
|
||||
|
||||
while (magV < SMALL)
|
||||
{
|
||||
vector testThis = rndGen.vector01();
|
||||
vector testThis = rndGen.sample01<vector>();
|
||||
|
||||
tangent = testThis - (testThis & direction_)*direction_;
|
||||
magV = mag(tangent);
|
||||
@ -204,7 +203,7 @@ Foam::vector Foam::definedInjector::position
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
if (twoD)
|
||||
@ -222,8 +221,8 @@ Foam::vector Foam::definedInjector::position
|
||||
else
|
||||
{
|
||||
// otherwise, disc injection
|
||||
scalar iRadius = d_*rndGen.scalar01();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
|
||||
scalar iRadius = d_*rndGen.sample01<scalar>();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.sample01<scalar>();
|
||||
|
||||
return
|
||||
(
|
||||
|
||||
@ -139,7 +139,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "vector.H"
|
||||
#include "scalarField.H"
|
||||
#include "Random.H"
|
||||
#include "cachedRandom.H"
|
||||
#include "liquidMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -120,7 +120,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const = 0;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "multiHoleInjector.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Random.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -194,7 +193,7 @@ void Foam::multiHoleInjector::setTangentialVectors()
|
||||
position_[i] = centerPosition_ + 0.5*nozzleTipDiameter_*dp;
|
||||
}
|
||||
|
||||
Random rndGen(label(0));
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
|
||||
for (label i=0; i<nHoles_; i++)
|
||||
{
|
||||
@ -202,7 +201,7 @@ void Foam::multiHoleInjector::setTangentialVectors()
|
||||
scalar magV = 0;
|
||||
while (magV < SMALL)
|
||||
{
|
||||
vector testThis = rndGen.vector01();
|
||||
vector testThis = rndGen.sample01<vector>();
|
||||
|
||||
tangent = testThis - (testThis & direction_[i])*direction_[i];
|
||||
magV = mag(tangent);
|
||||
@ -244,7 +243,7 @@ Foam::vector Foam::multiHoleInjector::position
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
if (twoD)
|
||||
@ -262,8 +261,8 @@ Foam::vector Foam::multiHoleInjector::position
|
||||
else
|
||||
{
|
||||
// otherwise, disc injection
|
||||
scalar iRadius = d_*rndGen.scalar01();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
|
||||
scalar iRadius = d_*rndGen.sample01<scalar>();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.sample01<scalar>();
|
||||
|
||||
return
|
||||
(
|
||||
|
||||
@ -148,7 +148,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "swirlInjector.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Random.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -179,13 +178,13 @@ Foam::swirlInjector::~swirlInjector()
|
||||
|
||||
void Foam::swirlInjector::setTangentialVectors()
|
||||
{
|
||||
Random rndGen(label(0));
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
scalar magV = 0.0;
|
||||
vector tangent;
|
||||
|
||||
while (magV < SMALL)
|
||||
{
|
||||
vector testThis = rndGen.vector01();
|
||||
vector testThis = rndGen.sample01<vector>();
|
||||
|
||||
tangent = testThis - (testThis & direction_)*direction_;
|
||||
magV = mag(tangent);
|
||||
@ -226,7 +225,7 @@ Foam::vector Foam::swirlInjector::position
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
if (twoD)
|
||||
@ -244,8 +243,8 @@ Foam::vector Foam::swirlInjector::position
|
||||
else
|
||||
{
|
||||
// otherwise, disc injection
|
||||
scalar iRadius = d_*rndGen.scalar01();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
|
||||
scalar iRadius = d_*rndGen.sample01<scalar>();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.sample01<scalar>();
|
||||
|
||||
return
|
||||
(
|
||||
|
||||
@ -157,7 +157,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "unitInjector.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Random.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -154,13 +153,13 @@ Foam::unitInjector::~unitInjector()
|
||||
|
||||
void Foam::unitInjector::setTangentialVectors()
|
||||
{
|
||||
Random rndGen(label(0));
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
scalar magV = 0.0;
|
||||
vector tangent;
|
||||
|
||||
while (magV < SMALL)
|
||||
{
|
||||
vector testThis = rndGen.vector01();
|
||||
vector testThis = rndGen.sample01<vector>();
|
||||
|
||||
tangent = testThis - (testThis & direction_)*direction_;
|
||||
magV = mag(tangent);
|
||||
@ -199,7 +198,7 @@ Foam::vector Foam::unitInjector::position
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
if (twoD)
|
||||
@ -217,8 +216,8 @@ Foam::vector Foam::unitInjector::position
|
||||
else
|
||||
{
|
||||
// otherwise, disc injection
|
||||
scalar iRadius = d_*rndGen.scalar01();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
|
||||
scalar iRadius = d_*rndGen.sample01<scalar>();
|
||||
scalar iAngle = constant::mathematical::twoPi*rndGen.sample01<scalar>();
|
||||
|
||||
return
|
||||
(
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
const vector& axisOfSymmetry,
|
||||
const vector& axisOfWedge,
|
||||
const vector& axisOfWedgeNormal,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
) const;
|
||||
|
||||
//- Return the number of holes
|
||||
|
||||
@ -521,7 +521,7 @@ void Foam::parcel::updateParcelProperties
|
||||
|
||||
scalar Taverage = TDroplet + (Tg - TDroplet)/3.0;
|
||||
// for a liquid Cl \approx Cp
|
||||
scalar liquidcL = sDB.fuels().cp(pg, TDroplet, X());
|
||||
scalar liquidcL = sDB.fuels().Cp(pg, TDroplet, X());
|
||||
|
||||
cpMix = 0.0;
|
||||
for (label i=0; i<Ns; i++)
|
||||
|
||||
@ -65,7 +65,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
// calculate mixture properties
|
||||
scalar W = 0.0;
|
||||
scalar kMixture = 0.0;
|
||||
scalar cpMixture = 0.0;
|
||||
scalar CpMixture = 0.0;
|
||||
scalar muf = 0.0;
|
||||
|
||||
for (label i=0; i<Ns; i++)
|
||||
@ -74,7 +74,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
W += Y/sDB.gasProperties()[i].W();
|
||||
// Using mass-fractions to average...
|
||||
kMixture += Y*sDB.gasProperties()[i].kappa(Tf);
|
||||
cpMixture += Y*sDB.gasProperties()[i].Cp(Tf);
|
||||
CpMixture += Y*sDB.gasProperties()[i].Cp(Tf);
|
||||
muf += Y*sDB.gasProperties()[i].mu(Tf);
|
||||
}
|
||||
W = 1.0/W;
|
||||
@ -98,7 +98,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
scalar nuf = muf/rho;
|
||||
|
||||
scalar liquidDensity = fuels.rho(pressure, T(), X());
|
||||
scalar liquidcL = fuels.cp(pressure, T(), X());
|
||||
scalar liquidcL = fuels.Cp(pressure, T(), X());
|
||||
scalar heatOfVapour = fuels.hl(pressure, T(), X());
|
||||
|
||||
// calculate the partial rho of the fuel vapour
|
||||
@ -130,7 +130,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
}
|
||||
|
||||
scalar Reynolds = Re(Up, nuf);
|
||||
scalar Prandtl = Pr(cpMixture, muf, kMixture);
|
||||
scalar Prandtl = Pr(CpMixture, muf, kMixture);
|
||||
|
||||
// calculate the characteritic times
|
||||
|
||||
@ -280,7 +280,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
tauBoiling[i] = sDB.evaporation().boilingTime
|
||||
(
|
||||
fuels.properties()[i].rho(pressure, Td),
|
||||
fuels.properties()[i].cp(pressure, Td),
|
||||
fuels.properties()[i].Cp(pressure, Td),
|
||||
heatOfVapour,
|
||||
kMixture,
|
||||
Nusselt,
|
||||
@ -292,7 +292,7 @@ void Foam::parcel::setRelaxationTimes
|
||||
tBoilingSurface,
|
||||
vapourSurfaceEnthalpy,
|
||||
vapourFarEnthalpy,
|
||||
cpMixture,
|
||||
CpMixture,
|
||||
temperature,
|
||||
kLiquid
|
||||
);
|
||||
|
||||
@ -68,7 +68,7 @@ Foam::spray::spray
|
||||
runTime_(U.time()),
|
||||
time0_(runTime_.value()),
|
||||
mesh_(U.mesh()),
|
||||
rndGen_(label(0)),
|
||||
rndGen_(label(0), -1),
|
||||
g_(g.value()),
|
||||
|
||||
U_(U),
|
||||
|
||||
@ -39,7 +39,7 @@ Description
|
||||
#include "liquid.H"
|
||||
#include "autoPtr.H"
|
||||
#include "liquidMixture.H"
|
||||
#include "Random.H"
|
||||
#include "cachedRandom.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -76,7 +76,7 @@ class spray
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Random number generator
|
||||
Random rndGen_;
|
||||
cachedRandom rndGen_;
|
||||
|
||||
//- Acceleration due to gravity
|
||||
const vector& g_;
|
||||
@ -250,7 +250,7 @@ public:
|
||||
inline tmp<volScalarField> evaporationSource(const label i) const;
|
||||
inline tmp<volScalarField> heatTransferSource() const;
|
||||
|
||||
inline Random& rndGen();
|
||||
inline cachedRandom& rndGen();
|
||||
inline label subCycles() const;
|
||||
inline const vector& g() const;
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ inline tmp<volScalarField> spray::heatTransferSource() const
|
||||
}
|
||||
|
||||
|
||||
inline Random& spray::rndGen()
|
||||
inline cachedRandom& spray::rndGen()
|
||||
{
|
||||
return rndGen_;
|
||||
}
|
||||
|
||||
@ -54,7 +54,6 @@ Foam::LISA::LISA
|
||||
:
|
||||
atomizationModel(dict, sm),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
rndGen_(sm.rndGen()),
|
||||
Cl_(readScalar(coeffsDict_.lookup("Cl"))),
|
||||
cTau_(readScalar(coeffsDict_.lookup("cTau"))),
|
||||
Q_(readScalar(coeffsDict_.lookup("Q"))),
|
||||
@ -361,8 +360,8 @@ void Foam::LISA::atomizeParcel
|
||||
|
||||
do
|
||||
{
|
||||
x = minValue + range*rndGen_.scalar01();
|
||||
y = rndGen_.scalar01();
|
||||
x = minValue + range*rndGen_.sample01<scalar>();
|
||||
y = rndGen_.sample01<scalar>();
|
||||
|
||||
scalar xx = pow(x/dD, nExp);
|
||||
|
||||
|
||||
@ -68,7 +68,6 @@ private:
|
||||
// Private data
|
||||
|
||||
dictionary coeffsDict_;
|
||||
Random& rndGen_;
|
||||
scalar Cl_;
|
||||
scalar cTau_;
|
||||
scalar Q_;
|
||||
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
|
||||
const dictionary& dict_;
|
||||
spray& spray_;
|
||||
Random& rndGen_;
|
||||
cachedRandom& rndGen_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -56,8 +56,7 @@ Foam::blobsSheetAtomization::blobsSheetAtomization
|
||||
atomizationModel(dict, sm),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
B_(readScalar(coeffsDict_.lookup("B"))),
|
||||
angle_(readScalar(coeffsDict_.lookup("angle"))),
|
||||
rndGen_(sm.rndGen())
|
||||
angle_(readScalar(coeffsDict_.lookup("angle")))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -67,7 +67,6 @@ private:
|
||||
dictionary coeffsDict_;
|
||||
scalar B_;
|
||||
scalar angle_;
|
||||
Random& rndGen_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -53,7 +53,6 @@ Foam::SHF::SHF
|
||||
breakupModel(dict, sm),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
g_(sm.g()),
|
||||
rndGen_(sm.rndGen()),
|
||||
weCorrCoeff_(readScalar(coeffsDict_.lookup("weCorrCoeff"))),
|
||||
weBuCrit_(readScalar(coeffsDict_.lookup("weBuCrit"))),
|
||||
weBuBag_(readScalar(coeffsDict_.lookup("weBuBag"))),
|
||||
@ -186,9 +185,9 @@ void Foam::SHF::breakupParcel
|
||||
|
||||
do
|
||||
{
|
||||
x = cDmaxBM_*rndGen_.scalar01();
|
||||
x = cDmaxBM_*rndGen_.sample01<scalar>();
|
||||
d = sqr(x)*d05;
|
||||
y = rndGen_.scalar01();
|
||||
y = rndGen_.sample01<scalar>();
|
||||
|
||||
px =
|
||||
x
|
||||
@ -217,9 +216,9 @@ void Foam::SHF::breakupParcel
|
||||
do
|
||||
{
|
||||
|
||||
x = cDmaxS_*rndGen_.scalar01();
|
||||
x = cDmaxS_*rndGen_.sample01<scalar>();
|
||||
d = sqr(x)*d05;
|
||||
y = rndGen_.scalar01();
|
||||
y = rndGen_.sample01<scalar>();
|
||||
|
||||
px =
|
||||
x
|
||||
|
||||
@ -66,8 +66,6 @@ private:
|
||||
// reference to gravity
|
||||
const vector& g_;
|
||||
|
||||
Random& rndGen_;
|
||||
|
||||
// model constants
|
||||
|
||||
scalar weCorrCoeff_;
|
||||
|
||||
@ -175,7 +175,7 @@ void Foam::TAB::breakupParcel
|
||||
|
||||
label n = 0;
|
||||
bool found = false;
|
||||
scalar random = rndGen_.scalar01();
|
||||
scalar random = rndGen_.sample01<scalar>();
|
||||
while (!found && (n<99))
|
||||
{
|
||||
if (rrd_[n] > random)
|
||||
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
const dictionary& dict_;
|
||||
|
||||
spray& spray_;
|
||||
Random& rndGen_;
|
||||
cachedRandom& rndGen_;
|
||||
|
||||
Switch includeOscillation_;
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::ORourkeCollisionModel::ORourkeCollisionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
)
|
||||
:
|
||||
collisionModel(dict, sm, rndGen),
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ scalar mdMin = mMin/nMin;
|
||||
scalar nu0 = 0.25*constant::mathematical::pi*sqr(sumD)*magVRel*dt/vols_[cell1];
|
||||
scalar nu = nMin*nu0;
|
||||
scalar collProb = exp(-nu);
|
||||
scalar xx = rndGen_.scalar01();
|
||||
scalar xx = rndGen_.sample01<scalar>();
|
||||
|
||||
if ((xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL))
|
||||
{
|
||||
@ -62,7 +62,7 @@ if ((xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL))
|
||||
scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMin/sigma);
|
||||
|
||||
scalar coalesceProb = min(1.0, 2.4*f/WeColl);
|
||||
scalar prob = rndGen_.scalar01();
|
||||
scalar prob = rndGen_.sample01<scalar>();
|
||||
|
||||
// Coalescence
|
||||
if (prob < coalesceProb && coalescence_)
|
||||
|
||||
@ -41,7 +41,7 @@ Foam::collisionModel::collisionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
|
||||
@ -34,7 +34,7 @@ Description
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "spray.H"
|
||||
#include "Random.H"
|
||||
#include "cachedRandom.H"
|
||||
#include "Switch.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
// Protected data
|
||||
const dictionary& dict_;
|
||||
spray& spray_;
|
||||
Random& rndGen_;
|
||||
cachedRandom& rndGen_;
|
||||
|
||||
//dictionary coeffsDict_;
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
),
|
||||
(dict, sm, rndGen)
|
||||
);
|
||||
@ -89,7 +89,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
);
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::autoPtr<Foam::collisionModel> Foam::collisionModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
)
|
||||
{
|
||||
const word modelType(dict.lookup("collisionModel"));
|
||||
|
||||
@ -49,7 +49,7 @@ Foam::noCollision::noCollision
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
)
|
||||
:
|
||||
collisionModel(dict, sm, rndGen)
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -51,7 +51,7 @@ if (vAlign > 0)
|
||||
pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_)
|
||||
*exp(-cTime_*mag(alpha-beta));
|
||||
|
||||
scalar xx = rndGen_.scalar01();
|
||||
scalar xx = rndGen_.sample01<scalar>();
|
||||
|
||||
spray::iterator pMin = p1;
|
||||
spray::iterator pMax = p2;
|
||||
@ -106,7 +106,7 @@ if (vAlign > 0)
|
||||
|
||||
scalar coalesceProb = min(1.0, 2.4*f/WeColl);
|
||||
|
||||
scalar prob = rndGen_.scalar01();
|
||||
scalar prob = rndGen_.sample01<scalar>();
|
||||
|
||||
// Coalescence
|
||||
if ( prob < coalesceProb && coalescence_)
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::trajectoryCollisionModel::trajectoryCollisionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
)
|
||||
:
|
||||
collisionModel(dict, sm, rndGen),
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
(
|
||||
const dictionary& dict,
|
||||
spray& sm,
|
||||
Random& rndGen
|
||||
cachedRandom& rndGen
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -102,8 +102,8 @@ void Foam::gradientDispersionRAS::disperseParcels() const
|
||||
scalar rsq = 10.0;
|
||||
while ((rsq > 1.0) || (rsq == 0.0))
|
||||
{
|
||||
x1 = 2.0*spray_.rndGen().scalar01() - 1.0;
|
||||
x2 = 2.0*spray_.rndGen().scalar01() - 1.0;
|
||||
x1 = 2.0*spray_.rndGen().sample01<scalar>() - 1.0;
|
||||
x2 = 2.0*spray_.rndGen().sample01<scalar>() - 1.0;
|
||||
rsq = x1*x1 + x2*x2;
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ void Foam::stochasticDispersionRAS::disperseParcels() const
|
||||
elmnt().tTurb() = 0.0;
|
||||
|
||||
scalar sigma = sqrt(2.0*k[cellI]/3.0);
|
||||
vector dir = 2.0*spray_.rndGen().vector01() - one;
|
||||
vector dir = 2.0*spray_.rndGen().sample01<vector>() - one;
|
||||
dir /= mag(dir) + SMALL;
|
||||
|
||||
// numerical recipes... Ch. 7. Random Numbers...
|
||||
@ -104,8 +104,8 @@ void Foam::stochasticDispersionRAS::disperseParcels() const
|
||||
scalar rsq = 10.0;
|
||||
while (rsq > 1.0 || rsq == 0.0)
|
||||
{
|
||||
x1 = 2.0*spray_.rndGen().scalar01() - 1.0;
|
||||
x2 = 2.0*spray_.rndGen().scalar01() - 1.0;
|
||||
x1 = 2.0*spray_.rndGen().sample01<scalar>() - 1.0;
|
||||
x2 = 2.0*spray_.rndGen().sample01<scalar>() - 1.0;
|
||||
rsq = x1*x1 + x2*x2;
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ Foam::vector Foam::ChomiakInjector::direction
|
||||
scalar alpha = sin(angle);
|
||||
scalar dcorr = cos(angle);
|
||||
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -105,7 +105,7 @@ Foam::scalar Foam::blobsSwirlInjector::d0
|
||||
{
|
||||
const injectorType& it = injectors_[n].properties();
|
||||
|
||||
scalar c = rndGen_.scalar01();
|
||||
scalar c = rndGen_.sample01<scalar>();
|
||||
|
||||
angle_ = degToRad(coneAngle_[n]/2.0 + c*coneInterval_[n]);
|
||||
|
||||
@ -139,7 +139,7 @@ Foam::vector Foam::blobsSwirlInjector::direction
|
||||
{
|
||||
scalar alpha = sin(angle_);
|
||||
scalar dcorr = cos(angle_);
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -130,11 +130,12 @@ Foam::vector Foam::constInjector::direction
|
||||
*/
|
||||
|
||||
scalar angle =
|
||||
rndGen_.scalar01()*sprayAngle_[n]*constant::mathematical::pi/360.0;
|
||||
rndGen_.sample01<scalar>()*sprayAngle_[n]
|
||||
*constant::mathematical::pi/360.0;
|
||||
scalar alpha = sin(angle);
|
||||
scalar dcorr = cos(angle);
|
||||
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -157,11 +157,11 @@ Foam::vector Foam::definedHollowConeInjector::direction
|
||||
scalar angleOuter = it.getTableValue(outerConeAngle_, t);
|
||||
|
||||
// use random number to generate angle between inner/outer cone angles
|
||||
scalar angle = angleInner + rndGen_.scalar01()*(angleOuter - angleInner);
|
||||
scalar angle = rndGen_.position<scalar>(angleInner, angleOuter);
|
||||
|
||||
scalar alpha = sin(angle*constant::mathematical::pi/360.0);
|
||||
scalar dcorr = cos(angle*constant::mathematical::pi/360.0);
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -90,7 +90,7 @@ Foam::scalar Foam::definedPressureSwirlInjector::d0
|
||||
{
|
||||
const injectorType& it = injectors_[n].properties();
|
||||
|
||||
scalar c = rndGen_.scalar01();
|
||||
scalar c = rndGen_.sample01<scalar>();
|
||||
scalar coneAngle = it.getTableValue(coneAngle_, t);
|
||||
scalar coneInterval = it.getTableValue(coneInterval_, t);
|
||||
angle_ = coneAngle ;
|
||||
@ -212,7 +212,7 @@ Foam::vector Foam::definedPressureSwirlInjector::direction
|
||||
{
|
||||
scalar alpha = sin(angle_);
|
||||
scalar dcorr = cos(angle_);
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -124,11 +124,10 @@ Foam::vector Foam::hollowConeInjector::direction
|
||||
const scalar d
|
||||
) const
|
||||
{
|
||||
scalar angle =
|
||||
innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]);
|
||||
scalar angle = rndGen_.position<scalar>(innerAngle_[n], outerAngle_[n]);
|
||||
scalar alpha = sin(angle*constant::mathematical::pi/360.0);
|
||||
scalar dcorr = cos(angle*constant::mathematical::pi/360.0);
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
spray& sm_;
|
||||
|
||||
const PtrList<injector>& injectors_;
|
||||
Random& rndGen_;
|
||||
cachedRandom& rndGen_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -100,7 +100,7 @@ Foam::scalar Foam::pressureSwirlInjector::d0
|
||||
{
|
||||
const injectorType& it = injectors_[n].properties();
|
||||
|
||||
scalar c = rndGen_.scalar01();
|
||||
scalar c = rndGen_.sample01<scalar>();
|
||||
angle_ = coneAngle_[n] + 2.0*coneInterval_[n]*(0.5 - c);
|
||||
|
||||
angle_ *= constant::mathematical::pi/360.0;
|
||||
@ -134,7 +134,7 @@ Foam::vector Foam::pressureSwirlInjector::direction
|
||||
{
|
||||
scalar alpha = sin(angle_);
|
||||
scalar dcorr = cos(angle_);
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.scalar01();
|
||||
scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
|
||||
|
||||
// randomly distributed vector normal to the injection vector
|
||||
vector normal = vector::zero;
|
||||
|
||||
Reference in New Issue
Block a user