133 using namespace Foam;
141 if (newPatches[i]->
name() == name)
150 template<
class PatchType>
154 const word& patchName,
158 label patchi = findPatchID(newPatches, patchName);
162 if (isA<PatchType>(*newPatches[patchi]))
170 <<
"Already have patch " << patchName
171 <<
" but of type " << newPatches[
patchi]->type()
177 patchi = newPatches.
size();
179 label startFacei = 0;
183 startFacei = pp.
start()+pp.size();
204 template<
class PatchType>
208 const word& patchName,
213 label patchi = findPatchID(newPatches, patchName);
217 if (isA<PatchType>(*newPatches[patchi]))
225 <<
"Already have patch " << patchName
226 <<
" but of type " << newPatches[
patchi]->type()
232 patchi = newPatches.
size();
234 label startFacei = 0;
238 startFacei = pp.
start()+pp.size();
242 patchDict.
set(
"type", PatchType::typeName);
243 patchDict.
set(
"nFaces", 0);
244 patchDict.
set(
"startFace", startFacei);
262 void deleteEmptyPatches(
fvMesh& mesh)
269 masterNames = patches.
names();
279 forAll(masterNames, masterI)
285 if (isA<processorPolyPatch>(patches[patchi]))
288 if (patches[patchi].size() == 0)
290 Pout<<
"Deleting processor patch " << patchi
293 oldToNew[
patchi] = --notUsedI;
297 oldToNew[
patchi] = usedI++;
305 Pout<<
"Deleting patch " << patchi
308 oldToNew[
patchi] = --notUsedI;
312 oldToNew[
patchi] = usedI++;
321 if (oldToNew[patchi] == -1)
325 if (patches[patchi].size() == 0)
327 Pout<<
"Deleting processor patch " << patchi
330 oldToNew[
patchi] = --notUsedI;
334 oldToNew[
patchi] = usedI++;
343 void createDummyFvMeshFiles(
const polyMesh& mesh,
const word& regionName)
358 Info<<
"Testing:" << io.objectPath() <<
endl;
362 Info<<
"Writing dummy " << regionName/io.name() <<
endl;
365 dummyDict.
add(
"divSchemes", divDict);
367 dummyDict.
add(
"gradSchemes", gradDict);
369 dummyDict.
add(
"laplacianSchemes", laplDict);
378 mesh.time().system(),
388 Info<<
"Writing dummy " << regionName/io.name() <<
endl;
410 Info<<
"Zone " << zoneNames[i] <<
" has internal faces" <<
endl;
414 Info<<
"Zone " << zoneNames[i] <<
" has boundary faces" <<
endl;
418 forAll(extrudeMeshFaces, i)
420 label facei = extrudeMeshFaces[i];
421 label zoneI = zoneID[i];
425 <<
"Zone " << zoneNames[zoneI]
426 <<
" is not consistently all internal or all boundary faces." 427 <<
" Face " << facei <<
" at " << mesh.
faceCentres()[facei]
428 <<
" is the first occurrence." 482 const labelList& eFaces = edgeFaces[edgeI];
485 labelList& globalEFaces = globalEdgeFaces[edgeI];
489 globalEFaces[i] = globalFaces.
toGlobal(eFaces[i]);
503 return globalEdgeFaces;
508 label findUncoveredPatchFace
512 const label meshEdgeI
517 forAll(extrudeMeshFaces, i)
519 extrudeFaceSet.insert(extrudeMeshFaces[i]);
526 label facei = eFaces[i];
532 && !pbm[patchi].coupled()
533 && !extrudeFaceSet.found(facei)
544 label findUncoveredCyclicPatchFace
548 const label meshEdgeI
553 forAll(extrudeMeshFaces, i)
555 extrudeFaceSet.insert(extrudeMeshFaces[i]);
562 label facei = eFaces[i];
568 && isA<cyclicPolyPatch>(pbm[patchi])
569 && !extrudeFaceSet.found(facei)
580 void calcEdgeMinMaxZone
601 forAll(extrudeEdgeGlobalFaces, edgeI)
603 const labelList& eFaces = extrudeEdgeGlobalFaces[edgeI];
608 label zoneI = mappedZoneID[eFaces[i]];
609 minZoneID[edgeI] =
min(minZoneID[edgeI], zoneI);
610 maxZoneID[edgeI] =
max(maxZoneID[edgeI], zoneI);
638 void countExtrudePatches
663 if (eFaces.
size() == 2)
666 if (minZoneID[edgeI] != maxZoneID[edgeI])
668 zoneZonePatch[minZoneID[edgeI]*nZones+maxZoneID[edgeI]]++;
674 && extrudeEdgeGlobalFaces[edgeI].
size() == 2
678 if (minZoneID[edgeI] != maxZoneID[edgeI])
680 const edge& e = extrudePatch.
edges()[edgeI];
684 <<
"at " << pts[e[0]] << pts[e[1]]
685 <<
" is a coupled edge and in between two different zones " 686 << minZoneID[edgeI] <<
" and " << maxZoneID[edgeI] << endl
687 <<
" This is currently not supported." <<
endl;
689 zoneZonePatch[minZoneID[edgeI]*nZones+maxZoneID[edgeI]]++;
699 label facei = findUncoveredPatchFace
703 extrudeMeshEdges[edgeI]
708 zoneSidePatch[minZoneID[edgeI]]++;
721 void addCouplingPatches
724 const word& regionName,
725 const word& shellRegionName,
736 Pout<<
"Adding coupling patches:" <<
nl <<
nl 737 <<
"patchID\tpatch\ttype" <<
nl 738 <<
"-------\t-----\t----" 742 interRegionBottomPatch.
setSize(zoneNames.
size(), -1);
756 if (isInternal[zoneI])
758 interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
764 Pout<< interRegionTopPatch[zoneI]
765 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
766 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
769 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
772 interName +
"_bottom",
775 Pout<< interRegionBottomPatch[zoneI]
776 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
777 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
780 else if (zoneShadowNames.
size() == 0)
782 interRegionTopPatch[zoneI] = addPatch<polyPatch>
785 zoneNames[zoneI] +
"_top",
788 Pout<< interRegionTopPatch[zoneI]
789 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
790 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
793 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
799 Pout<< interRegionBottomPatch[zoneI]
800 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
801 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
806 interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
809 zoneShadowNames[zoneI] +
"_top",
812 Pout<< interRegionTopPatch[zoneI]
813 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
814 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
817 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
823 Pout<< interRegionBottomPatch[zoneI]
824 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
825 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
829 Pout<<
"Added " << newPatches.
size()-nOldPatches
830 <<
" inter-region patches." <<
nl 837 void addCoupledPatches
860 forAll(extrudeEdgeGlobalFaces, edgeI)
862 const labelList& eFaces = extrudeEdgeGlobalFaces[edgeI];
867 label proci = procID[eFaces[i]];
868 minProcID[edgeI] =
min(minProcID[edgeI], proci);
869 maxProcID[edgeI] =
max(maxProcID[edgeI], proci);
890 Pout<<
"Adding processor or cyclic patches:" <<
nl <<
nl 891 <<
"patchID\tpatch" <<
nl 905 && extrudeEdgeGlobalFaces[edgeI].
size() == 2
909 label nbrProci = minProcID[edgeI];
912 nbrProci = maxProcID[edgeI];
921 label facei = findUncoveredCyclicPatchFace
925 extrudeMeshEdges[edgeI]
932 label newPatchi = findPatchID
938 sidePatchID[edgeI] = newPatchi;
943 <<
"Unable to determine coupled patch addressing" 955 sidePatchID[edgeI] = findPatchID(newPatches, name);
957 if (sidePatchID[edgeI] == -1)
961 patchDict.
add(
"neighbProcNo", nbrProci);
963 sidePatchID[edgeI] = addPatch<processorPolyPatch>
971 Pout<< sidePatchID[edgeI] <<
'\t' << name
977 Pout<<
"Added " << newPatches.
size()-nOldPatches
978 <<
" coupled patches." <<
nl 983 void addZoneSidePatches
987 const word& oneDPolyPatchType,
993 Pout<<
"Adding patches for sides on zones:" <<
nl <<
nl 994 <<
"patchID\tpatch" <<
nl 1000 forAll(zoneSidePatch, zoneI)
1006 if (oneDPolyPatchType ==
"empty")
1008 patchName =
"oneDEmptyPatch";
1009 zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
1016 else if (oneDPolyPatchType ==
"wedge")
1018 patchName =
"oneDWedgePatch";
1019 zoneSidePatch[zoneI] = addPatch<wedgePolyPatch>
1029 <<
"Type " << oneDPolyPatchType <<
" does not exist " 1033 Pout<< zoneSidePatch[zoneI] <<
'\t' << patchName <<
nl;
1035 else if (zoneSidePatch[zoneI] > 0)
1037 word patchName = zoneNames[zoneI] +
"_" +
"side";
1039 zoneSidePatch[zoneI] = addPatch<polyPatch>
1046 Pout<< zoneSidePatch[zoneI] <<
'\t' << patchName <<
nl;
1049 Pout<<
"Added " << newPatches.
size()-nOldPatches <<
" zone-side patches." 1054 void addInterZonePatches
1065 Pout<<
"Adding inter-zone patches:" <<
nl <<
nl 1066 <<
"patchID\tpatch" <<
nl 1078 transformDict.
add(
"matchTolerance", 1e6);
1084 forAll(zoneZonePatch_min, minZone)
1086 for (
label maxZone = minZone; maxZone < zoneNames.
size(); maxZone++)
1088 label index = minZone*zoneNames.
size()+maxZone;
1090 if (zoneZonePatch_min[index] > 0)
1095 + zoneNames[maxZone];
1099 + zoneNames[minZone];
1102 transformDict.
set(
"neighbourPatch", maxToMin);
1103 zoneZonePatch_min[index] =
1104 addPatch<nonuniformTransformCyclicPolyPatch>
1111 Pout<< zoneZonePatch_min[index] <<
'\t' << minToMax
1115 transformDict.
set(
"neighbourPatch", minToMax);
1116 zoneZonePatch_max[index] =
1117 addPatch<nonuniformTransformCyclicPolyPatch>
1124 Pout<< zoneZonePatch_max[index] <<
'\t' << maxToMin
1132 Pout<<
"Added " << newPatches.
size()-nOldPatches <<
" inter-zone patches." 1153 point patchFc = extrudePatch[patchFacei].centre
1157 offsets[i] = patchFc - fc[i];
1163 void setCouplingInfo
1167 const word& sampleRegion,
1180 forAll(zoneToPatch, zoneI)
1182 label patchi = zoneToPatch[zoneI];
1188 if (isA<mappedWallPolyPatch>(pp))
1206 forAll(newPatches, patchi)
1208 if (!newPatches[patchi])
1220 void extrudeGeometricProperties
1334 faceCentres[facei] = model
1336 patchFaceCentres[patchFacei],
1354 patchEdgeCentres[patchEdgeI],
1355 patchEdgeNormals[patchEdgeI],
1361 patchEdgeCentres[patchEdgeI],
1362 patchEdgeNormals[patchEdgeI],
1367 faceCentres[facei] = 0.5*(pt0+pt1);
1396 patchFaceCentres[patchFacei],
1402 patchFaceCentres[patchFacei],
1408 cellCentres[celli] = 0.5*(pt0+pt1);
1418 forAll(faceCentres, facei)
1420 Pout<<
"Model :" << faceCentres[facei] << endl
1431 forAll(cellCentres, celli)
1433 Pout<<
"Model :" << cellCentres[celli] << endl
1448 Info<<
"Writing geometric properties for mesh " << regionMesh.
name()
1452 bool ok = faceCentres.
write() && cellCentres.
write();
1457 <<
"Failed writing " << faceCentres.objectPath()
1458 <<
" and " << cellCentres.objectPath()
1466 int main(
int argc,
char *argv[])
1485 <<
"Patches are not synchronised on all processors." 1486 <<
" Per processor patches " << allNames
1507 const word shellRegionName(dict.
lookup(
"region"));
1513 bool hasZones = dict.
found(
"faceZones");
1516 dict.
lookup(
"faceZones") >> zoneNames;
1520 if (dict.
found(
"faceSets"))
1523 <<
"Please supply faces to extrude either through 'faceZones'" 1524 <<
" or 'faceSets' entry. Found both." 1530 dict.
lookup(
"faceSets") >> zoneNames;
1539 Switch oneDNonManifoldEdges(
false);
1540 word oneDPatchType(emptyPolyPatch::typeName);
1544 dict.
lookup(
"oneDPolyPatchType") >> oneDPatchType;
1551 Info<<
"Extruding zones " << zoneNames
1552 <<
" on mesh " << regionName
1553 <<
" into shell mesh " << shellRegionName
1558 Info<<
"Extruding faceSets " << zoneNames
1559 <<
" on mesh " << regionName
1560 <<
" into shell mesh " << shellRegionName
1564 if (shellRegionName == regionName)
1567 <<
"Cannot extrude into same region as mesh." << endl
1568 <<
"Mesh region : " << regionName << endl
1569 <<
"Shell region : " << shellRegionName
1576 if (oneDNonManifoldEdges)
1578 Info<<
"Extruding as 1D columns with sides in patch type " 1580 <<
" and connected points (except on non-manifold areas)." 1585 Info<<
"Extruding as 1D columns with sides in patch type " 1587 <<
" and duplicated points (overlapping volumes)." 1594 createDummyFvMeshFiles(mesh, shellRegionName);
1605 meshInstance = oldInstance;
1607 Info<<
"Writing meshes to " << meshInstance <<
nl <<
endl;
1621 boolList isInternal(zoneNames.size(),
false);
1637 meshZoneID.
setSize(zoneNames.size());
1640 meshZoneID[i] = faceZones.
findZoneID(zoneNames[i]);
1641 if (meshZoneID[i] == -1)
1644 <<
"Cannot find zone " << zoneNames[i] << endl
1645 <<
"Valid zones are " << faceZones.
names()
1650 label nExtrudeFaces = 0;
1653 nExtrudeFaces += faceZones[meshZoneID[i]].
size();
1655 extrudeMeshFaces.setSize(nExtrudeFaces);
1656 zoneFaces.
setSize(nExtrudeFaces);
1657 zoneID.
setSize(nExtrudeFaces);
1658 zoneFlipMap.
setSize(nExtrudeFaces);
1662 const faceZone& fz = faceZones[meshZoneID[i]];
1666 extrudeMeshFaces[nExtrudeFaces] = fz[j];
1667 zoneFaces[nExtrudeFaces] = fzp[j];
1668 zoneID[nExtrudeFaces] = i;
1669 zoneFlipMap[nExtrudeFaces] = fz.
flipMap()[j];
1674 isInternal[i] =
true;
1682 if (zoneShadowNames.
size())
1685 forAll(zoneShadowNames, i)
1687 zoneShadowIDs[i] = faceZones.
findZoneID(zoneShadowNames[i]);
1688 if (zoneShadowIDs[i] == -1)
1691 <<
"Cannot find zone " << zoneShadowNames[i] << endl
1692 <<
"Valid zones are " << faceZones.
names()
1697 label nShadowFaces = 0;
1700 nShadowFaces += faceZones[zoneShadowIDs[i]].
size();
1703 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1704 zoneShadowFlipMap.
setSize(nShadowFaces);
1705 zoneShadowID.
setSize(nShadowFaces);
1710 const faceZone& fz = faceZones[zoneShadowIDs[i]];
1713 extrudeMeshShadowFaces[nShadowFaces] = fz[j];
1714 zoneShadowFlipMap[nShadowFaces] = fz.
flipMap()[j];
1715 zoneShadowID[nShadowFaces] = i;
1723 meshZoneID.
setSize(zoneNames.size(), -1);
1728 Info<<
"Loading faceSet " << zoneNames[i] <<
endl;
1729 zones.set(i,
new faceSet(mesh, zoneNames[i]));
1734 label nExtrudeFaces = 0;
1737 nExtrudeFaces += zones[i].size();
1739 extrudeMeshFaces.setSize(nExtrudeFaces);
1740 zoneFaces.
setSize(nExtrudeFaces);
1741 zoneID.
setSize(nExtrudeFaces);
1742 zoneFlipMap.
setSize(nExtrudeFaces);
1750 label facei = iter.key();
1754 <<
"faceSet " << fz.
name()
1755 <<
"contains internal faces." 1756 <<
" This is not permitted." 1759 extrudeMeshFaces[nExtrudeFaces] = facei;
1760 zoneFaces[nExtrudeFaces] = mesh.
faces()[facei];
1761 zoneID[nExtrudeFaces] = i;
1762 zoneFlipMap[nExtrudeFaces] =
false;
1767 isInternal[i] =
true;
1777 if (zoneShadowNames.
size())
1779 zoneShadowIDs.
setSize(zoneShadowNames.
size(), -1);
1780 forAll(zoneShadowNames, i)
1782 shadowZones.set(i,
new faceSet(mesh, zoneShadowNames[i]));
1785 label nShadowFaces = 0;
1788 nShadowFaces += shadowZones[i].size();
1791 if (nExtrudeFaces != nShadowFaces)
1794 <<
"Extruded faces " << nExtrudeFaces << endl
1795 <<
"is different from shadow faces. " << nShadowFaces
1796 <<
"This is not permitted " << endl
1800 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1801 zoneShadowFlipMap.
setSize(nShadowFaces);
1802 zoneShadowID.
setSize(nShadowFaces);
1807 const faceSet& fz = shadowZones[i];
1810 label facei = iter.key();
1814 <<
"faceSet " << fz.
name()
1815 <<
"contains internal faces." 1816 <<
" This is not permitted." 1819 extrudeMeshShadowFaces[nShadowFaces] = facei;
1820 zoneShadowFlipMap[nShadowFaces] =
false;
1821 zoneShadowID[nShadowFaces] = i;
1834 checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
1843 Info<<
"extrudePatch :" 1844 <<
" faces:" << extrudePatch.size()
1845 <<
" points:" << extrudePatch.
nPoints()
1846 <<
" edges:" << extrudePatch.
nEdges()
1864 const globalIndex globalExtrudeFaces(extrudePatch.size());
1881 extrudeEdgeGlobalFaces,
1895 extrudeEdgeFacesMap,
1896 extrudeEdgeGlobalFaces,
1910 if (!isA<processorPolyPatch>(patches[patchi]))
1912 label newPatchi = regionPatches.size();
1913 regionPatches.append
1915 patches[patchi].
clone 1945 interRegionTopPatch,
1946 interRegionBottomPatch
1962 newPatches.
append(patches[patchi].
clone(patches).ptr());
1978 interMeshBottomPatch
1983 mesh.removeFvBoundary();
1984 mesh.addFvPatches(newPatches,
true);
1991 labelList extrudeTopPatchID(extrudePatch.size());
1992 labelList extrudeBottomPatchID(extrudePatch.size());
1996 extrudeTopPatchID[facei] = interRegionTopPatch[zoneID[facei]];
1997 extrudeBottomPatchID[facei] = interRegionBottomPatch[zoneID[facei]];
2005 labelList zoneSidePatch(zoneNames.size(), 0);
2007 labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), 0);
2009 labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0);
2020 extrudeEdgeGlobalFaces,
2067 extrudeEdgeFacesMap,
2068 extrudeEdgeGlobalFaces,
2118 const labelList& eFaces = edgeFaces[edgeI];
2120 labelList& ePatches = extrudeEdgePatches[edgeI];
2127 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2130 if (oneDNonManifoldEdges)
2135 if (eFaces.
size() != 2)
2137 nonManifoldEdge[edgeI] = 1;
2142 nonManifoldEdge[edgeI] = 1;
2145 else if (eFaces.
size() == 2)
2147 label zone0 = zoneID[eFaces[0]];
2148 label zone1 = zoneID[eFaces[1]];
2154 label index = minZone*zoneNames.size()+maxZone;
2156 ePatches.
setSize(eFaces.size());
2158 if (zone0 == minZone)
2160 ePatches[0] = zoneZonePatch_min[index];
2161 ePatches[1] = zoneZonePatch_max[index];
2165 ePatches[0] = zoneZonePatch_max[index];
2166 ePatches[1] = zoneZonePatch_min[index];
2169 nonManifoldEdge[edgeI] = 1;
2172 else if (sidePatchID[edgeI] != -1)
2175 ePatches.
setSize(eFaces.size());
2178 ePatches[i] = sidePatchID[edgeI];
2183 label facei = findUncoveredPatchFace
2187 extrudeMeshEdges[edgeI]
2192 label newPatchi = findPatchID
2197 ePatches.
setSize(eFaces.size(), newPatchi);
2201 ePatches.
setSize(eFaces.size());
2204 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2207 nonManifoldEdge[edgeI] = 1;
2235 forAll(pointLocalRegions, facei)
2238 const face& pRegions = pointLocalRegions[facei];
2241 localRegionPoints[pRegions[fp]] = f[fp];
2250 forAll(pointLocalRegions, facei)
2252 const face& pRegions = pointLocalRegions[facei];
2255 label localRegionI = pRegions[fp];
2256 localSum[localRegionI] += extrudePatch.
faceNormals()[facei];
2262 forAll(localSum, localRegionI)
2264 label globalRegionI = localToGlobalRegion[localRegionI];
2265 globalSum.insert(globalRegionI, localSum[localRegionI]);
2272 forAll(localToGlobalRegion, localRegionI)
2274 label globalRegionI = localToGlobalRegion[localRegionI];
2275 localRegionNormals[localRegionI] = globalSum[globalRegionI];
2277 localRegionNormals /=
mag(localRegionNormals);
2289 forAll(pointLocalRegions, facei)
2291 const face& f = extrudeFaces[facei];
2295 label region = pointLocalRegions[facei][fp];
2296 const point& pt = extrudePoints[f[fp]];
2303 pt+thickness*localRegionNormals[region]
2306 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
2314 forAll(firstDisp, regionI)
2321 localRegionPoints[regionI]
2324 const vector& n = localRegionNormals[regionI];
2325 firstDisp[regionI] = model()(regionPt,
n, 1) - regionPt;
2360 forAll(regionPatches, patchi)
2367 regionMesh.removeFvBoundary();
2368 regionMesh.addFvPatches(regionPatches,
true);
2376 model().expansionRatio(),
2379 extrudeBottomPatchID,
2393 forAll(localRegionPoints, regionI)
2395 label pointi = localRegionPoints[regionI];
2397 const vector& n = localRegionNormals[regionI];
2399 for (
label layerI = 1; layerI <= model().
nLayers(); layerI++)
2401 newPoints[meshPointi++] = model()(pt,
n, layerI);
2405 shellMap = meshMod.changeMesh
2430 if (isA<mappedWallPolyPatch>(pp))
2432 if (
findIndex(interRegionTopPatch, patchi) != -1)
2435 topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2437 else if (
findIndex(interRegionBottomPatch, patchi) != -1)
2440 bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2454 interRegionTopPatch,
2464 interRegionBottomPatch,
2471 deleteEmptyPatches(regionMesh);
2493 interMeshBottomPatch,
2509 "cellToPatchFaceAddressing",
2519 cellToPatchFaceAddressing.
note() =
"cell to patch face addressing";
2525 "faceToPatchFaceAddressing",
2535 faceToPatchFaceAddressing.
note() =
2536 "front/back face + turning index to patch face addressing";
2542 "faceToPatchEdgeAddressing",
2552 faceToPatchEdgeAddressing.
note() =
2553 "side face to patch edge addressing";
2559 "pointToPatchPointAddressing",
2569 pointToPatchPointAddressing.
note() =
2570 "point to patch point addressing";
2573 Info<<
"Writing mesh " << regionMesh.
name()
2579 && cellToPatchFaceAddressing.write()
2580 && faceToPatchFaceAddressing.write()
2581 && faceToPatchEdgeAddressing.write()
2582 && pointToPatchPointAddressing.write();
2587 <<
"Failed writing mesh " << regionMesh.
name()
2608 Info<<
"Reading patch face,edge centres : " 2609 << io.name() <<
" and patchEdgeCentres" <<
endl;
2611 extrudeGeometricProperties
2635 forAll(extrudeMeshFaces, zoneFacei)
2637 label meshFacei = extrudeMeshFaces[zoneFacei];
2638 label zoneI = zoneID[zoneFacei];
2639 bool flip = zoneFlipMap[zoneFacei];
2640 const face& f = mesh.
faces()[meshFacei];
2651 interMeshBottomPatch[zoneI],
2665 interMeshBottomPatch[zoneI],
2672 if (zoneShadowNames.
size() > 0)
2674 forAll(extrudeMeshFaces, zoneFacei)
2676 label meshFacei = extrudeMeshShadowFaces[zoneFacei];
2677 label zoneI = zoneShadowID[zoneFacei];
2678 bool flip = zoneShadowFlipMap[zoneFacei];
2679 const face& f = mesh.
faces()[meshFacei];
2690 interMeshTopPatch[zoneI],
2704 interMeshTopPatch[zoneI],
2714 forAll(extrudeMeshFaces, zoneFacei)
2716 label meshFacei = extrudeMeshFaces[zoneFacei];
2717 label zoneI = zoneID[zoneFacei];
2718 bool flip = zoneFlipMap[zoneFacei];
2719 const face& f = mesh.
faces()[meshFacei];
2734 interMeshTopPatch[zoneI],
2751 interMeshTopPatch[zoneI],
2760 addBafflesMap = meshMod.changeMesh(mesh,
false);
2771 if (addBafflesMap().hasMotionPoints())
2773 mesh.
movePoints(addBafflesMap().preMotionPoints());
2779 deleteEmptyPatches(mesh);
2781 Info<<
"Writing mesh " << mesh.
name()
2788 <<
"Failed writing mesh " << mesh.
name()
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
label nPoints() const
Return number of points supporting patch faces.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const PackedBoolList &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
autoPtr< IOobject > clone() const
Clone.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const word & executable() const
Name of executable without the path.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file mode.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
fileName path() const
Return path.
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
const word & name() const
Return name.
const faceZoneMesh & faceZones() const
Return face zone mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void addFvPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const labelListList & pointEdges() const
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static word newName(const label myProcNo, const label neighbProcNo)
Return the name of a processorPolyPatch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
static bool master(const label communicator=0)
Am I the master process.
label findPatchID(const word &patchName) const
Find patch index given a name.
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Pre-declare related SubField type.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
label size() const
Return number of elements in table.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
Top level extrusion model class.
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
string & note()
Return non-constant access to the optional note.
A list of faces which address into the list of points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
face reverseFace() const
Return face with reverse direction.
vectorField pointField
pointField is a vectorField.
const fileName & pointsInstance() const
Return the current instance directory for points.
static const NamedEnum< transformType, 5 > transformTypeNames
const labelList & cellToFaceMap() const
From region cell to patch face. Consecutively added so.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
label findZoneID(const word &zoneName) const
Find zone index given a name.
static autoPtr< extrudeModel > New(const dictionary &)
Select null constructed.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
virtual void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
A class for handling words, derived from string.
label size() const
Return the number of elements in the list.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
wordList names() const
Return a list of patch names.
virtual const labelList & faceOwner() const
Return face owner.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const labelList & faceToFaceMap() const
From region face to patch face. Contains turning index:
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Creates mesh by extruding a patch.
const Field< PointType > & points() const
Return reference to global points.
static const word null
An empty word.
const labelListList & edgeFaces() const
Return edge-face addressing.
const globalMeshData & globalData() const
Return parallel info.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
static const label labelMax
List< label > labelList
A List of labels.
const word dictName("particleTrackDict")
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
virtual const faceList & faces() const
Return raw faces.
const Field< PointType > & faceNormals() const
Return face normals for patch.
const vectorField & cellCentres() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
const word & system() const
Return system name.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
label nEdges() const
Return number of edges in patch.
OFstream which keeps track of vertices.
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
const Time & time() const
Return time.
scalar sumThickness(const label layer) const
Helper: calculate cumulative relative thickness for layer.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static const NamedEnum< sampleMode, 6 > sampleModeNames_
word name(const complex &)
Return a string representation of a complex.
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
void setInstance(const fileName &)
Set the instance for mesh files.
label size() const
Return the number of elements in the UPtrList.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
label toGlobal(const label i) const
From local to global.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Class containing processor-to-processor mapping information.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
const labelList & pointToPointMap() const
From region point to patch point.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
prefixOSstream Pout(cout, "Pout")
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
Direct mesh changes based on v1.3 polyTopoChange syntax.
sampleMode
Mesh items to sample.
label start() const
Return start label of this patch in the polyMesh face list.
void set(entry *)
Assign a new entry, overwrite any existing entry.
wordList names() const
Return a list of zone names.
dimensioned< scalar > mag(const dimensioned< Type > &)
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
void setRefinement(const pointField &firstLayerThickness, const scalar expansionRatio, const label nLayers, const labelList &topPatchID, const labelList &bottomPatchID, const labelListList &extrudeEdgePatches, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layer mesh.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
static void addNote(const string &)
Add extra notes for the usage information.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
label size() const
Return the number of elements in the UList.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
A primitive field of type <T> with automated input and output.
const labelListList & edgeFaces() const
static const label labelMin
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A HashTable to objects of type <T> with a label key.
const vectorField::subField faceCentres() const
Return face centres.