diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index 87720db898c6264bd45bae02a663ad82d6168078..cf5da63f97f20cabc78e6b2bc555b2e58969bc88 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.C @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) fft::reverseTransform ( K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn() - ) + )*recRootN ); #include "globalProperties.H" diff --git a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H index 0d6b417d5ab7084596f490151e2fa393516703f0..0b44eed10cfea2bf319a713ac20a21240e9a5832 100644 --- a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H +++ b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H @@ -19,3 +19,10 @@ Kmesh K(mesh); 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)); diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C index 61653947eaa78b1c6def79881c8bbecda449ad9b..a97edc185418e1df5941edde9a5933306398cbff 100644 --- a/applications/utilities/postProcessing/noise/noise.C +++ b/applications/utilities/postProcessing/noise/noise.C @@ -55,8 +55,8 @@ Usage } - // Input file - inputFile "postProcessing/faceSource1/surface/patch/patch.case"; + // Input files list + files ("postProcessing/faceSource1/surface/patch/patch.case";) // Surface reader reader ensight; diff --git a/src/OpenFOAM/primitives/random/Random/Random.C b/src/OpenFOAM/primitives/random/Random/Random.C index 307fcb0eb1b0d42e5644d1780f638c1b14b41deb..523155c2510784389a814f02a9bc8bf0b1d4e68f 100644 --- a/src/OpenFOAM/primitives/random/Random/Random.C +++ b/src/OpenFOAM/primitives/random/Random/Random.C @@ -121,7 +121,24 @@ Foam::scalar Foam::Random::position template<> 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()) { - value = scalar01()*(end - start); + value = position<scalar>(start, end); } Pstream::scatter(value); - return start + value; + return value; } @@ -220,12 +237,12 @@ Foam::label Foam::Random::globalPosition if (Pstream::master()) { - value = round(scalar01()*(end - start)); + value = position<label>(start, end); } Pstream::scatter(value); - return start + value; + return value; } diff --git a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H index 8714d37f5fc847e36de0e6ce1068bbbf43e154ab..d38ddbd5b5b197b74d14d4400d75ed195654dc38 100644 --- a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H +++ b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H @@ -100,6 +100,12 @@ public: //- Calculate time scale virtual tmp<volScalarField> timeScale() = 0; + //- Return the CEDC coefficient + scalar CEDC() const + { + return CEDC_; + } + // I-O diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H index 17219906d58abe24a1b6dc3eb6f2781bdef5217c..471df97e49a354652ec2a8960a9e8520d8e6b0aa 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.H +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H @@ -39,6 +39,7 @@ SourceFiles #define singleStepCombustion_H #include "singleStepReactingMixture.H" +#include "fvScalarMatrix.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C index 1a260dac90e6e7fc3a49cc31cc891730095e1898..77435d66b48130a125332b23ad70a976a094c8e5 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C @@ -180,7 +180,7 @@ Foam::scalar Foam::COxidationIntrinsicRate<CloudType>::calculate max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL); // 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] const scalar R = eta*d/6.0*rhop*Ag_*ki; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index d141ce77fecf3d955b341ed8aabc2d87b28267d8..db0296b9147308243770bc074301dbdf3185407d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -198,12 +198,12 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject { const scalar targetVolume = flowRateProfile_.integrate(0, time1); - const label targetParcels = - parcelsPerInjector_*targetVolume/this->volumeTotal_; + const scalar volumeFraction = targetVolume/this->volumeTotal_; - const label nToInject = targetParcels - nInjected_; + const label targetParcels = + ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction); - return positionAxis_.size()*nToInject; + return targetParcels - nInjected_; } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index 245bb27f85b7092cbb76b3f9481eb7dddbb43de7..065bf8124840aa067ce9a6763e894a7e1f26a880 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -214,7 +214,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection while(magTangent < SMALL) { - vector v = rndGen.sample01<vector>(); + vector v = rndGen.globalSample01<vector>(); tangent = v - (v & direction_)*direction_; magTangent = mag(tangent); @@ -354,7 +354,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell { 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); switch (injectionMethod_) diff --git a/src/randomProcesses/turbulence/turbGen.C b/src/randomProcesses/turbulence/turbGen.C index b942ee49b6de741cfc4162be196af82fa9fdcbb1..9d1a74b6494c2016407be049a0c6acbbd9b6a16c 100644 --- a/src/randomProcesses/turbulence/turbGen.C +++ b/src/randomProcesses/turbulence/turbGen.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,6 +60,13 @@ Foam::vectorField Foam::turbGen::U() 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 ( fft::reverseTransform @@ -67,7 +74,7 @@ Foam::vectorField Foam::turbGen::U() ComplexField(cos(constant::mathematical::twoPi*rndPhases)*s, sin(constant::mathematical::twoPi*rndPhases)*s), K.nn() - ) + )*recRootN ); return ReImSum(up); diff --git a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H index 555d28b0489fbffcadc52ac6fdb405c7f3eefb82..a53d7f8b79af7292f1967e8bf1d286b97283bccf 100644 --- a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H +++ b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H @@ -32,7 +32,7 @@ Description This boundary condition can operate in four modes: - \c constantMass: thermal inertia only - - requires \c rho, \c thickness and \cp + - requires \c rho, \c thickness and \c p - \c condensation: condensation only - when the wall temperature (Tw) is below the dew temperature (Tdew) condesation takes place and the resulting condensed mass is stored @@ -60,21 +60,26 @@ Description 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: \vartable D_{ab} | mass vapour difussivity L | characteristic length - Sc | Schmidt number + Sh | Sherwood number \endvartable - The Schmidt number is calculated using: + The Sherwood number is calculated using: \f{eqnarray*}{ 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 \f} + where: + \vartable + Re | Reynolds number + Sc | Schmidt number + \endvartable NOTE: - The correlation used to calculate Tdew is for water vapour. diff --git a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties index 593d1c3cc3bbbc778a55a55c480b23d3765b4544..07dd23e0528ce90a2962396ee70adc12b5c87873 100644 --- a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties @@ -85,9 +85,8 @@ subModels massTotal 10; parcelsPerInjector 20000; - parcelsPerSecond 500; parcelBasisType mass; - flowRateProfile constant 0.1; + flowRateProfile constant 1; Umag constant 3.0; thetaInner constant 0; thetaOuter constant 45;