/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 3 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, see . Application createBaffles Group grpMeshManipulationUtilities 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. - if the patch already exists will not override it nor its fields - if the patch does not exist it will be created together with 'calculated' patchfields unless the field is mentioned in the patchFields section. - any 0-sized patches (since faces have been moved out) will get removed \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "polyTopoChange.H" #include "polyModifyFace.H" #include "polyAddFace.H" #include "ReadFields.H" #include "volFields.H" #include "surfaceFields.H" #include "fvMeshMapper.H" #include "faceSelection.H" #include "fvMeshTools.H" #include "topoSet.H" #include "processorMeshes.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // label addPatch ( fvMesh& mesh, const word& patchName, const word& groupName, const dictionary& patchDict ) { const polyBoundaryMesh& pbm = mesh.boundaryMesh(); if (pbm.findPatchID(patchName) == -1) { autoPtr ppPtr ( polyPatch::New ( patchName, patchDict, 0, pbm ) ); polyPatch& pp = ppPtr(); if (!groupName.empty() && !pp.inGroup(groupName)) { pp.inGroups().append(groupName); } // Add patch, create calculated everywhere fvMeshTools::addPatch ( mesh, pp, dictionary(), // do not set specialised patchFields calculatedFvPatchField::typeName, true // parallel sync'ed addition ); } else { Info<< "Patch '" << patchName << "' already exists. Only " << "moving patch faces - type will remain the same" << endl; } return pbm.findPatchID(patchName); } // Filter out the empty patches. void filterPatches(fvMesh& mesh, const HashSet& addedPatchNames) { // Remove any zero-sized ones. Assumes // - processor patches are already only there if needed // - all other patches are available on all processors // - but coupled ones might still be needed, even if zero-size // (e.g. processorCyclic) // See also logic in createPatch. const polyBoundaryMesh& pbm = mesh.boundaryMesh(); labelList oldToNew(pbm.size(), -1); label newPatchi = 0; forAll(pbm, patchi) { const polyPatch& pp = pbm[patchi]; if (!isA(pp)) { if ( isA(pp) || returnReduce(pp.size(), sumOp