diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index c16a43deae..c824ec7e3c 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -319,6 +319,7 @@ int vtkPV3FoamReader::RequestData << output->GetNumberOfBlocks() << " blocks\n"; } + #ifdef EXPERIMENTAL_TIME_CACHING bool needsUpdate = false; @@ -373,6 +374,9 @@ int vtkPV3FoamReader::RequestData #endif + // Do any cleanup on the Foam side + foamData_->CleanUp(); + return 1; } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 0ed3d53185..4c4016c364 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -492,11 +492,15 @@ void Foam::vtkPV3Foam::Update convertLagrangianFields(lagrangianOutput); reader_->UpdateProgress(0.95); + meshChanged_ = fieldsChanged_ = false; +} + + +void Foam::vtkPV3Foam::CleanUp() +{ // reclaim some memory reduceMemory(); reader_->UpdateProgress(1.0); - - meshChanged_ = fieldsChanged_ = false; } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index af0fb849a4..985f6a3d17 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -700,6 +700,9 @@ public: vtkMultiBlockDataSet* lagrangianOutput ); + //- Clean any storage + void CleanUp(); + //- Allocate and return a list of selected times // returns the count via the parameter double* findTimes(int& nTimeSteps); diff --git a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C index 2f5bf1e946..2816b40d59 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C @@ -91,7 +91,7 @@ bool Foam::IOobject::readHeader(Istream& is) << "First token could not be read or is not the keyword 'FoamFile'" << nl << nl << "Check header is of the form:" << nl << endl; - writeHeader(Info); + writeHeader(SeriousError); return false; } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index ab9709e993..8b689d0d66 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,11 +29,265 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fvMatrices.H" -#include "PackedList.H" #include "syncTools.H" - #include "faceSet.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::MRFZone::setMRFFaces +( + labelList& faceType, + const labelList& excludedPatchIDs +) +{ + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + // Knock out coupled patches + forAll(patches, patchi) + { + if (patches[patchi].coupled()) + { + const polyPatch& pp = patches[patchi]; + + forAll(pp, j) + { + label faceI = pp.start()+j; + + if (faceType[faceI] == 1) + { + faceType[faceI] = 2; + } + } + } + } + + // All explicitly provided exclusions + forAll(excludedPatchIDs, i) + { + const polyPatch& pp = patches[excludedPatchIDs[i]]; + + forAll(pp, j) + { + label faceI = pp.start()+j; + + if (faceType[faceI] == 1) + { + faceType[faceI] = 2; + } + } + } + + // Collect into lists per patch. + internalFaces_.setSize(mesh_.nFaces()); + label nInternal = 0; + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + if (faceType[faceI] == 1) + { + internalFaces_[nInternal++] = faceI; + } + } + internalFaces_.setSize(nInternal); + + labelList nIncludedFaces(patches.size(), 0); + labelList nExcludedFaces(patches.size(), 0); + + forAll(patches, patchi) + { + const polyPatch& pp = patches[patchi]; + + forAll(pp, patchFacei) + { + label faceI = pp.start()+patchFacei; + + if (faceType[faceI] == 1) + { + nIncludedFaces[patchi]++; + } + else if (faceType[faceI] == 2) + { + nExcludedFaces[patchi]++; + } + } + } + + includedFaces_.setSize(patches.size()); + excludedFaces_.setSize(patches.size()); + forAll(nIncludedFaces, patchi) + { + includedFaces_[patchi].setSize(nIncludedFaces[patchi]); + excludedFaces_[patchi].setSize(nExcludedFaces[patchi]); + } + nIncludedFaces = 0; + nExcludedFaces = 0; + + forAll(patches, patchi) + { + const polyPatch& pp = patches[patchi]; + + forAll(pp, patchFacei) + { + label faceI = pp.start()+patchFacei; + + if (faceType[faceI] == 1) + { + includedFaces_[patchi][nIncludedFaces[patchi]++] = patchFacei; + } + else if (faceType[faceI] == 2) + { + excludedFaces_[patchi][nExcludedFaces[patchi]++] = patchFacei; + } + } + } + + //if (debug) + //{ + // faceSet internalFaces(mesh_, "internalFaces", internalFaces_); + // Pout<< "Writing internal faces in MRF zone to faceSet " + // << internalFaces.name() << endl; + // internalFaces.write(); + //} + //{ + // faceSet MRFFaces(mesh_, "includedFaces", 100); + // forAll(includedFaces_, patchi) + // { + // forAll(includedFaces_[patchi], i) + // { + // label patchFacei = includedFaces_[patchi][i]; + // MRFFaces.insert(patches[patchi].start()+patchFacei); + // } + // } + // Pout<< "Writing patch faces in MRF zone to faceSet " + // << MRFFaces.name() << endl; + // MRFFaces.write(); + //} + //{ + // faceSet excludedFaces(mesh_, "excludedFaces", 100); + // forAll(excludedFaces_, patchi) + // { + // forAll(excludedFaces_[patchi], i) + // { + // label patchFacei = excludedFaces_[patchi][i]; + // excludedFaces.insert(patches[patchi].start()+patchFacei); + // } + // } + // Pout<< "Writing faces in MRF zone with special handling to faceSet " + // << excludedFaces.name() << endl; + // excludedFaces.write(); + //} +} + + +void Foam::MRFZone::setMRFFaces() +{ + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + // Type per face: + // 0:not in zone + // 1:moving with frame + // 2:other + labelList faceType(mesh_.nFaces(), 0); + + bool faceZoneFound = (faceZoneID_ != -1); + reduce(faceZoneFound, orOp()); + + if (faceZoneFound) + { + // Explicitly provided faces. + if (faceZoneID_ != -1) + { + const labelList& zoneFaces = mesh_.faceZones()[faceZoneID_]; + + forAll(zoneFaces, i) + { + faceType[zoneFaces[i]] = 1; + } + + if (allPatchesMove_) + { + // Explicitly provided patches that do not move + setMRFFaces(faceType, patchLabels_); + } + else + { + setMRFFaces(faceType, labelList(0)); + } + } + } + else + { + // Determine faces in cell zone + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // (without constructing cells) + + const labelList& own = mesh_.faceOwner(); + const labelList& nei = mesh_.faceNeighbour(); + + // Cells in zone + boolList zoneCell(mesh_.nCells(), false); + + if (cellZoneID_ != -1) + { + const labelList& cellLabels = mesh_.cellZones()[cellZoneID_]; + forAll(cellLabels, i) + { + zoneCell[cellLabels[i]] = true; + } + } + + + label nZoneFaces = 0; + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + if (zoneCell[own[faceI]] || zoneCell[nei[faceI]]) + { + faceType[faceI] = 1; + nZoneFaces++; + } + } + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (!isA(pp)) + { + forAll(pp, i) + { + label faceI = pp.start()+i; + + if (zoneCell[own[faceI]]) + { + faceType[faceI] = 1; + nZoneFaces++; + } + } + } + } + syncTools::syncFaceList(mesh_, faceType, maxEqOp