142 using namespace Foam;
150 if (newPatches[i]->
name() == name)
159 template<
class PatchType>
163 const word& patchName,
167 label patchi = findPatchID(newPatches, patchName);
171 if (isA<PatchType>(*newPatches[patchi]))
179 <<
"Already have patch " << patchName
180 <<
" but of type " << newPatches[
patchi]->type()
186 patchi = newPatches.
size();
188 label startFacei = 0;
192 startFacei = pp.
start()+pp.size();
213 template<
class PatchType>
217 const word& patchName,
222 label patchi = findPatchID(newPatches, patchName);
226 if (isA<PatchType>(*newPatches[patchi]))
234 <<
"Already have patch " << patchName
235 <<
" but of type " << newPatches[
patchi]->type()
241 patchi = newPatches.
size();
243 label startFacei = 0;
247 startFacei = pp.
start()+pp.size();
251 patchDict.
set(
"type", PatchType::typeName);
252 patchDict.
set(
"nFaces", 0);
253 patchDict.
set(
"startFace", startFacei);
271 void deleteEmptyPatches(
fvMesh& mesh)
278 masterNames = patches.
names();
288 forAll(masterNames, masterI)
294 if (isA<processorPolyPatch>(patches[patchi]))
297 if (patches[patchi].size() == 0)
299 Pout<<
"Deleting processor patch " << patchi
302 oldToNew[
patchi] = --notUsedI;
306 oldToNew[
patchi] = usedI++;
314 Pout<<
"Deleting patch " << patchi
317 oldToNew[
patchi] = --notUsedI;
321 oldToNew[
patchi] = usedI++;
330 if (oldToNew[patchi] == -1)
334 if (patches[patchi].size() == 0)
336 Pout<<
"Deleting processor patch " << patchi
339 oldToNew[
patchi] = --notUsedI;
343 oldToNew[
patchi] = usedI++;
352 void createDummyFvMeshFiles(
const polyMesh& mesh,
const word& regionName)
367 Info<<
"Testing:" << io.objectPath() <<
endl;
371 Info<<
"Writing dummy " << regionName/io.name() <<
endl;
374 dummyDict.
add(
"divSchemes", divDict);
376 dummyDict.
add(
"gradSchemes", gradDict);
378 dummyDict.
add(
"laplacianSchemes", laplDict);
387 mesh.time().system(),
397 Info<<
"Writing dummy " << regionName/io.name() <<
endl;
419 Info<<
"Zone " << zoneNames[i] <<
" has internal faces" <<
endl;
423 Info<<
"Zone " << zoneNames[i] <<
" has boundary faces" <<
endl;
427 forAll(extrudeMeshFaces, i)
429 label facei = extrudeMeshFaces[i];
430 label zoneI = zoneID[i];
434 <<
"Zone " << zoneNames[zoneI]
435 <<
" is not consistently all internal or all boundary faces." 436 <<
" Face " << facei <<
" at " << mesh.
faceCentres()[facei]
437 <<
" is the first occurrence." 491 const labelList& eFaces = edgeFaces[edgeI];
494 labelList& globalEFaces = globalEdgeFaces[edgeI];
498 globalEFaces[i] = globalFaces.
toGlobal(eFaces[i]);
512 return globalEdgeFaces;
517 label findUncoveredPatchFace
521 const label meshEdgeI
526 forAll(extrudeMeshFaces, i)
528 extrudeFaceSet.insert(extrudeMeshFaces[i]);
535 label facei = eFaces[i];
541 && !pbm[patchi].coupled()
542 && !extrudeFaceSet.found(facei)
553 label findUncoveredCyclicPatchFace
557 const label meshEdgeI
562 forAll(extrudeMeshFaces, i)
564 extrudeFaceSet.insert(extrudeMeshFaces[i]);
571 label facei = eFaces[i];
577 && isA<cyclicPolyPatch>(pbm[patchi])
578 && !extrudeFaceSet.found(facei)
589 void calcEdgeMinMaxZone
610 forAll(extrudeEdgeGlobalFaces, edgeI)
612 const labelList& eFaces = extrudeEdgeGlobalFaces[edgeI];
617 label zoneI = mappedZoneID[eFaces[i]];
618 minZoneID[edgeI] =
min(minZoneID[edgeI], zoneI);
619 maxZoneID[edgeI] =
max(maxZoneID[edgeI], zoneI);
647 void countExtrudePatches
672 if (eFaces.
size() == 2)
675 if (minZoneID[edgeI] != maxZoneID[edgeI])
677 zoneZonePatch[minZoneID[edgeI]*nZones+maxZoneID[edgeI]]++;
683 && extrudeEdgeGlobalFaces[edgeI].
size() == 2
687 if (minZoneID[edgeI] != maxZoneID[edgeI])
689 const edge& e = extrudePatch.
edges()[edgeI];
693 <<
"at " << pts[e[0]] << pts[e[1]]
694 <<
" is a coupled edge and inbetween two different zones " 695 << minZoneID[edgeI] <<
" and " << maxZoneID[edgeI] << endl
696 <<
" This is currently not supported." <<
endl;
698 zoneZonePatch[minZoneID[edgeI]*nZones+maxZoneID[edgeI]]++;
708 label facei = findUncoveredPatchFace
712 extrudeMeshEdges[edgeI]
717 zoneSidePatch[minZoneID[edgeI]]++;
730 void addCouplingPatches
733 const word& regionName,
734 const word& shellRegionName,
745 Pout<<
"Adding coupling patches:" <<
nl <<
nl 746 <<
"patchID\tpatch\ttype" <<
nl 747 <<
"-------\t-----\t----" 751 interRegionBottomPatch.
setSize(zoneNames.
size(), -1);
765 if (isInternal[zoneI])
767 interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
773 Pout<< interRegionTopPatch[zoneI]
774 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
775 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
778 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
781 interName +
"_bottom",
784 Pout<< interRegionBottomPatch[zoneI]
785 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
786 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
789 else if (zoneShadowNames.
size() == 0)
791 interRegionTopPatch[zoneI] = addPatch<polyPatch>
794 zoneNames[zoneI] +
"_top",
797 Pout<< interRegionTopPatch[zoneI]
798 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
799 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
802 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
808 Pout<< interRegionBottomPatch[zoneI]
809 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
810 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
815 interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
818 zoneShadowNames[zoneI] +
"_top",
821 Pout<< interRegionTopPatch[zoneI]
822 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->name()
823 <<
'\t' << newPatches[interRegionTopPatch[zoneI]]->type()
826 interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
832 Pout<< interRegionBottomPatch[zoneI]
833 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
834 <<
'\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
838 Pout<<
"Added " << newPatches.
size()-nOldPatches
839 <<
" inter-region patches." <<
nl 846 void addCoupledPatches
869 forAll(extrudeEdgeGlobalFaces, edgeI)
871 const labelList& eFaces = extrudeEdgeGlobalFaces[edgeI];
876 label proci = procID[eFaces[i]];
877 minProcID[edgeI] =
min(minProcID[edgeI], proci);
878 maxProcID[edgeI] =
max(maxProcID[edgeI], proci);
899 Pout<<
"Adding processor or cyclic patches:" <<
nl <<
nl 900 <<
"patchID\tpatch" <<
nl 914 && extrudeEdgeGlobalFaces[edgeI].
size() == 2
918 label nbrProci = minProcID[edgeI];
921 nbrProci = maxProcID[edgeI];
930 label facei = findUncoveredCyclicPatchFace
934 extrudeMeshEdges[edgeI]
941 label newPatchi = findPatchID
947 sidePatchID[edgeI] = newPatchi;
952 <<
"Unable to determine coupled patch addressing" 964 sidePatchID[edgeI] = findPatchID(newPatches, name);
966 if (sidePatchID[edgeI] == -1)
970 patchDict.
add(
"neighbProcNo", nbrProci);
972 sidePatchID[edgeI] = addPatch<processorPolyPatch>
980 Pout<< sidePatchID[edgeI] <<
'\t' << name
986 Pout<<
"Added " << newPatches.
size()-nOldPatches
987 <<
" coupled patches." <<
nl 992 void addZoneSidePatches
996 const word& oneDPolyPatchType,
1002 Pout<<
"Adding patches for sides on zones:" <<
nl <<
nl 1003 <<
"patchID\tpatch" <<
nl 1009 forAll(zoneSidePatch, zoneI)
1015 if (oneDPolyPatchType ==
"empty")
1017 patchName =
"oneDEmptyPatch";
1018 zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
1025 else if (oneDPolyPatchType ==
"wedge")
1027 patchName =
"oneDWedgePatch";
1028 zoneSidePatch[zoneI] = addPatch<wedgePolyPatch>
1038 <<
"Type " << oneDPolyPatchType <<
" does not exist " 1042 Pout<< zoneSidePatch[zoneI] <<
'\t' << patchName <<
nl;
1044 else if (zoneSidePatch[zoneI] > 0)
1046 word patchName = zoneNames[zoneI] +
"_" +
"side";
1048 zoneSidePatch[zoneI] = addPatch<polyPatch>
1055 Pout<< zoneSidePatch[zoneI] <<
'\t' << patchName <<
nl;
1058 Pout<<
"Added " << newPatches.
size()-nOldPatches <<
" zone-side patches." 1063 void addInterZonePatches
1074 Pout<<
"Adding inter-zone patches:" <<
nl <<
nl 1075 <<
"patchID\tpatch" <<
nl 1090 forAll(zoneZonePatch_min, minZone)
1092 for (
label maxZone = minZone; maxZone < zoneNames.
size(); maxZone++)
1094 label index = minZone*zoneNames.
size()+maxZone;
1096 if (zoneZonePatch_min[index] > 0)
1101 + zoneNames[maxZone];
1105 + zoneNames[minZone];
1108 transformDict.
set(
"neighbourPatch", maxToMin);
1109 zoneZonePatch_min[index] =
1110 addPatch<nonuniformTransformCyclicPolyPatch>
1117 Pout<< zoneZonePatch_min[index] <<
'\t' << minToMax
1121 transformDict.
set(
"neighbourPatch", minToMax);
1122 zoneZonePatch_max[index] =
1123 addPatch<nonuniformTransformCyclicPolyPatch>
1130 Pout<< zoneZonePatch_max[index] <<
'\t' << maxToMin
1138 Pout<<
"Added " << newPatches.
size()-nOldPatches <<
" inter-zone patches." 1159 point patchFc = extrudePatch[patchFacei].centre
1163 offsets[i] = patchFc - fc[i];
1169 void setCouplingInfo
1173 const word& sampleRegion,
1182 forAll(zoneToPatch, zoneI)
1184 label patchi = zoneToPatch[zoneI];
1190 if (isA<mappedWallPolyPatch>(pp))
1208 forAll(newPatches, patchi)
1210 if (!newPatches[patchi])
1222 void extrudeGeometricProperties
1336 faceCentres[facei] = model
1338 patchFaceCentres[patchFacei],
1356 patchEdgeCentres[patchEdgeI],
1357 patchEdgeNormals[patchEdgeI],
1363 patchEdgeCentres[patchEdgeI],
1364 patchEdgeNormals[patchEdgeI],
1369 faceCentres[facei] = 0.5*(pt0+pt1);
1398 patchFaceCentres[patchFacei],
1404 patchFaceCentres[patchFacei],
1410 cellCentres[celli] = 0.5*(pt0+pt1);
1420 forAll(faceCentres, facei)
1422 Pout<<
"Model :" << faceCentres[facei] << endl
1433 forAll(cellCentres, celli)
1435 Pout<<
"Model :" << cellCentres[celli] << endl
1450 Info<<
"Writing geometric properties for mesh " << regionMesh.
name()
1454 bool ok = faceCentres.
write() && cellCentres.
write();
1459 <<
"Failed writing " << faceCentres.objectPath()
1460 <<
" and " << cellCentres.objectPath()
1468 int main(
int argc,
char *argv[])
1487 <<
"Patches are not synchronised on all processors." 1488 <<
" Per processor patches " << allNames
1509 const word shellRegionName(dict.
lookup(
"region"));
1515 bool hasZones = dict.
found(
"faceZones");
1518 dict.
lookup(
"faceZones") >> zoneNames;
1522 if (dict.
found(
"faceSets"))
1525 <<
"Please supply faces to extrude either through 'faceZones'" 1526 <<
" or 'faceSets' entry. Found both." 1532 dict.
lookup(
"faceSets") >> zoneNames;
1541 Switch oneDNonManifoldEdges(
false);
1542 word oneDPatchType(emptyPolyPatch::typeName);
1546 dict.
lookup(
"oneDPolyPatchType") >> oneDPatchType;
1553 Info<<
"Extruding zones " << zoneNames
1554 <<
" on mesh " << regionName
1555 <<
" into shell mesh " << shellRegionName
1560 Info<<
"Extruding faceSets " << zoneNames
1561 <<
" on mesh " << regionName
1562 <<
" into shell mesh " << shellRegionName
1566 if (shellRegionName == regionName)
1569 <<
"Cannot extrude into same region as mesh." << endl
1570 <<
"Mesh region : " << regionName << endl
1571 <<
"Shell region : " << shellRegionName
1578 if (oneDNonManifoldEdges)
1580 Info<<
"Extruding as 1D columns with sides in patch type " 1582 <<
" and connected points (except on non-manifold areas)." 1587 Info<<
"Extruding as 1D columns with sides in patch type " 1589 <<
" and duplicated points (overlapping volumes)." 1645 createDummyFvMeshFiles(mesh, shellRegionName);
1652 meshInstance = runTime.timeName();
1656 meshInstance = oldInstance;
1658 Info<<
"Writing meshes to " << meshInstance <<
nl <<
endl;
1672 boolList isInternal(zoneNames.size(),
false);
1688 meshZoneID.
setSize(zoneNames.size());
1691 meshZoneID[i] = faceZones.
findZoneID(zoneNames[i]);
1692 if (meshZoneID[i] == -1)
1695 <<
"Cannot find zone " << zoneNames[i] << endl
1696 <<
"Valid zones are " << faceZones.
names()
1701 label nExtrudeFaces = 0;
1704 nExtrudeFaces += faceZones[meshZoneID[i]].
size();
1706 extrudeMeshFaces.setSize(nExtrudeFaces);
1707 zoneFaces.
setSize(nExtrudeFaces);
1708 zoneID.
setSize(nExtrudeFaces);
1709 zoneFlipMap.
setSize(nExtrudeFaces);
1713 const faceZone& fz = faceZones[meshZoneID[i]];
1717 extrudeMeshFaces[nExtrudeFaces] = fz[j];
1718 zoneFaces[nExtrudeFaces] = fzp[j];
1719 zoneID[nExtrudeFaces] = i;
1720 zoneFlipMap[nExtrudeFaces] = fz.
flipMap()[j];
1725 isInternal[i] =
true;
1733 if (zoneShadowNames.
size())
1736 forAll(zoneShadowNames, i)
1738 zoneShadowIDs[i] = faceZones.
findZoneID(zoneShadowNames[i]);
1739 if (zoneShadowIDs[i] == -1)
1742 <<
"Cannot find zone " << zoneShadowNames[i] << endl
1743 <<
"Valid zones are " << faceZones.
names()
1748 label nShadowFaces = 0;
1751 nShadowFaces += faceZones[zoneShadowIDs[i]].
size();
1754 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1755 zoneShadowFlipMap.
setSize(nShadowFaces);
1756 zoneShadowID.
setSize(nShadowFaces);
1761 const faceZone& fz = faceZones[zoneShadowIDs[i]];
1764 extrudeMeshShadowFaces[nShadowFaces] = fz[j];
1765 zoneShadowFlipMap[nShadowFaces] = fz.
flipMap()[j];
1766 zoneShadowID[nShadowFaces] = i;
1774 meshZoneID.
setSize(zoneNames.size(), -1);
1779 Info<<
"Loading faceSet " << zoneNames[i] <<
endl;
1780 zones.set(i,
new faceSet(mesh, zoneNames[i]));
1785 label nExtrudeFaces = 0;
1788 nExtrudeFaces += zones[i].size();
1790 extrudeMeshFaces.setSize(nExtrudeFaces);
1791 zoneFaces.
setSize(nExtrudeFaces);
1792 zoneID.
setSize(nExtrudeFaces);
1793 zoneFlipMap.
setSize(nExtrudeFaces);
1801 label facei = iter.key();
1805 <<
"faceSet " << fz.
name()
1806 <<
"contains internal faces." 1807 <<
" This is not permitted." 1810 extrudeMeshFaces[nExtrudeFaces] = facei;
1811 zoneFaces[nExtrudeFaces] = mesh.
faces()[facei];
1812 zoneID[nExtrudeFaces] = i;
1813 zoneFlipMap[nExtrudeFaces] =
false;
1818 isInternal[i] =
true;
1828 if (zoneShadowNames.
size())
1830 zoneShadowIDs.
setSize(zoneShadowNames.
size(), -1);
1831 forAll(zoneShadowNames, i)
1833 shadowZones.set(i,
new faceSet(mesh, zoneShadowNames[i]));
1836 label nShadowFaces = 0;
1839 nShadowFaces += shadowZones[i].size();
1842 if (nExtrudeFaces != nShadowFaces)
1845 <<
"Extruded faces " << nExtrudeFaces << endl
1846 <<
"is different from shadow faces. " << nShadowFaces
1847 <<
"This is not permitted " << endl
1851 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1852 zoneShadowFlipMap.
setSize(nShadowFaces);
1853 zoneShadowID.
setSize(nShadowFaces);
1858 const faceSet& fz = shadowZones[i];
1861 label facei = iter.key();
1865 <<
"faceSet " << fz.
name()
1866 <<
"contains internal faces." 1867 <<
" This is not permitted." 1870 extrudeMeshShadowFaces[nShadowFaces] = facei;
1871 zoneShadowFlipMap[nShadowFaces] =
false;
1872 zoneShadowID[nShadowFaces] = i;
1885 checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
1894 Info<<
"extrudePatch :" 1895 <<
" faces:" << extrudePatch.size()
1896 <<
" points:" << extrudePatch.
nPoints()
1897 <<
" edges:" << extrudePatch.
nEdges()
1915 const globalIndex globalExtrudeFaces(extrudePatch.size());
1932 extrudeEdgeGlobalFaces,
1946 extrudeEdgeFacesMap,
1947 extrudeEdgeGlobalFaces,
1961 if (!isA<processorPolyPatch>(patches[patchi]))
1963 label newPatchi = regionPatches.size();
1964 regionPatches.append
1966 patches[patchi].clone
1996 interRegionTopPatch,
1997 interRegionBottomPatch
2013 newPatches.
append(patches[patchi].clone(patches).ptr());
2029 interMeshBottomPatch
2034 mesh.removeFvBoundary();
2035 mesh.addFvPatches(newPatches,
true);
2042 labelList extrudeTopPatchID(extrudePatch.size());
2043 labelList extrudeBottomPatchID(extrudePatch.size());
2047 extrudeTopPatchID[facei] = interRegionTopPatch[zoneID[facei]];
2048 extrudeBottomPatchID[facei] = interRegionBottomPatch[zoneID[facei]];
2056 labelList zoneSidePatch(zoneNames.size(), 0);
2058 labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), 0);
2060 labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0);
2071 extrudeEdgeGlobalFaces,
2118 extrudeEdgeFacesMap,
2119 extrudeEdgeGlobalFaces,
2169 const labelList& eFaces = edgeFaces[edgeI];
2171 labelList& ePatches = extrudeEdgePatches[edgeI];
2178 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2181 if (oneDNonManifoldEdges)
2186 if (eFaces.
size() != 2)
2188 nonManifoldEdge[edgeI] = 1;
2193 nonManifoldEdge[edgeI] = 1;
2196 else if (eFaces.
size() == 2)
2198 label zone0 = zoneID[eFaces[0]];
2199 label zone1 = zoneID[eFaces[1]];
2205 label index = minZone*zoneNames.size()+maxZone;
2207 ePatches.
setSize(eFaces.size());
2209 if (zone0 == minZone)
2211 ePatches[0] = zoneZonePatch_min[index];
2212 ePatches[1] = zoneZonePatch_max[index];
2216 ePatches[0] = zoneZonePatch_max[index];
2217 ePatches[1] = zoneZonePatch_min[index];
2220 nonManifoldEdge[edgeI] = 1;
2223 else if (sidePatchID[edgeI] != -1)
2226 ePatches.
setSize(eFaces.size());
2229 ePatches[i] = sidePatchID[edgeI];
2234 label facei = findUncoveredPatchFace
2238 extrudeMeshEdges[edgeI]
2243 label newPatchi = findPatchID
2248 ePatches.
setSize(eFaces.size(), newPatchi);
2252 ePatches.
setSize(eFaces.size());
2255 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2258 nonManifoldEdge[edgeI] = 1;
2286 forAll(pointLocalRegions, facei)
2289 const face& pRegions = pointLocalRegions[facei];
2292 localRegionPoints[pRegions[fp]] = f[fp];
2301 forAll(pointLocalRegions, facei)
2303 const face& pRegions = pointLocalRegions[facei];
2306 label localRegionI = pRegions[fp];
2307 localSum[localRegionI] += extrudePatch.
faceNormals()[facei];
2313 forAll(localSum, localRegionI)
2315 label globalRegionI = localToGlobalRegion[localRegionI];
2316 globalSum.insert(globalRegionI, localSum[localRegionI]);
2323 forAll(localToGlobalRegion, localRegionI)
2325 label globalRegionI = localToGlobalRegion[localRegionI];
2326 localRegionNormals[localRegionI] = globalSum[globalRegionI];
2328 localRegionNormals /=
mag(localRegionNormals);
2335 OFstream str(runTime.path()/
"localRegionNormals.obj");
2340 forAll(pointLocalRegions, facei)
2342 const face& f = extrudeFaces[facei];
2346 label region = pointLocalRegions[facei][fp];
2347 const point& pt = extrudePoints[f[fp]];
2354 pt+thickness*localRegionNormals[region]
2357 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
2365 forAll(firstDisp, regionI)
2372 localRegionPoints[regionI]
2375 const vector& n = localRegionNormals[regionI];
2376 firstDisp[regionI] = model()(regionPt,
n, 1) - regionPt;
2411 forAll(regionPatches, patchi)
2418 regionMesh.removeFvBoundary();
2419 regionMesh.addFvPatches(regionPatches,
true);
2427 model().expansionRatio(),
2430 extrudeBottomPatchID,
2444 forAll(localRegionPoints, regionI)
2446 label pointi = localRegionPoints[regionI];
2448 const vector& n = localRegionNormals[regionI];
2450 for (
label layerI = 1; layerI <= model().
nLayers(); layerI++)
2452 newPoints[meshPointi++] = model()(pt,
n, layerI);
2456 shellMap = meshMod.changeMesh
2481 if (isA<mappedWallPolyPatch>(pp))
2483 if (
findIndex(interRegionTopPatch, patchi) != -1)
2486 topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2488 else if (
findIndex(interRegionBottomPatch, patchi) != -1)
2491 bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2505 interRegionTopPatch,
2515 interRegionBottomPatch,
2522 deleteEmptyPatches(regionMesh);
2544 interMeshBottomPatch,
2560 "cellToPatchFaceAddressing",
2570 cellToPatchFaceAddressing.
note() =
"cell to patch face addressing";
2576 "faceToPatchFaceAddressing",
2586 faceToPatchFaceAddressing.
note() =
2587 "front/back face + turning index to patch face addressing";
2593 "faceToPatchEdgeAddressing",
2603 faceToPatchEdgeAddressing.
note() =
2604 "side face to patch edge addressing";
2610 "pointToPatchPointAddressing",
2620 pointToPatchPointAddressing.
note() =
2621 "point to patch point addressing";
2624 Info<<
"Writing mesh " << regionMesh.
name()
2630 && cellToPatchFaceAddressing.write()
2631 && faceToPatchFaceAddressing.write()
2632 && faceToPatchEdgeAddressing.write()
2633 && pointToPatchPointAddressing.write();
2638 <<
"Failed writing mesh " << regionMesh.
name()
2659 Info<<
"Reading patch face,edge centres : " 2660 << io.name() <<
" and patchEdgeCentres" <<
endl;
2662 extrudeGeometricProperties
2686 forAll(extrudeMeshFaces, zoneFacei)
2688 label meshFacei = extrudeMeshFaces[zoneFacei];
2689 label zoneI = zoneID[zoneFacei];
2690 bool flip = zoneFlipMap[zoneFacei];
2691 const face& f = mesh.
faces()[meshFacei];
2702 interMeshBottomPatch[zoneI],
2716 interMeshBottomPatch[zoneI],
2723 if (zoneShadowNames.
size() > 0)
2725 forAll(extrudeMeshFaces, zoneFacei)
2727 label meshFacei = extrudeMeshShadowFaces[zoneFacei];
2728 label zoneI = zoneShadowID[zoneFacei];
2729 bool flip = zoneShadowFlipMap[zoneFacei];
2730 const face& f = mesh.
faces()[meshFacei];
2741 interMeshTopPatch[zoneI],
2755 interMeshTopPatch[zoneI],
2765 forAll(extrudeMeshFaces, zoneFacei)
2767 label meshFacei = extrudeMeshFaces[zoneFacei];
2768 label zoneI = zoneID[zoneFacei];
2769 bool flip = zoneFlipMap[zoneFacei];
2770 const face& f = mesh.
faces()[meshFacei];
2785 interMeshTopPatch[zoneI],
2802 interMeshTopPatch[zoneI],
2811 addBafflesMap = meshMod.changeMesh(mesh,
false);
2822 if (addBafflesMap().hasMotionPoints())
2824 mesh.
movePoints(addBafflesMap().preMotionPoints());
2830 deleteEmptyPatches(mesh);
2832 Info<<
"Writing mesh " << mesh.
name()
2839 <<
"Failed writing mesh " << mesh.
name()
const Time & time() const
Return time.
scalar sumThickness(const label layer) const
Helper: calculate cumulative relative thickness for layer.
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.
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.
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
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.
label toGlobal(const label i) const
From local to global.
const labelList & faceToFaceMap() const
From region face to patch face. Contains turning index:
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
wordList names() const
Return a list of patch names.
const boolList & flipMap() const
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const fileName & facesInstance() const
Return the current instance directory for faces.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
void size(const label)
Override size to be inconsistent with allocated storage.
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.
const labelList & pointToPointMap() const
From region point to patch point.
const Field< PointType > & points() const
Return reference to global points.
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.
static bool master(const label communicator=0)
Am I the master process.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
label size() const
Return number of elements in table.
const vectorField & faceCentres() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const labelList & cellToFaceMap() const
From region cell to patch face. Consecutively added so.
Pre-declare related SubField type.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const labelListList & edgeFaces() const
bool add(entry *, bool mergeEntry=false)
Add a new entry.
virtual const pointField & points() const
Return raw points.
const word & executable() const
Name of executable without the path.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
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.
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...
label findZoneID(const word &zoneName) const
Find zone index given a name.
vectorField pointField
pointField is a vectorField.
static const NamedEnum< transformType, 5 > transformTypeNames
label start() const
Return start label of this patch in the polyMesh face list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
bool optionFound(const word &opt) const
Return true if the named option is found.
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.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
wordList names() const
Return a list of zone names.
label size() const
Return the number of elements in the list.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
Foam::autoPtr< IOobject > clone() const
Clone.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Creates mesh by extruding a patch.
static const word null
An empty word.
const vectorField & cellCentres() const
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static const label labelMax
List< label > labelList
A List of labels.
const labelListList & pointEdges() const
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
const word & name() const
Return name.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
const globalMeshData & globalData() const
Return parallel info.
prefixOSstream Pout(cout,"Pout")
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
OFstream which keeps track of vertices.
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
#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 occurence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
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 nEdges() const
Return number of edges in patch.
label size() const
Return the number of elements in the UList.
void setSize(const label)
Reset size of List.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Class containing processor-to-processor mapping information.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const Field< PointType > & faceNormals() const
Return face normals for patch.
#define WarningInFunction
Report a warning using Foam::Warning.
word dictName("noiseDict")
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const fileName & pointsInstance() const
Return the current instance directory for points.
mode_t mode(const fileName &)
Return the file mode.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
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.
virtual bool write() const
Write using setting from DB.
void set(entry *)
Assign a new entry, overwrite any existing entry.
dimensioned< scalar > mag(const dimensioned< Type > &)
face reverseFace() const
Return face with reverse direction.
const faceZoneMesh & faceZones() const
Return face zone mesh.
const labelListList & edgeFaces() const
Return edge-face addressing.
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.
const vectorField::subField faceCentres() const
Return face centres.
const word & system() const
Return system name.
static void addNote(const string &)
Add extra notes for the usage information.
A class for managing temporary objects.
virtual const labelList & faceOwner() const
Return face owner.
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.
virtual const faceList & faces() const
Return raw faces.
fileName path() const
Return path.
Foam::argList args(argc, argv)
label findPatchID(const word &patchName) const
Find patch index given a name.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
static const label labelMin
const word & name() const
Return name.
label size() const
Return the number of elements in the UPtrList.
A HashTable to objects of type <T> with a label key.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.