Commit f52a5648 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updated diesel library for updated pdf/random containers

parent 114de081
......@@ -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")))
{}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment