diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H index a8c430061d..e4f9190cc5 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H @@ -1,4 +1,4 @@ -volScalarField rAUrel = 1.0/UrelEqn().A(); +volScalarField rAUrel(1.0/UrelEqn().A()); Urel = rAUrel*UrelEqn().H(); if (pimple.nCorr() <= 1) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C index e8dd45fa11..0c4177ea42 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,34 +73,23 @@ Foam::tmp Foam::GidaspowErgunWenYu::K volScalarField bp(pow(beta, -2.65)); volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3))); - volScalarField Cds(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re); - - forAll(Re, celli) - { - if (Re[celli] > 1000.0) - { - Cds[celli] = 0.44; - } - } + volScalarField Cds + ( + neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + + pos(Re - 1000)*0.44 + ); // Wen and Yu (1966) - tmp tKWenYu = 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d(); - volScalarField& KWenYu = tKWenYu(); - - // Ergun - forAll (beta, cellj) - { - if (beta[cellj] <= 0.8) - { - KWenYu[cellj] = - 150.0*alpha_[cellj]*phaseb_.nu().value()*phaseb_.rho().value() - /sqr(beta[cellj]*phasea_.d().value()) - + 1.75*phaseb_.rho().value()*Ur[cellj] - /(beta[cellj]*phasea_.d().value()); - } - } - - return tKWenYu; + return + ( + pos(beta - 0.8) + *(0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d()) + + neg(beta - 0.8) + *( + 150.0*alpha_*phaseb_.nu()*phaseb_.rho()/(sqr(beta*phasea_.d())) + + 1.75*phaseb_.rho()*Ur/(beta*phasea_.d()) + ) + ); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C index b9a7032759..8b8a284068 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,15 +72,12 @@ Foam::tmp Foam::GidaspowSchillerNaumann::K volScalarField bp(pow(beta, -2.65)); volScalarField Re(max(beta*Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3))); - volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re); - forAll(Re, celli) - { - if (Re[celli] > 1000.0) - { - Cds[celli] = 0.44; - } - } + volScalarField Cds + ( + neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + + pos(Re - 1000)*0.44 + ); return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C index 0e69c8b58e..abbfcec43c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,15 +69,12 @@ Foam::tmp Foam::SchillerNaumann::K ) const { volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3))); - volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re); - forAll(Re, celli) - { - if (Re[celli] > 1000.0) - { - Cds[celli] = 0.44; - } - } + volScalarField Cds + ( + neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + + pos(Re - 1000)*0.44 + ); return 0.75*Cds*phaseb_.rho()*Ur/phasea_.d(); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C index d852bc0a8e..1b7780f8de 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,15 +70,11 @@ Foam::tmp Foam::SyamlalOBrien::K { volScalarField beta(max(scalar(1) - alpha_, scalar(1.0e-6))); volScalarField A(pow(beta, 4.14)); - volScalarField B(0.8*pow(beta, 1.28)); - - forAll (beta, celli) - { - if (beta[celli] > 0.85) - { - B[celli] = pow(beta[celli], 2.65); - } - } + volScalarField B + ( + neg(beta - 0.85)*(0.8*pow(beta, 1.28)) + + pos(beta - 0.85)*(pow(beta, 2.65)) + ); volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3))); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/WenYu/WenYu.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/WenYu/WenYu.C index 00979db1e2..f34437f41e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/WenYu/WenYu.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/WenYu/WenYu.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,15 +72,11 @@ Foam::tmp Foam::WenYu::K volScalarField bp(pow(beta, -2.65)); volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3))); - volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re); - - forAll(Re, celli) - { - if (Re[celli] > 1000.0) - { - Cds[celli] = 0.44; - } - } + volScalarField Cds + ( + neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + + pos(Re - 1000)*0.44 + ); return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d(); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index fb03163a11..a4a242558a 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -150,7 +150,7 @@ void drawHitProblem } -scalarField curvature(const triSurface& surf) +scalarField calcCurvature(const triSurface& surf) { scalarField k(surf.points().size(), 0); @@ -400,6 +400,16 @@ int main(int argc, char *argv[]) "writeObj", "write extendedFeatureEdgeMesh obj files" ); + argList::addBoolOption + ( + "writeVTK", + "write extendedFeatureEdgeMesh vtk files" + ); + argList::addBoolOption + ( + "calcCurvature", + "calculate curvature and closeness fields" + ); argList::addOption ( "closeness", @@ -427,7 +437,13 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - if (env("FOAM_SIGFPE")) + bool writeVTK = args.optionFound("writeVTK"); + + bool writeObj = args.optionFound("writeObj"); + + bool curvature = args.optionFound("curvature"); + + if (curvature && env("FOAM_SIGFPE")) { WarningIn(args.executable()) << "Detected floating point exception trapping (FOAM_SIGFPE)." @@ -441,10 +457,6 @@ int main(int argc, char *argv[]) Info<< "Feature line extraction is only valid on closed manifold surfaces." << endl; - bool writeVTK = args.optionFound("writeVTK"); - - bool writeObj = args.optionFound("writeObj"); - const fileName surfFileName = args[1]; const fileName outFileName = args[2]; @@ -674,6 +686,13 @@ int main(int argc, char *argv[]) surf ); + if (!curvature) + { + Info<< "End\n" << endl; + + return 0; + } + // Find close features // // Dummy trim operation to mark features @@ -741,7 +760,8 @@ int main(int argc, char *argv[]) // ) // ); - // Examine curvature, feature proximity and internal and external closeness. + Info<< "Examine curvature, feature proximity and internal and " + << "external closeness." << endl; // Internal and external closeness @@ -935,7 +955,7 @@ int main(int argc, char *argv[]) externalClosenessField.write(); - scalarField k = curvature(surf); + scalarField k = calcCurvature(surf); // Modify the curvature values on feature edges and points to be zero. diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index dba1e73f3a..c79d8f0290 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -59,6 +59,10 @@ Description #ifdef USE_RANDOM # include +# if INT_MAX != 2147483647 +# error "INT_MAX != 2147483647" +# error "The random number generator may not work!" +# endif #endif // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -1250,7 +1254,7 @@ Foam::label Foam::osRandomInteger() Foam::scalar Foam::osRandomDouble() { #ifdef USE_RANDOM - return (scalar)random(); + return (scalar)random()/INT_MAX; #else return drand48(); #endif diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 1f1e25341e..3e52499e25 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -1,6 +1,6 @@ global/global.Cver -global/constants/constants.C -global/constants/dimensionedConstants.C +/* global/constants/constants.C in global.Cver */ +/* global/constants/dimensionedConstants.C in global.Cver */ global/argList/argList.C global/clock/clock.C @@ -136,7 +136,7 @@ $(StringStreams)/StringStreamsPrint.C Pstreams = $(Streams)/Pstreams $(Pstreams)/UIPstream.C $(Pstreams)/IPstream.C -$(Pstreams)/UPstream.C +/* $(Pstreams)/UPstream.C in global.Cver */ $(Pstreams)/UPstreamCommsStruct.C $(Pstreams)/Pstream.C $(Pstreams)/UOPstream.C @@ -181,7 +181,7 @@ $(IOobject)/IOobjectReadHeader.C $(IOobject)/IOobjectWriteHeader.C regIOobject = db/regIOobject -$(regIOobject)/regIOobject.C +/* $(regIOobject)/regIOobject.C in global.Cver */ $(regIOobject)/regIOobjectRead.C $(regIOobject)/regIOobjectWrite.C diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index bab7ac3901..ebbb6efb81 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -197,8 +197,22 @@ Foam::functionEntries::codeStream::getFunction } } - // all processes must wait for compile to finish - reduce(create, orOp()); + // all processes must wait for compile to finish - except if this + // file is only read on the master + bool masterOnly = + ( + regIOobject::fileModificationChecking + == regIOobject::timeStampMaster + ) + || ( + regIOobject::fileModificationChecking + == regIOobject::inotifyMaster + ); + + if (!masterOnly) + { + reduce(create, orOp()); + } if (isA(topDict(parentDict))) { diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index ef9a2ca9d2..3dc04c8b98 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,22 @@ bool Foam::JobInfo::constructed(false); #include "debug.C" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Read file modification checking switches + +#include "regIOobject.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Read parallel communication switches + +#include "UPstream.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Read constants + +#include "constants.C" +#include "dimensionedConstants.C" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read and set cell models diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H index 47f5cdd49c..6e99ca705a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H @@ -83,10 +83,8 @@ class fanPressureFvPatchScalarField : public totalPressureFvPatchScalarField { - // Private data - //- Tabulated fan curve - interpolationTable fanCurve_; +public: //- Fan flow direction enum fanFlowDirection @@ -97,6 +95,13 @@ class fanPressureFvPatchScalarField static const NamedEnum fanFlowDirectionNames_; +private: + + // Private data + + //- Tabulated fan curve + interpolationTable fanCurve_; + //- Direction of flow through the fan relative to patch fanFlowDirection direction_; diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 73e0ed3d43..54f6d8a754 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -1318,7 +1318,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground() } Info<< " Total number of vertices before redistribution " - << globalNRealVertices + << returnReduce(label(number_of_vertices()), sumOp