Commit d0da21fe authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: allow new patch names in subsetMesh (issue #1019)

Previously had 3 possibilities for handling exposed internal faces

  1. use default "oldInternalFaces"
  2. specify -patch, to use the specified (existing) patch
  3. specify -patches, to use the geometrically closest patches

Now relaxed the restriction on -patch to allow specification of a new
(not yet existing) patch name. This improves flexibility, but won't
catch typing mistakes.

Harmonize behaviour of -patches and -patch. When -patches is used to
specify a single, non-regex patch name, it now behaves identically to
-patch. Since the getList handling for options already allows special
treatment for single parameter lists, the following will work
identically:

      subsetMesh -patch  patch0
      subsetMesh -patches patch0
      subsetMesh -patches '( patch0 )'

In the future it might be reasonable to fully combine the behaviour of
'-patch' and '-patches' and treat them as aliases for each other.

ENH: support subsetMesh on a cellZone.

- when the '-zone' option is specified, the command argument is treated
  as the name (or names) of cellZones to be selected instead of as the
  name of the cellSet.

  The command argument can be a single word, regex, or list of
  word/regex.
  Eg,

      subsetMesh -zone -patch mypatch  mixer
      subsetMesh -zone -patch mypatch  '(mixer "moving.*" )'

STYLE: simplify set handling and other code cleanup in subsetMesh
parent 54457c68
......@@ -18,7 +18,7 @@ _of_complete_cache_[ansysToFoam]="-case -fileHandler -scale | -noFunctionObjects
_of_complete_cache_[applyBoundaryLayer]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -region -roots -ybl | -listFunctionObjects -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -parallel -write-nut -doc -doc-source -help"
_of_complete_cache_[attachMesh]="-case -fileHandler | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -doc -doc-source -help"
_of_complete_cache_[autoPatch]="-case -fileHandler | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -doc -doc-source -help"
_of_complete_cache_[blockMesh]="-case -dict -fileHandler -region | -blockTopology -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noClean -noFunctionObjects -sets -doc -doc-source -help"
_of_complete_cache_[blockMesh]="-case -dict -fileHandler -region -time | -blockTopology -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noClean -noFunctionObjects -sets -doc -doc-source -help"
_of_complete_cache_[boundaryFoam]="-case -fileHandler -listScalarBCs -listVectorBCs | -dry-run -dry-run-write -listFunctionObjects -listFvOptions -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -doc -doc-source -help"
_of_complete_cache_[boxTurb]="-case -fileHandler -listScalarBCs -listVectorBCs | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -doc -doc-source -help"
_of_complete_cache_[buoyantBoussinesqPimpleFoam]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -roots | -dry-run -dry-run-write -listFunctionObjects -listFvOptions -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -parallel -postProcess -doc -doc-source -help"
......@@ -235,7 +235,7 @@ _of_complete_cache_[SRFSimpleFoam]="-case -decomposeParDict -fileHandler -hostRo
_of_complete_cache_[star4ToFoam]="-case -fileHandler -scale | -ascii -noFunctionObjects -solids -doc -doc-source -help"
_of_complete_cache_[steadyParticleTracks]="-case -dict -fileHandler -region -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -newTimes -noFunctionObjects -noZero -doc -doc-source -help"
_of_complete_cache_[stitchMesh]="-case -dict -fileHandler -listScalarBCs -listVectorBCs -region -toleranceDict | -integral -intermediate -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -partial -perfect -doc -doc-source -help"
_of_complete_cache_[subsetMesh]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -patch -patches -region -resultTime -roots | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -parallel -doc -doc-source -help"
_of_complete_cache_[subsetMesh]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -patch -patches -region -resultTime -roots | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -parallel -zone -doc -doc-source -help"
_of_complete_cache_[subsetToPatch]="-case -fileHandler | -noFunctionObjects -doc -doc-source -help"
_of_complete_cache_[surfaceAdd]="-case -fileHandler -points -scale | -mergeRegions -noFunctionObjects -doc -doc-source -help"
_of_complete_cache_[surfaceBooleanFeatures]="-case -fileHandler -scale -trim | -invertedSpace -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -perturb -surf1Baffle -surf2Baffle -doc -doc-source -help"
......
......@@ -56,6 +56,11 @@ inline void markUsed
} // End anonymous namespace
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::word Foam::fvMeshSubset::exposedPatchName("oldInternalFaces");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fvMeshSubset::checkCellSubset() const
......@@ -571,7 +576,7 @@ void Foam::fvMeshSubset::setCellSubset
{
// No explicit patch specified. Put in oldInternalFaces patch.
// Check if patch with this name already exists.
wantedPatchID = oldPatches.findPatchID("oldInternalFaces");
wantedPatchID = oldPatches.findPatchID(exposedPatchName);
}
else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size())
{
......@@ -1078,7 +1083,7 @@ void Foam::fvMeshSubset::setCellSubset
{
newBoundary[nNewPatches] = new emptyPolyPatch
(
"oldInternalFaces",
exposedPatchName,
boundaryPatchSizes[oldInternalPatchID],
patchStart,
nNewPatches,
......@@ -1086,7 +1091,7 @@ void Foam::fvMeshSubset::setCellSubset
emptyPolyPatch::typeName
);
//Pout<< " oldInternalFaces : "
//Pout<< " " << exposedPatchName << " : "
// << boundaryPatchSizes[oldInternalPatchID] << endl;
// The index for the first patch is -1 as it originates from
......
......@@ -153,6 +153,12 @@ class fvMeshSubset
public:
// Static Data Members
//- Name for exposed internal faces (default: oldInternalFaces)
static word exposedPatchName;
// Constructors
//- Construct given a mesh to subset
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment