/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright held by original author \\/ 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 Description Makes internal faces into boundary faces. Does not duplicate points, unlike mergeOrSplitBaffles. Note: if any coupled patch face is selected for baffling the opposite member has to be selected for baffling as well. Note that this is the same as repatching. This was added only for convenience so you don't have to filter coupled boundary out of your set. \*---------------------------------------------------------------------------*/ #include "syncTools.H" #include "argList.H" #include "Time.H" #include "faceSet.H" #include "directTopoChange.H" #include "polyModifyFace.H" #include "polyAddFace.H" #include "ReadFields.H" #include "volFields.H" #include "surfaceFields.H" #include "ZoneIDs.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void modifyOrAddFace ( directTopoChange& meshMod, const face& f, const label faceI, const label own, const bool flipFaceFlux, const label newPatchI, const label zoneID, const bool zoneFlip, PackedBoolList& modifiedFace ) { if (!modifiedFace[faceI]) { // First usage of face. Modify. meshMod.setAction ( polyModifyFace ( f, // modified face faceI, // label of face own, // owner -1, // neighbour flipFaceFlux, // face flip newPatchI, // patch for face false, // remove from zone zoneID, // zone for face zoneFlip // face flip in zone ) ); modifiedFace[faceI] = 1; } else { // Second or more usage of face. Add. meshMod.setAction ( polyAddFace ( f, // modified face own, // owner -1, // neighbour -1, // master point -1, // master edge faceI, // master face flipFaceFlux, // face flip newPatchI, // patch for face zoneID, // zone for face zoneFlip // face flip in zone ) ); } } label findPatchID(const polyMesh& mesh, const word& name) { label patchI = mesh.boundaryMesh().findPatchID(name); if (patchI == -1) { FatalErrorIn("findPatchID(const polyMesh&, const word&)") << "Cannot find patch " << name << endl << "Valid patches are " << mesh.boundaryMesh().names() << exit(FatalError); } return patchI; } // Main program: int main(int argc, char *argv[]) { # include "addRegionOption.H" argList::validArgs.append("faceZone"); argList::validArgs.append("patch"); argList::validOptions.insert("additionalPatches", "(patch2 .. patchN)"); argList::validOptions.insert("internalFacesOnly", ""); argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); # include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); const faceZoneMesh& faceZones = mesh.faceZones(); // Faces to baffle faceZoneID zoneID(args.additionalArgs()[0], faceZones); Info<< "Converting faces on zone " << zoneID.name() << " into baffles." << nl << endl; if (zoneID.index() == -1) { FatalErrorIn(args.executable()) << "Cannot find faceZone " << zoneID.name() << endl << "Valid zones are " << faceZones.names() << exit(FatalError); } const faceZone& fZone = faceZones[zoneID.index()]; Info<< "Found " << returnReduce(fZone.size(), sumOp