Merge branch 'master' into develop

This commit is contained in:
Andrew Heather
2018-06-13 14:17:47 +01:00
12 changed files with 65 additions and 23 deletions

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
fft::reverseTransform fft::reverseTransform
( (
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn() K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
) )*recRootN
); );
#include "globalProperties.H" #include "globalProperties.H"

View File

@ -19,3 +19,10 @@
Kmesh K(mesh); Kmesh K(mesh);
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties); UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
label ntot = 1;
forAll(K.nn(), idim)
{
ntot *= K.nn()[idim];
}
const scalar recRootN = 1.0/Foam::sqrt(scalar(ntot));

View File

@ -55,8 +55,8 @@ Usage
} }
// Input file // Input files list
inputFile "postProcessing/faceSource1/surface/patch/patch.case"; files ("postProcessing/faceSource1/surface/patch/patch.case";)
// Surface reader // Surface reader
reader ensight; reader ensight;

View File

@ -121,7 +121,24 @@ Foam::scalar Foam::Random::position
template<> template<>
Foam::label Foam::Random::position(const label& start, const label& end) Foam::label Foam::Random::position(const label& start, const label& end)
{ {
return start + round(scalar01()*(end - start)); #ifdef FULLDEBUG
if (start > end)
{
FatalErrorInFunction
<< "start index " << start << " > end index " << end << nl
<< abort(FatalError);
}
#endif
// Extend the upper sampling range by 1 and floor the result.
// Since the range is non-negative, can use integer truncation
// instead using floor().
const label val = start + label(scalar01()*(end - start + 1));
// Rare case when scalar01() returns exactly 1.000 and the truncated
// value would be out of range.
return min(val, end);
} }
@ -200,12 +217,12 @@ Foam::scalar Foam::Random::globalPosition
if (Pstream::master()) if (Pstream::master())
{ {
value = scalar01()*(end - start); value = position<scalar>(start, end);
} }
Pstream::scatter(value); Pstream::scatter(value);
return start + value; return value;
} }
@ -220,12 +237,12 @@ Foam::label Foam::Random::globalPosition
if (Pstream::master()) if (Pstream::master())
{ {
value = round(scalar01()*(end - start)); value = position<label>(start, end);
} }
Pstream::scatter(value); Pstream::scatter(value);
return start + value; return value;
} }

View File

@ -100,6 +100,12 @@ public:
//- Calculate time scale //- Calculate time scale
virtual tmp<volScalarField> timeScale() = 0; virtual tmp<volScalarField> timeScale() = 0;
//- Return the CEDC coefficient
scalar CEDC() const
{
return CEDC_;
}
// I-O // I-O

View File

@ -39,6 +39,7 @@ SourceFiles
#define singleStepCombustion_H #define singleStepCombustion_H
#include "singleStepReactingMixture.H" #include "singleStepReactingMixture.H"
#include "fvScalarMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -180,7 +180,7 @@ Foam::scalar Foam::COxidationIntrinsicRate<CloudType>::calculate
max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL); max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL);
// Effectiveness factor [] // Effectiveness factor []
const scalar eta = max(3.0*sqr(phi)*(phi/tanh(phi) - 1.0), 0.0); const scalar eta = max(3.0/sqr(phi)*(phi/tanh(phi) - 1.0), 0.0);
// Chemical rate [kmol/m2/s] // Chemical rate [kmol/m2/s]
const scalar R = eta*d/6.0*rhop*Ag_*ki; const scalar R = eta*d/6.0*rhop*Ag_*ki;

View File

@ -198,12 +198,12 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject
{ {
const scalar targetVolume = flowRateProfile_.integrate(0, time1); const scalar targetVolume = flowRateProfile_.integrate(0, time1);
const scalar volumeFraction = targetVolume/this->volumeTotal_;
const label targetParcels = const label targetParcels =
parcelsPerInjector_*targetVolume/this->volumeTotal_; ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction);
const label nToInject = targetParcels - nInjected_; return targetParcels - nInjected_;
return positionAxis_.size()*nToInject;
} }
else else
{ {

View File

@ -214,7 +214,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
while(magTangent < SMALL) while(magTangent < SMALL)
{ {
vector v = rndGen.sample01<vector>(); vector v = rndGen.globalSample01<vector>();
tangent = v - (v & direction_)*direction_; tangent = v - (v & direction_)*direction_;
magTangent = mag(tangent); magTangent = mag(tangent);
@ -354,7 +354,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
{ {
Random& rndGen = this->owner().rndGen(); Random& rndGen = this->owner().rndGen();
scalar beta = mathematical::twoPi*rndGen.sample01<scalar>(); scalar beta = mathematical::twoPi*rndGen.globalSample01<scalar>();
normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta); normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta);
switch (injectionMethod_) switch (injectionMethod_)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,6 +60,13 @@ Foam::vectorField Foam::turbGen::U()
s = Ek(Ea, k0, mag(K))*s; s = Ek(Ea, k0, mag(K))*s;
label ntot = 1;
forAll(K.nn(), idim)
{
ntot *= K.nn()[idim];
}
const scalar recRootN = 1.0/sqrt(scalar(ntot));
complexVectorField up complexVectorField up
( (
fft::reverseTransform fft::reverseTransform
@ -67,7 +74,7 @@ Foam::vectorField Foam::turbGen::U()
ComplexField(cos(constant::mathematical::twoPi*rndPhases)*s, ComplexField(cos(constant::mathematical::twoPi*rndPhases)*s,
sin(constant::mathematical::twoPi*rndPhases)*s), sin(constant::mathematical::twoPi*rndPhases)*s),
K.nn() K.nn()
) )*recRootN
); );
return ReImSum(up); return ReImSum(up);

View File

@ -60,21 +60,26 @@ Description
The mass transfer correlation used is: The mass transfer correlation used is:
\f[ h_m = D_{ab} \frac{Sc}{L} \f] \f[ h_m = D_{ab} \frac{Sh}{L} \f]
where: where:
\vartable \vartable
D_{ab} | mass vapour difussivity D_{ab} | mass vapour difussivity
L | characteristic length L | characteristic length
Sc | Schmidt number Sh | Sherwood number
\endvartable \endvartable
The Schmidt number is calculated using: The Sherwood number is calculated using:
\f{eqnarray*}{ \f{eqnarray*}{
0.664 Re^\frac{1}{2} Sc^\frac{1}{3} & Re < 5.0E+05 \\ 0.664 Re^\frac{1}{2} Sc^\frac{1}{3} & Re < 5.0E+05 \\
0.037 Re^\frac{4}{5} Sc^\frac{1}{3} & Re > 5.0E+05 0.037 Re^\frac{4}{5} Sc^\frac{1}{3} & Re > 5.0E+05
\f} \f}
where:
\vartable
Re | Reynolds number
Sc | Schmidt number
\endvartable
NOTE: NOTE:
- The correlation used to calculate Tdew is for water vapour. - The correlation used to calculate Tdew is for water vapour.

View File

@ -85,9 +85,8 @@ subModels
massTotal 10; massTotal 10;
parcelsPerInjector 20000; parcelsPerInjector 20000;
parcelsPerSecond 500;
parcelBasisType mass; parcelBasisType mass;
flowRateProfile constant 0.1; flowRateProfile constant 1;
Umag constant 3.0; Umag constant 3.0;
thetaInner constant 0; thetaInner constant 0;
thetaOuter constant 45; thetaOuter constant 45;