diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C index a63a88035b2f0ab3909fd5821f37e340e28e6909..114b37064167e9d6244eefc068b45a8dc302788c 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C @@ -97,34 +97,35 @@ void Foam::patchToPoly2DMesh::createNeighbours() Foam::labelList Foam::patchToPoly2DMesh::internalFaceOrder() { - const labelListList& cellFaces = patch_.faceEdges(); + const labelListList& faceEdges = patch_.faceEdges(); labelList oldToNew(owner_.size(), -1); label newFaceI = 0; - forAll(cellFaces, cellI) + forAll(faceEdges, faceI) { - const labelList& cFaces = cellFaces[cellI]; - // Neighbouring cells - SortableList<label> nbr(cFaces.size(), -1); + const labelList& fEdges = faceEdges[faceI]; + // Neighbouring faces + SortableList<label> nbr(fEdges.size(), -1); - forAll(cFaces, cfI) + forAll(fEdges, feI) { - if (cFaces[cfI] < neighbour_.size()) + if (fEdges[feI] < neighbour_.size()) { - label nbrFaceI = neighbour_[cFaces[cfI]]; + // Internal edge. Get the face on other side. - // Internal face. Get cell on other side. - if (nbrFaceI == cellI) + label nbrFaceI = neighbour_[fEdges[feI]]; + + if (nbrFaceI == faceI) { - nbrFaceI = owner_[cellI]; + nbrFaceI = owner_[fEdges[feI]]; } - if (cellI < nbrFaceI) + if (faceI < nbrFaceI) { - // CellI is master - nbr[cfI] = nbrFaceI; + // faceI is master + nbr[feI] = nbrFaceI; } } } @@ -135,7 +136,7 @@ Foam::labelList Foam::patchToPoly2DMesh::internalFaceOrder() { if (nbr[i] != -1) { - oldToNew[cFaces[nbr.indices()[i]]] = newFaceI++; + oldToNew[fEdges[nbr.indices()[i]]] = newFaceI++; } } } @@ -302,6 +303,33 @@ Foam::patchToPoly2DMesh::~patchToPoly2DMesh() void Foam::patchToPoly2DMesh::createMesh() { + for (label edgeI = 0; edgeI < patch_.nInternalEdges(); edgeI++) + { + if (patch_.edgeFaces()[edgeI].size() != 2) + { + FatalErrorIn("patchToPoly2DMesh::patchToPoly2DMesh(..)") + << "internal edge:" << edgeI + << " patch.edgeFaces()[edgeI]:" << patch_.edgeFaces()[edgeI] + << abort(FatalError); + } + } + + for + ( + label edgeI = patch_.nInternalEdges(); + edgeI < patch_.nEdges(); + edgeI++ + ) + { + if (patch_.edgeFaces()[edgeI].size() != 1) + { + FatalErrorIn("patchToPoly2DMesh::patchToPoly2DMesh(..)") + << "boundary edge:" << edgeI + << " patch.edgeFaces()[edgeI]:" << patch_.edgeFaces()[edgeI] + << abort(FatalError); + } + } + createPolyMeshComponents(); label startFace = patch_.nInternalEdges(); diff --git a/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C b/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C index deb0605aa098c83c5ff777c8b41928dd91d767a6..0ce6e785b61d8c0f63cd6caeaabddeb91f5bcaa9 100644 --- a/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C +++ b/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C @@ -542,7 +542,7 @@ void Foam::CV2D::newPoints() alignmentDirsB[0].x() ); - Field<vector2D> alignmentDirs(2); + Field<vector2D> alignmentDirs(alignmentDirsA); forAll(alignmentDirsA, aA) { diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 7c82ef91a2a572ec0264c670e6a106d80ca4b1dc..3ad100d4f268033ccb2a420e6c608200594c19f0 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) // Set all times on processor meshes equal to reconstructed mesh forAll(databases, procI) { - databases[procI].setTime(runTime.timeName(), runTime.timeIndex()); + databases[procI].setTime(runTime); } diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 74844aea826feb5f199db842a71e227743d3916c..65fddffbbcbffcead3a73779e3c939e6d0701531 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -323,8 +323,8 @@ Foam::fileName Foam::IOobject::filePath() const ) { fileName parentObjectPath = - rootPath()/caseName() - /".."/instance()/db_.dbDir()/local()/name(); + rootPath()/time().globalCaseName() + /instance()/db_.dbDir()/local()/name(); if (isFile(parentObjectPath)) { diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 1eb31e15fc38d8a9864042a358597e35c5c77cff..94c8b9cac4682b4c14ec552d69311c8a5e776663 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -386,7 +386,9 @@ Foam::Time::Time : TimePaths ( + args.parRunControl().parRun(), args.rootPath(), + args.globalCaseName(), args.caseName(), systemName, constantName @@ -702,13 +704,27 @@ Foam::instantList Foam::Time::times() const Foam::word Foam::Time::findInstancePath(const instant& t) const { - instantList timeDirs = findTimes(path(), constant()); + const fileName directory = path(); + const word& constantName = constant(); + + // Read directory entries into a list + fileNameList dirEntries(readDir(directory, fileName::DIRECTORY)); + + forAll(dirEntries, i) + { + scalar timeValue; + if (readScalar(dirEntries[i].c_str(), timeValue) && t.equal(timeValue)) + { + return dirEntries[i]; + } + } - forAllReverse(timeDirs, timeI) + if (t.equal(0.0)) { - if (timeDirs[timeI] == t) + // Looking for 0 or constant. 0 already checked above. + if (isDir(directory/constantName)) { - return timeDirs[timeI].name(); + return constantName; } } diff --git a/src/OpenFOAM/db/Time/TimePaths.C b/src/OpenFOAM/db/Time/TimePaths.C index b97398b87659898b7898aec4261d70ee4f796e1e..29f2c6967e55b38fa06147fcc368b58a04612e6b 100644 --- a/src/OpenFOAM/db/Time/TimePaths.C +++ b/src/OpenFOAM/db/Time/TimePaths.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,11 +35,41 @@ Foam::TimePaths::TimePaths const word& constantName ) : - processorCase_(caseName.find("processor") != string::npos), + processorCase_(false), rootPath_(rootPath), case_(caseName), system_(systemName), constant_(constantName) +{ + std::string::size_type pos = caseName.find("processor"); + if (pos != string::npos) + { + processorCase_ = true; + globalCaseName_ = caseName(pos-1); + } + else + { + globalCaseName_ = caseName; + } +} + + +Foam::TimePaths::TimePaths +( + const bool processorCase, + const fileName& rootPath, + const fileName& globalCaseName, + const fileName& caseName, + const word& systemName, + const word& constantName +) +: + processorCase_(processorCase), + rootPath_(rootPath), + globalCaseName_(globalCaseName), + case_(caseName), + system_(systemName), + constant_(constantName) {} diff --git a/src/OpenFOAM/db/Time/TimePaths.H b/src/OpenFOAM/db/Time/TimePaths.H index 3f261be6444d921abdddb93241d1311c38a1071e..0f5e1b11fd4384d07c4bc9865803e973bf0f11eb 100644 --- a/src/OpenFOAM/db/Time/TimePaths.H +++ b/src/OpenFOAM/db/Time/TimePaths.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,10 +52,11 @@ class TimePaths // Private data bool processorCase_; - fileName rootPath_; - fileName case_; - word system_; - word constant_; + const fileName rootPath_; + fileName globalCaseName_; + const fileName case_; + const word system_; + const word constant_; public: @@ -72,6 +73,18 @@ public: ); + //- Construct given database name, rootPath and casePath + TimePaths + ( + const bool processorCase, + const fileName& rootPath, + const fileName& globalCaseName, + const fileName& caseName, + const word& systemName, + const word& constantName + ); + + // Member functions //- Return true if this is a processor case @@ -86,6 +99,12 @@ public: return rootPath_; } + //- Return global case name + const fileName& globalCaseName() const + { + return globalCaseName_; + } + //- Return case name const fileName& caseName() const { diff --git a/src/OpenFOAM/db/Time/instant/instant.C b/src/OpenFOAM/db/Time/instant/instant.C index 46f6bb73f181dba4d467621f820e4130cdfda806..bcbe24e55db7705a76d1598a7ac9dcd7894621a9 100644 --- a/src/OpenFOAM/db/Time/instant/instant.C +++ b/src/OpenFOAM/db/Time/instant/instant.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,15 +54,19 @@ Foam::instant::instant(const word& tname) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::instant::equal(const scalar b) const +{ + return (value_ < b + SMALL && value_ > b - SMALL); +} + + // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // bool Foam::operator==(const instant& a, const instant& b) { - return - ( - a.value_ < b.value_ + SMALL - && a.value_ > b.value_ - SMALL - ); + return a.equal(b.value_); } diff --git a/src/OpenFOAM/db/Time/instant/instant.H b/src/OpenFOAM/db/Time/instant/instant.H index 9682d8e3f7eefdf7ddad825e67e842d825dc1317..be3ea4e011362b6cf8a4c7394f8398b871a63527 100644 --- a/src/OpenFOAM/db/Time/instant/instant.H +++ b/src/OpenFOAM/db/Time/instant/instant.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,10 +99,10 @@ public: instant(const scalar, const word&); //- Construct from time value - instant(const scalar); + explicit instant(const scalar); //- Construct from word - instant(const word&); + explicit instant(const word&); // Member Functions @@ -133,6 +133,9 @@ public: return name_; } + //- Comparison used for instants to be equal + bool equal(const scalar) const; + // Friend Operators diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C index 27376b14d5e6259e063658e276077cb13dc5a006..0d8011404cf67ce1ae5d2d6c7f10fa78e33a713e 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -229,8 +229,24 @@ curvatureSeparation::curvatureSeparation deltaByR1Min_(coeffs().lookupOrDefault<scalar>("deltaByR1Min", 0.0)), definedPatchRadii_(), magG_(mag(owner.g().value())), - gHat_(owner.g().value()/magG_) + gHat_(vector::zero) { + if (magG_ < ROOTVSMALL) + { + FatalErrorIn + ( + "curvatureSeparation::curvatureSeparation" + "(" + "const surfaceFilmModel&, " + "const dictionary&" + ")" + ) + << "Acceleration due to gravity must be non-zero" + << exit(FatalError); + } + + gHat_ = owner.g().value()/magG_; + List<Tuple2<word, scalar> > prIn(coeffs().lookup("definedPatchRadii")); const wordList& allPatchNames = owner.regionMesh().boundaryMesh().names(); diff --git a/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H index 7f24af81d6babfc994afde1d05a90ac7192d4137..f55698b4359f43d6dcd5a2d4a4feea6252847909 100644 --- a/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H @@ -57,8 +57,7 @@ namespace Foam ( \ SS##Comp##SThermo##GThermo, \ (word(SS::typeName_()) + "<"#Comp"," + SThermo::typeName() + "," + \ - GThermo::typeName() + \ - ">").c_str(), \ + GThermo::typeName() + ">").c_str(), \ 0 \ ); diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H index 447020e2f7ded4490ab5b6b82d2f45d7846063eb..6eb8e9b81b5b9c5ff3a1226aeae8fe412b507981 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H @@ -52,8 +52,8 @@ namespace Foam defineTemplateTypeNameAndDebugWithName \ ( \ SS##Schem##Comp##SThermo##GThermo, \ - (#SS"<"#Schem"<"#Comp"," + SThermo::typeName() + "," \ - + GThermo::typeName() + ">>").c_str(), \ + (#SS"<" + word(Schem::typeName_()) + "<"#Comp"," + SThermo::typeName()\ + + "," + GThermo::typeName() + ">>").c_str(), \ 0 \ ); \ \ @@ -76,7 +76,6 @@ namespace Foam GThermo \ ); \ \ - \ makeSolidChemistrySolverType \ ( \ ode, \ diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes index afb9f402f103f655e60bcebdde33457f94302ce8..7ba1c2cc9d3e61f12a630003a6a8c55beaa363b2 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes @@ -33,6 +33,7 @@ laplacianSchemes { default none; laplacian(thermo:alpha,h) Gauss linear uncorrected; + laplacian(kappa,T) Gauss harmonic uncorrected; } interpolationSchemes