From 9a87a043d6dac4b503ebc20b005019e985005d58 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 30 Oct 2018 12:01:36 +0000 Subject: [PATCH] ENH: consistency updates for patchToFace topoSetSource (#1060) - Support specification with "patches" and "patch" keywords (similar to zone selection). Keyword "name" for compatibility. --- .../faceSources/patchToFace/patchToFace.C | 33 ++++++++++++------- .../faceSources/patchToFace/patchToFace.H | 23 ++++++------- .../LES/compartmentFire/system/topoSetDict | 2 +- .../system/topoSetDict | 2 +- .../LES/simplePMMApanel/system/topoSetDict | 2 +- .../oscillatingInletACMI2D/system/topoSetDict | 4 +-- .../system/createInletOutletSets.topoSetDict | 2 +- .../mixerVesselAMI2D/system/topoSetDict | 2 +- .../simpleFoam/pipeCyclic/system/topoSetDict | 4 +-- .../cylinder/system/topoSetDict | 2 +- .../system/wallFilmRegion.topoSet | 2 +- .../splashPanel/system/wallFilmRegion.topoSet | 2 +- .../flange/system/topoSetDict-background | 2 +- .../simple-cube1/system/topoSetDict.patches | 2 +- .../laminar/sphereDrop/system/topoSetDict | 4 +-- .../system/topoSetDict.createCollector | 2 +- .../system/createInletOutletSets.topoSetDict | 2 +- .../mixerVesselAMI2D/system/topoSetDict | 2 +- .../oscillatingBox/system/topoSetDict | 2 +- .../system/topoSetDict-selectBottom | 2 +- .../oscillatingBox/system/topoSetDict | 2 +- 21 files changed, 56 insertions(+), 44 deletions(-) diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C index 9694a42fa4..a7a502d54f 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C @@ -51,7 +51,7 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const { labelHashSet patchIDs = mesh_.boundaryMesh().patchSet ( - List(1, patchName_), + selectedPatches_, true, // warn if not found true // use patch groups if available ); @@ -77,8 +77,10 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const if (patchIDs.empty()) { WarningInFunction - << "Cannot find any patch named " << patchName_ << endl - << "Valid names are " << mesh_.boundaryMesh().names() << endl; + << "Cannot find any patches matching " + << flatOutput(selectedPatches_) << nl + << "Valid names are " << flatOutput(mesh_.boundaryMesh().names()) + << endl; } } @@ -88,11 +90,11 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const Foam::patchToFace::patchToFace ( const polyMesh& mesh, - const word& patchName + const wordRe& patchName ) : topoSetSource(mesh), - patchName_(patchName) + selectedPatches_(one(), patchName) {} @@ -103,8 +105,16 @@ Foam::patchToFace::patchToFace ) : topoSetSource(mesh), - patchName_(dict.get("name")) -{} + selectedPatches_() +{ + // Look for 'patches' and 'patch', but accept 'name' as well + if (!dict.readIfPresent("patches", selectedPatches_)) + { + selectedPatches_.resize(1); + selectedPatches_.first() = + dict.getCompat("patch", {{"name", 1806}}); + } +} Foam::patchToFace::patchToFace @@ -114,7 +124,7 @@ Foam::patchToFace::patchToFace ) : topoSetSource(mesh), - patchName_(checkIs(is)) + selectedPatches_(one(), wordRe(checkIs(is))) {} @@ -128,14 +138,15 @@ void Foam::patchToFace::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding all faces of patch " << patchName_ << " ..." << endl; + Info<< " Adding all faces of patches " + << flatOutput(selectedPatches_) << " ..." << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing all faces of patch " << patchName_ << " ..." - << endl; + Info<< " Removing all faces of patches " + << flatOutput(selectedPatches_) << " ..." << endl; combine(set, false); } diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H index e956cc516c..98d8addd72 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,10 +29,15 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - name | Patch name or regex to select | yes | + Property | Description | Required | Default + patch | The face zone name or regex | possibly | + patches | The face zone names or regexs | possibly | + name | Older specification for 'patch' | no | \endtable +Note + Selection of multiple patches has precedence. + SourceFiles patchToFace.C @@ -42,7 +47,7 @@ SourceFiles #define patchToFace_H #include "topoSetSource.H" -#include "wordRe.H" +#include "wordRes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,8 +68,8 @@ class patchToFace //- Add usage string static addToUsageTable usage_; - //- Name/regular expression of patch - wordRe patchName_; + //- Matcher for patches + wordRes selectedPatches_; // Private Member Functions @@ -80,11 +85,7 @@ public: // Constructors //- Construct from components - patchToFace - ( - const polyMesh& mesh, - const word& patchName - ); + patchToFace(const polyMesh& mesh, const wordRe& patchName); //- Construct from dictionary patchToFace(const polyMesh& mesh, const dictionary& dict); diff --git a/tutorials/combustion/fireFoam/LES/compartmentFire/system/topoSetDict b/tutorials/combustion/fireFoam/LES/compartmentFire/system/topoSetDict index e9154fd75f..a4c7c7240b 100644 --- a/tutorials/combustion/fireFoam/LES/compartmentFire/system/topoSetDict +++ b/tutorials/combustion/fireFoam/LES/compartmentFire/system/topoSetDict @@ -67,7 +67,7 @@ actions source patchToFace; sourceInfo { - name inlet; + patch inlet; } } diff --git a/tutorials/combustion/fireFoam/LES/flameSpreadWaterSuppressionPanel/system/topoSetDict b/tutorials/combustion/fireFoam/LES/flameSpreadWaterSuppressionPanel/system/topoSetDict index ad3c8e2985..492c5bd72f 100644 --- a/tutorials/combustion/fireFoam/LES/flameSpreadWaterSuppressionPanel/system/topoSetDict +++ b/tutorials/combustion/fireFoam/LES/flameSpreadWaterSuppressionPanel/system/topoSetDict @@ -36,7 +36,7 @@ actions source patchToFace; sourceInfo { - name coupledWallTmp; + patch coupledWallTmp; } } diff --git a/tutorials/combustion/fireFoam/LES/simplePMMApanel/system/topoSetDict b/tutorials/combustion/fireFoam/LES/simplePMMApanel/system/topoSetDict index 2c47e07f5e..b1abf7f6bc 100644 --- a/tutorials/combustion/fireFoam/LES/simplePMMApanel/system/topoSetDict +++ b/tutorials/combustion/fireFoam/LES/simplePMMApanel/system/topoSetDict @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name coupledPatch; + patch coupledPatch; } } diff --git a/tutorials/incompressible/pimpleFoam/RAS/oscillatingInletACMI2D/system/topoSetDict b/tutorials/incompressible/pimpleFoam/RAS/oscillatingInletACMI2D/system/topoSetDict index 6fdbf32173..efe8b3f4c6 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/oscillatingInletACMI2D/system/topoSetDict +++ b/tutorials/incompressible/pimpleFoam/RAS/oscillatingInletACMI2D/system/topoSetDict @@ -27,7 +27,7 @@ actions source patchToFace; sourceInfo { - name couple1; + patch couple1; } } { @@ -49,7 +49,7 @@ actions source patchToFace; sourceInfo { - name couple2; + patch couple2; } } { diff --git a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/createInletOutletSets.topoSetDict b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/createInletOutletSets.topoSetDict index 0149316d52..a1aea929c5 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/createInletOutletSets.topoSetDict +++ b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/createInletOutletSets.topoSetDict @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name outerCylinder; + patch outerCylinder; } } diff --git a/tutorials/incompressible/pimpleFoam/laminar/mixerVesselAMI2D/system/topoSetDict b/tutorials/incompressible/pimpleFoam/laminar/mixerVesselAMI2D/system/topoSetDict index ec5a253e51..c89d90af46 100644 --- a/tutorials/incompressible/pimpleFoam/laminar/mixerVesselAMI2D/system/topoSetDict +++ b/tutorials/incompressible/pimpleFoam/laminar/mixerVesselAMI2D/system/topoSetDict @@ -27,7 +27,7 @@ actions source patchToFace; sourceInfo { - name "AMI.*"; + patch "AMI.*"; } } ); diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict b/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict index dbcaeb4865..17030d220d 100644 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name "side1"; + patch side1; } } { @@ -57,7 +57,7 @@ actions source patchToFace; sourceInfo { - name "walls"; + patch walls; } } { diff --git a/tutorials/lagrangian/reactingParcelFoam/cylinder/system/topoSetDict b/tutorials/lagrangian/reactingParcelFoam/cylinder/system/topoSetDict index e0d4da9cfa..f237aab344 100644 --- a/tutorials/lagrangian/reactingParcelFoam/cylinder/system/topoSetDict +++ b/tutorials/lagrangian/reactingParcelFoam/cylinder/system/topoSetDict @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name filmWalls; + patch filmWalls; } } { diff --git a/tutorials/lagrangian/reactingParcelFoam/rivuletPanel/system/wallFilmRegion.topoSet b/tutorials/lagrangian/reactingParcelFoam/rivuletPanel/system/wallFilmRegion.topoSet index 03646e0139..8b7edbdfbf 100644 --- a/tutorials/lagrangian/reactingParcelFoam/rivuletPanel/system/wallFilmRegion.topoSet +++ b/tutorials/lagrangian/reactingParcelFoam/rivuletPanel/system/wallFilmRegion.topoSet @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name filmWalls; + patch filmWalls; } } { diff --git a/tutorials/lagrangian/reactingParcelFoam/splashPanel/system/wallFilmRegion.topoSet b/tutorials/lagrangian/reactingParcelFoam/splashPanel/system/wallFilmRegion.topoSet index e0d4da9cfa..f237aab344 100644 --- a/tutorials/lagrangian/reactingParcelFoam/splashPanel/system/wallFilmRegion.topoSet +++ b/tutorials/lagrangian/reactingParcelFoam/splashPanel/system/wallFilmRegion.topoSet @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name filmWalls; + patch filmWalls; } } { diff --git a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background index 8fd3b95a97..16a72497f1 100644 --- a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background +++ b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background @@ -186,7 +186,7 @@ FoamFile // // All faces of patch // source patchToFace; // { -// name ".*Wall"; // Name of patch, regular expressions allowed +// patch ".*Wall"; // Name of patch, regular expressions allowed // } // // // All faces of faceZone diff --git a/tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict.patches b/tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict.patches index f4e1ce6430..c5d0a898eb 100644 --- a/tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict.patches +++ b/tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict.patches @@ -21,7 +21,7 @@ newFromPatch source patchToFace; sourceInfo { - name outer; + patch outer; } } diff --git a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict index 40cd58f308..04f2b19299 100644 --- a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict +++ b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict @@ -66,7 +66,7 @@ actions source patchToFace; sourceInfo { - name top; + patch top; } } @@ -192,7 +192,7 @@ actions source patchToFace; sourceInfo { - name bottom; + patch bottom; } } diff --git a/tutorials/multiphase/interFoam/laminar/vofToLagrangian/eulerianInjection/system/topoSetDict.createCollector b/tutorials/multiphase/interFoam/laminar/vofToLagrangian/eulerianInjection/system/topoSetDict.createCollector index da5d1cfd6c..5d45a4ed6d 100644 --- a/tutorials/multiphase/interFoam/laminar/vofToLagrangian/eulerianInjection/system/topoSetDict.createCollector +++ b/tutorials/multiphase/interFoam/laminar/vofToLagrangian/eulerianInjection/system/topoSetDict.createCollector @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name sides; + patch sides; } } diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/createInletOutletSets.topoSetDict b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/createInletOutletSets.topoSetDict index 0149316d52..a1aea929c5 100644 --- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/createInletOutletSets.topoSetDict +++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/createInletOutletSets.topoSetDict @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name outerCylinder; + patch outerCylinder; } } diff --git a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/system/topoSetDict b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/system/topoSetDict index ec5a253e51..c89d90af46 100644 --- a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/system/topoSetDict +++ b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/system/topoSetDict @@ -27,7 +27,7 @@ actions source patchToFace; sourceInfo { - name "AMI.*"; + patch "AMI.*"; } } ); diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict index 6dfb30f4ec..8e258e26d3 100644 --- a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict @@ -41,7 +41,7 @@ actions source patchToFace; sourceInfo { - name freeSurface; + patch freeSurface; } } diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom index ca30f92595..f1f9c23861 100644 --- a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom @@ -24,7 +24,7 @@ actions source patchToFace; sourceInfo { - name floatingObject; + patch floatingObject; } } diff --git a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/system/topoSetDict b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/system/topoSetDict index 6dfb30f4ec..8e258e26d3 100644 --- a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/system/topoSetDict +++ b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/system/topoSetDict @@ -41,7 +41,7 @@ actions source patchToFace; sourceInfo { - name freeSurface; + patch freeSurface; } }