From 2f8c7782f43acdc8cb4471a1530e484de407e59c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 2 Dec 2009 14:02:07 +0100 Subject: [PATCH] removed dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C.save - was not touched for a very long time, seems to be left over from the pre-git era --- .../dynamicRefineFvMesh.C.save | 1507 ----------------- 1 file changed, 1507 deletions(-) delete mode 100644 src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C.save diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C.save b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C.save deleted file mode 100644 index 00d2ebe0c6..0000000000 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C.save +++ /dev/null @@ -1,1507 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "SortableList.H" -#include "dynamicRefineFvMesh.H" -#include "addToRunTimeSelectionTable.H" -#include "volFields.H" -#include "polyTopoChange.H" -#include "surfaceFields.H" -#include "fvCFD.H" -#include "syncTools.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(dynamicRefineFvMesh, 0); - -addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -label dynamicRefineFvMesh::count(const PackedList<1>& lst, const unsigned int v) -{ - label n = 0; - - forAll(lst, i) - { - if (lst.get(i) == v) - { - n++; - } - } - return n; -} - - -void dynamicRefineFvMesh::calculateProtectedCells -( - PackedList<1>& unrefineableCell -) const -{ - if (protectedCell_.size() == 0) - { - unrefineableCell.clear(); - return; - } - - const labelList& cellLevel = meshCutter_.cellLevel(); - - unrefineableCell = protectedCell_; - - // Get neighbouring cell level - labelList neiLevel(nFaces()-nInternalFaces()); - - for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++) - { - neiLevel[faceI-nInternalFaces()] = cellLevel[faceOwner()[faceI]]; - } - syncTools::swapBoundaryFaceList(*this, neiLevel, false); - - - while (true) - { - // Pick up faces on border of protected cells - boolList seedFace(nFaces(), false); - - forAll(faceNeighbour(), faceI) - { - label own = faceOwner()[faceI]; - bool ownProtected = (unrefineableCell.get(own) == 1); - label nei = faceNeighbour()[faceI]; - bool neiProtected = (unrefineableCell.get(nei) == 1); - - if (ownProtected && (cellLevel[nei] > cellLevel[own])) - { - seedFace[faceI] = true; - } - else if (neiProtected && (cellLevel[own] > cellLevel[nei])) - { - seedFace[faceI] = true; - } - } - for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++) - { - label own = faceOwner()[faceI]; - bool ownProtected = (unrefineableCell.get(own) == 1); - if - ( - ownProtected - && (neiLevel[faceI-nInternalFaces()] > cellLevel[own]) - ) - { - seedFace[faceI] = true; - } - } - - syncTools::syncFaceList(*this, seedFace, orEqOp(), false); - - - // Extend unrefineableCell - bool hasExtended = false; - - for (label faceI = 0; faceI < nInternalFaces(); faceI++) - { - if (seedFace[faceI]) - { - label own = faceOwner()[faceI]; - if (unrefineableCell.get(own) == 0) - { - unrefineableCell.set(own, 1); - hasExtended = true; - } - - label nei = faceNeighbour()[faceI]; - if (unrefineableCell.get(nei) == 0) - { - unrefineableCell.set(nei, 1); - hasExtended = true; - } - } - } - for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++) - { - if (seedFace[faceI]) - { - label own = faceOwner()[faceI]; - if (unrefineableCell.get(own) == 0) - { - unrefineableCell.set(own, 1); - hasExtended = true; - } - } - } - - if (!returnReduce(hasExtended, orOp())) - { - break; - } - } -} - - -void dynamicRefineFvMesh::readDict() -{ - dictionary refineDict - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ).subDict(typeName + "Coeffs") - ); - - correctFluxes_ = List >(refineDict.lookup("correctFluxes")); - - if (refineDict.found("projectSurfaces")) - { - surfacesPtr_.reset - ( - new triSurfaceMeshes - ( - IOobject - ( - "abc", // dummy name - time().constant(), // directory - "triSurface", // instance - time(), // registry - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - refineDict.lookup("projectSurfaces") - ) - ); - - wordList projectPatchNames(refineDict.lookup("projectPatches")); - - projectSurfaces_.setSize(boundaryMesh().size()); - - forAll(projectPatchNames, i) - { - label patchI = boundaryMesh().findPatchID(projectPatchNames[i]); - - if (patchI == -1) - { - FatalErrorIn("dynamicRefineFvMesh::readDict()") - << "Illegal projectPatch " << projectPatchNames[i] << endl - << "Valid patch names are " << boundaryMesh().names() - << exit(FatalError); - } - - // For now have patches always refer to all surfaces - projectSurfaces_[patchI] = identity(surfacesPtr_().size()); - } - - matchDistSqr_ = Foam::sqr - ( - readScalar(refineDict.lookup("projectDistance")) - ); - } -} - - -// Project new vertices onto surface -void dynamicRefineFvMesh::project -( - const mapPolyMesh& map, - pointField& points -) const -{ - if (!surfacesPtr_.valid()) - { - return; - } - - - const polyBoundaryMesh& patches = boundaryMesh(); - const labelList& pointMap = map.pointMap(); - const labelList& reversePointMap = map.reversePointMap(); - - pointIndexHit hitInfo; - - forAll(patches, patchI) - { - if (projectSurfaces_[patchI].size() > 0) - { - const labelList& meshPoints = patches[patchI].meshPoints(); - - forAll(meshPoints, i) - { - label pointI = meshPoints[i]; - - label oldPointI = pointMap[pointI]; - - if (oldPointI < 0 || reversePointMap[oldPointI] != pointI) - { - // New point. Project. - surfacesPtr_().findNearest - ( - projectSurfaces_[patchI], - points[pointI], - matchDistSqr_, - hitInfo - ); - - if (hitInfo.hit()) - { - points[pointI] = hitInfo.hitPoint(); - } - } - } - } - } -} - - -// Refines cells, maps fields and recalculates (an approximate) flux -autoPtr dynamicRefineFvMesh::refine -( - const labelList& cellsToRefine -) -{ - // Mesh changing engine. - polyTopoChange meshMod(*this); - - // Play refinement commands into mesh changer. - meshCutter_.setRefinement(cellsToRefine, meshMod); - - // Create mesh (with inflation), return map from old to new mesh. - //autoPtr map = meshMod.changeMesh(*this, true); - autoPtr map = meshMod.changeMesh(*this, false); - - Info<< "Refined from " - << returnReduce(map().nOldCells(), sumOp