extrudeToRegionMesh: Added options to set the name and type of the generated patches

e.g. in extrudeToRegionMeshDict:

// Generate the region named film
region          film;

// from the patch extrudeWall
patches         (extrudeWall);

// generating mapped patches for the extruded region
adaptMesh       yes;

// New options:

// Set the type of the mapped patch on the existing mesh to mappedWall ...
patchTypes      (mappedWall);

// ... and name to wall
patchNames      (wall);

// Set the type of the mapped patch on the region mesh to mappedFilmWall ...
regionPatchTypes   (mappedFilmWall);

// ... and name to wall
regionPatchNames   (wall);

// Set the type of the opposite patch on the region mesh to empty ...
regionOppositePatchTypes    (empty);

// ... and name to empty
regionOppositePatchNames    (empty);

All the above entries are optional and if not present the previous behaviour is
reproduced.
This commit is contained in:
Henry Weller
2023-02-28 15:43:37 +00:00
parent ea8a922ee8
commit c7c8c0fa46

View File

@ -146,11 +146,11 @@ label findPatchID(const List<polyPatch*>& newPatches, const word& name)
}
template<class PatchType>
label addPatch
(
const polyBoundaryMesh& patches,
const word& patchName,
const word& patchType,
const dictionary& dict,
DynamicList<polyPatch*>& newPatches
)
@ -159,7 +159,7 @@ label addPatch
if (patchi != -1)
{
if (isA<PatchType>(*newPatches[patchi]))
if (newPatches[patchi]->type() == patchType)
{
return patchi;
}
@ -182,7 +182,7 @@ label addPatch
}
dictionary patchDict(dict);
patchDict.set("type", PatchType::typeName);
patchDict.set("type", patchType);
patchDict.set("nFaces", 0);
patchDict.set("startFace", startFacei);
@ -541,6 +541,7 @@ void addCouplingPatches
const wordList& zoneNames,
const wordList& zoneShadowNames,
const boolList& zoneIsInternal,
const dictionary& dict,
DynamicList<polyPatch*>& newPatches,
labelList& zoneTopPatch,
labelList& zoneBottomPatch
@ -551,6 +552,42 @@ void addCouplingPatches
<< "-------\t-----\t----"
<< endl;
const wordList patchNames
(
dict.lookupOrDefault("patchNames", wordList())
);
const wordList patchTypes
(
isShellMesh
? dict.lookupOrDefault
(
"regionPatchTypes",
wordList(zoneNames.size(), mappedWallPolyPatch::typeName)
)
: dict.lookupOrDefault
(
"patchTypes",
wordList(zoneNames.size(), mappedWallPolyPatch::typeName)
)
);
const wordList regionPatchNames
(
dict.lookupOrDefault("regionPatchNames", wordList())
);
const wordList regionOppositePatchTypes
(
dict.lookupOrDefault("regionOppositePatchTypes", wordList())
);
const wordList regionOppositePatchNames
(
dict.lookupOrDefault("regionOppositePatchNames", wordList())
);
zoneTopPatch.setSize(zoneNames.size(), -1);
zoneBottomPatch.setSize(zoneNames.size(), -1);
@ -562,11 +599,15 @@ void addCouplingPatches
{
const word patchNamePrefix =
regionName + "_to_" + nbrRegionName + '_';
const word nbrPatchNamePrefix =
nbrRegionName + "_to_" + regionName + '_';
word bottomPatchName, bottomNbrPatchName;
word topPatchName, topNbrPatchName;
word bottomPatchName;
word bottomNbrPatchName;
word topPatchName;
word topNbrPatchName;
if (zoneIsInternal[zonei])
{
bottomPatchName = patchNamePrefix + zoneNames[zonei] + "_bottom";
@ -583,20 +624,39 @@ void addCouplingPatches
topNbrPatchName = nbrPatchNamePrefix + zoneShadowNames[zonei];
}
else
{
if (patchNames.size())
{
bottomPatchName = patchNames[zonei];
}
else
{
bottomPatchName = patchNamePrefix + zoneNames[zonei];
}
if (regionPatchNames.size())
{
bottomNbrPatchName = regionPatchNames[zonei];
}
else
{
bottomNbrPatchName = nbrPatchNamePrefix + zoneNames[zonei];
topPatchName = zoneNames[zonei] + "_top";
}
topPatchName =
regionOppositePatchNames.size()
? regionOppositePatchNames[zonei]
: word(zoneNames[zonei] + "_top");
}
dictionary bottomPatchDict(patchDict);
bottomPatchDict.add("neighbourPatch", bottomNbrPatchName);
zoneBottomPatch[zonei] =
addPatch<mappedWallPolyPatch>
zoneBottomPatch[zonei] = addPatch
(
mesh.boundaryMesh(),
bottomPatchName,
patchTypes[zonei],
bottomPatchDict,
newPatches
);
@ -615,22 +675,24 @@ void addCouplingPatches
topPatchDict.add("bottomPatch", bottomPatchName);
}
zoneTopPatch[zonei] =
addPatch<mappedExtrudedWallPolyPatch>
zoneTopPatch[zonei] = addPatch
(
mesh.boundaryMesh(),
topPatchName,
mappedExtrudedWallPolyPatch::typeName,
topPatchDict,
newPatches
);
}
else
{
zoneTopPatch[zonei] =
addPatch<polyPatch>
zoneTopPatch[zonei] = addPatch
(
mesh.boundaryMesh(),
topPatchName,
regionOppositePatchTypes.size()
? regionOppositePatchTypes[zonei]
: polyPatch::typeName,
dictionary(),
newPatches
);
@ -734,10 +796,11 @@ labelList addZoneSidePatches
if (oneDPolyPatchType == "empty")
{
patchName = "oneDEmptyPatch";
zoneSidePatches[zoneI] = addPatch<emptyPolyPatch>
zoneSidePatches[zoneI] = addPatch
(
mesh.boundaryMesh(),
patchName,
emptyPolyPatch::typeName,
dictionary(),
newPatches
);
@ -745,10 +808,11 @@ labelList addZoneSidePatches
else if (oneDPolyPatchType == "wedge")
{
patchName = "oneDWedgePatch";
zoneSidePatches[zoneI] = addPatch<wedgePolyPatch>
zoneSidePatches[zoneI] = addPatch
(
mesh.boundaryMesh(),
patchName,
wedgePolyPatch::typeName,
dictionary(),
newPatches
);
@ -771,10 +835,11 @@ labelList addZoneSidePatches
{
word patchName = zoneNames[zoneI] + "_" + "side";
zoneSidePatches[zoneI] = addPatch<polyPatch>
zoneSidePatches[zoneI] = addPatch
(
mesh.boundaryMesh(),
patchName,
polyPatch::typeName,
dictionary(),
newPatches
);
@ -910,10 +975,11 @@ labelList addExtrudeEdgeSidePatches
patchDict.add("myProcNo", Pstream::myProcNo());
patchDict.add("neighbProcNo", nbrProci);
extrudeEdgeSidePatches[edgeI] = addPatch<processorPolyPatch>
extrudeEdgeSidePatches[edgeI] = addPatch
(
mesh.boundaryMesh(),
name,
processorPolyPatch::typeName,
patchDict,
newPatches
);
@ -990,7 +1056,7 @@ int main(int argc, char *argv[])
zoneShadowNames.append
(
dict.lookupOrDefault<wordList>
dict.lookupOrDefault
(
keyword + "Shadow",
wordList
@ -1344,6 +1410,7 @@ int main(int argc, char *argv[])
zoneNames,
zoneShadowNames,
zoneIsInternal,
dict,
regionPatches,
zoneTopPatch,
zoneBottomPatch
@ -1376,6 +1443,7 @@ int main(int argc, char *argv[])
zoneNames,
zoneShadowNames,
zoneIsInternal,
dict,
newPatches,
interMeshTopPatch,
interMeshBottomPatch