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,
1186 forAll(zoneToPatch, zoneI)
1188 label patchi = zoneToPatch[zoneI];
1194 if (isA<mappedWallPolyPatch>(pp))
1212 forAll(newPatches, patchi)
1214 if (!newPatches[patchi])
1226 void extrudeGeometricProperties
1340 faceCentres[facei] = model
1342 patchFaceCentres[patchFacei],
1360 patchEdgeCentres[patchEdgeI],
1361 patchEdgeNormals[patchEdgeI],
1367 patchEdgeCentres[patchEdgeI],
1368 patchEdgeNormals[patchEdgeI],
1373 faceCentres[facei] = 0.5*(pt0+pt1);
1402 patchFaceCentres[patchFacei],
1408 patchFaceCentres[patchFacei],
1414 cellCentres[celli] = 0.5*(pt0+pt1);
1424 forAll(faceCentres, facei)
1426 Pout<<
"Model :" << faceCentres[facei] << endl
1437 forAll(cellCentres, celli)
1439 Pout<<
"Model :" << cellCentres[celli] << endl
1454 Info<<
"Writing geometric properties for mesh " << regionMesh.
name()
1458 bool ok = faceCentres.
write() && cellCentres.
write();
1463 <<
"Failed writing " << faceCentres.objectPath()
1464 <<
" and " << cellCentres.objectPath()
1472 int main(
int argc,
char *argv[])
1491 <<
"Patches are not synchronised on all processors." 1492 <<
" Per processor patches " << allNames
1513 const word shellRegionName(dict.
lookup(
"region"));
1519 bool hasZones = dict.
found(
"faceZones");
1522 dict.
lookup(
"faceZones") >> zoneNames;
1526 if (dict.
found(
"faceSets"))
1529 <<
"Please supply faces to extrude either through 'faceZones'" 1530 <<
" or 'faceSets' entry. Found both." 1536 dict.
lookup(
"faceSets") >> zoneNames;
1545 Switch oneDNonManifoldEdges(
false);
1546 word oneDPatchType(emptyPolyPatch::typeName);
1550 dict.
lookup(
"oneDPolyPatchType") >> oneDPatchType;
1557 Info<<
"Extruding zones " << zoneNames
1558 <<
" on mesh " << regionName
1559 <<
" into shell mesh " << shellRegionName
1564 Info<<
"Extruding faceSets " << zoneNames
1565 <<
" on mesh " << regionName
1566 <<
" into shell mesh " << shellRegionName
1570 if (shellRegionName == regionName)
1573 <<
"Cannot extrude into same region as mesh." << endl
1574 <<
"Mesh region : " << regionName << endl
1575 <<
"Shell region : " << shellRegionName
1582 if (oneDNonManifoldEdges)
1584 Info<<
"Extruding as 1D columns with sides in patch type " 1586 <<
" and connected points (except on non-manifold areas)." 1591 Info<<
"Extruding as 1D columns with sides in patch type " 1593 <<
" and duplicated points (overlapping volumes)." 1649 createDummyFvMeshFiles(mesh, shellRegionName);
1656 meshInstance = runTime.timeName();
1660 meshInstance = oldInstance;
1662 Info<<
"Writing meshes to " << meshInstance <<
nl <<
endl;
1676 boolList isInternal(zoneNames.size(),
false);
1692 meshZoneID.
setSize(zoneNames.size());
1695 meshZoneID[i] = faceZones.
findZoneID(zoneNames[i]);
1696 if (meshZoneID[i] == -1)
1699 <<
"Cannot find zone " << zoneNames[i] << endl
1700 <<
"Valid zones are " << faceZones.
names()
1705 label nExtrudeFaces = 0;
1708 nExtrudeFaces += faceZones[meshZoneID[i]].
size();
1710 extrudeMeshFaces.setSize(nExtrudeFaces);
1711 zoneFaces.
setSize(nExtrudeFaces);
1712 zoneID.
setSize(nExtrudeFaces);
1713 zoneFlipMap.
setSize(nExtrudeFaces);
1717 const faceZone& fz = faceZones[meshZoneID[i]];
1721 extrudeMeshFaces[nExtrudeFaces] = fz[j];
1722 zoneFaces[nExtrudeFaces] = fzp[j];
1723 zoneID[nExtrudeFaces] = i;
1724 zoneFlipMap[nExtrudeFaces] = fz.
flipMap()[j];
1729 isInternal[i] =
true;
1737 if (zoneShadowNames.
size())
1740 forAll(zoneShadowNames, i)
1742 zoneShadowIDs[i] = faceZones.
findZoneID(zoneShadowNames[i]);
1743 if (zoneShadowIDs[i] == -1)
1746 <<
"Cannot find zone " << zoneShadowNames[i] << endl
1747 <<
"Valid zones are " << faceZones.
names()
1752 label nShadowFaces = 0;
1755 nShadowFaces += faceZones[zoneShadowIDs[i]].
size();
1758 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1759 zoneShadowFlipMap.
setSize(nShadowFaces);
1760 zoneShadowID.
setSize(nShadowFaces);
1765 const faceZone& fz = faceZones[zoneShadowIDs[i]];
1768 extrudeMeshShadowFaces[nShadowFaces] = fz[j];
1769 zoneShadowFlipMap[nShadowFaces] = fz.
flipMap()[j];
1770 zoneShadowID[nShadowFaces] = i;
1778 meshZoneID.
setSize(zoneNames.size(), -1);
1783 Info<<
"Loading faceSet " << zoneNames[i] <<
endl;
1784 zones.set(i,
new faceSet(mesh, zoneNames[i]));
1789 label nExtrudeFaces = 0;
1792 nExtrudeFaces += zones[i].size();
1794 extrudeMeshFaces.setSize(nExtrudeFaces);
1795 zoneFaces.
setSize(nExtrudeFaces);
1796 zoneID.
setSize(nExtrudeFaces);
1797 zoneFlipMap.
setSize(nExtrudeFaces);
1805 label facei = iter.key();
1809 <<
"faceSet " << fz.
name()
1810 <<
"contains internal faces." 1811 <<
" This is not permitted." 1814 extrudeMeshFaces[nExtrudeFaces] = facei;
1815 zoneFaces[nExtrudeFaces] = mesh.
faces()[facei];
1816 zoneID[nExtrudeFaces] = i;
1817 zoneFlipMap[nExtrudeFaces] =
false;
1822 isInternal[i] =
true;
1832 if (zoneShadowNames.
size())
1834 zoneShadowIDs.
setSize(zoneShadowNames.
size(), -1);
1835 forAll(zoneShadowNames, i)
1837 shadowZones.set(i,
new faceSet(mesh, zoneShadowNames[i]));
1840 label nShadowFaces = 0;
1843 nShadowFaces += shadowZones[i].size();
1846 if (nExtrudeFaces != nShadowFaces)
1849 <<
"Extruded faces " << nExtrudeFaces << endl
1850 <<
"is different from shadow faces. " << nShadowFaces
1851 <<
"This is not permitted " << endl
1855 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1856 zoneShadowFlipMap.
setSize(nShadowFaces);
1857 zoneShadowID.
setSize(nShadowFaces);
1862 const faceSet& fz = shadowZones[i];
1865 label facei = iter.key();
1869 <<
"faceSet " << fz.
name()
1870 <<
"contains internal faces." 1871 <<
" This is not permitted." 1874 extrudeMeshShadowFaces[nShadowFaces] = facei;
1875 zoneShadowFlipMap[nShadowFaces] =
false;
1876 zoneShadowID[nShadowFaces] = i;
1889 checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
1898 Info<<
"extrudePatch :" 1899 <<
" faces:" << extrudePatch.size()
1900 <<
" points:" << extrudePatch.
nPoints()
1901 <<
" edges:" << extrudePatch.
nEdges()
1919 const globalIndex globalExtrudeFaces(extrudePatch.size());
1936 extrudeEdgeGlobalFaces,
1950 extrudeEdgeFacesMap,
1951 extrudeEdgeGlobalFaces,
1965 if (!isA<processorPolyPatch>(patches[patchi]))
1967 label newPatchi = regionPatches.size();
1968 regionPatches.append
1970 patches[patchi].clone
2000 interRegionTopPatch,
2001 interRegionBottomPatch
2017 newPatches.
append(patches[patchi].clone(patches).ptr());
2033 interMeshBottomPatch
2038 mesh.removeFvBoundary();
2039 mesh.addFvPatches(newPatches,
true);
2046 labelList extrudeTopPatchID(extrudePatch.size());
2047 labelList extrudeBottomPatchID(extrudePatch.size());
2051 extrudeTopPatchID[facei] = interRegionTopPatch[zoneID[facei]];
2052 extrudeBottomPatchID[facei] = interRegionBottomPatch[zoneID[facei]];
2060 labelList zoneSidePatch(zoneNames.size(), 0);
2062 labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), 0);
2064 labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0);
2075 extrudeEdgeGlobalFaces,
2122 extrudeEdgeFacesMap,
2123 extrudeEdgeGlobalFaces,
2173 const labelList& eFaces = edgeFaces[edgeI];
2175 labelList& ePatches = extrudeEdgePatches[edgeI];
2182 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2185 if (oneDNonManifoldEdges)
2190 if (eFaces.
size() != 2)
2192 nonManifoldEdge[edgeI] = 1;
2197 nonManifoldEdge[edgeI] = 1;
2200 else if (eFaces.
size() == 2)
2202 label zone0 = zoneID[eFaces[0]];
2203 label zone1 = zoneID[eFaces[1]];
2209 label index = minZone*zoneNames.size()+maxZone;
2211 ePatches.
setSize(eFaces.size());
2213 if (zone0 == minZone)
2215 ePatches[0] = zoneZonePatch_min[index];
2216 ePatches[1] = zoneZonePatch_max[index];
2220 ePatches[0] = zoneZonePatch_max[index];
2221 ePatches[1] = zoneZonePatch_min[index];
2224 nonManifoldEdge[edgeI] = 1;
2227 else if (sidePatchID[edgeI] != -1)
2230 ePatches.
setSize(eFaces.size());
2233 ePatches[i] = sidePatchID[edgeI];
2238 label facei = findUncoveredPatchFace
2242 extrudeMeshEdges[edgeI]
2247 label newPatchi = findPatchID
2252 ePatches.
setSize(eFaces.size(), newPatchi);
2256 ePatches.
setSize(eFaces.size());
2259 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2262 nonManifoldEdge[edgeI] = 1;
2290 forAll(pointLocalRegions, facei)
2293 const face& pRegions = pointLocalRegions[facei];
2296 localRegionPoints[pRegions[fp]] = f[fp];
2305 forAll(pointLocalRegions, facei)
2307 const face& pRegions = pointLocalRegions[facei];
2310 label localRegionI = pRegions[fp];
2311 localSum[localRegionI] += extrudePatch.
faceNormals()[facei];
2317 forAll(localSum, localRegionI)
2319 label globalRegionI = localToGlobalRegion[localRegionI];
2320 globalSum.insert(globalRegionI, localSum[localRegionI]);
2327 forAll(localToGlobalRegion, localRegionI)
2329 label globalRegionI = localToGlobalRegion[localRegionI];
2330 localRegionNormals[localRegionI] = globalSum[globalRegionI];
2332 localRegionNormals /=
mag(localRegionNormals);
2339 OFstream str(runTime.path()/
"localRegionNormals.obj");
2344 forAll(pointLocalRegions, facei)
2346 const face& f = extrudeFaces[facei];
2350 label region = pointLocalRegions[facei][fp];
2351 const point& pt = extrudePoints[f[fp]];
2358 pt+thickness*localRegionNormals[region]
2361 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
2369 forAll(firstDisp, regionI)
2376 localRegionPoints[regionI]
2379 const vector& n = localRegionNormals[regionI];
2380 firstDisp[regionI] = model()(regionPt,
n, 1) - regionPt;
2415 forAll(regionPatches, patchi)
2422 regionMesh.removeFvBoundary();
2423 regionMesh.addFvPatches(regionPatches,
true);
2431 model().expansionRatio(),
2434 extrudeBottomPatchID,
2448 forAll(localRegionPoints, regionI)
2450 label pointi = localRegionPoints[regionI];
2452 const vector& n = localRegionNormals[regionI];
2454 for (
label layerI = 1; layerI <= model().
nLayers(); layerI++)
2456 newPoints[meshPointi++] = model()(pt,
n, layerI);
2460 shellMap = meshMod.changeMesh
2485 if (isA<mappedWallPolyPatch>(pp))
2487 if (
findIndex(interRegionTopPatch, patchi) != -1)
2490 topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2492 else if (
findIndex(interRegionBottomPatch, patchi) != -1)
2495 bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2509 interRegionTopPatch,
2519 interRegionBottomPatch,
2526 deleteEmptyPatches(regionMesh);
2548 interMeshBottomPatch,
2564 "cellToPatchFaceAddressing",
2574 cellToPatchFaceAddressing.
note() =
"cell to patch face addressing";
2580 "faceToPatchFaceAddressing",
2590 faceToPatchFaceAddressing.
note() =
2591 "front/back face + turning index to patch face addressing";
2597 "faceToPatchEdgeAddressing",
2607 faceToPatchEdgeAddressing.
note() =
2608 "side face to patch edge addressing";
2614 "pointToPatchPointAddressing",
2624 pointToPatchPointAddressing.
note() =
2625 "point to patch point addressing";
2628 Info<<
"Writing mesh " << regionMesh.
name()
2634 && cellToPatchFaceAddressing.write()
2635 && faceToPatchFaceAddressing.write()
2636 && faceToPatchEdgeAddressing.write()
2637 && pointToPatchPointAddressing.write();
2642 <<
"Failed writing mesh " << regionMesh.
name()
2663 Info<<
"Reading patch face,edge centres : " 2664 << io.name() <<
" and patchEdgeCentres" <<
endl;
2666 extrudeGeometricProperties
2690 forAll(extrudeMeshFaces, zoneFacei)
2692 label meshFacei = extrudeMeshFaces[zoneFacei];
2693 label zoneI = zoneID[zoneFacei];
2694 bool flip = zoneFlipMap[zoneFacei];
2695 const face& f = mesh.
faces()[meshFacei];
2706 interMeshBottomPatch[zoneI],
2720 interMeshBottomPatch[zoneI],
2727 if (zoneShadowNames.
size() > 0)
2729 forAll(extrudeMeshFaces, zoneFacei)
2731 label meshFacei = extrudeMeshShadowFaces[zoneFacei];
2732 label zoneI = zoneShadowID[zoneFacei];
2733 bool flip = zoneShadowFlipMap[zoneFacei];
2734 const face& f = mesh.
faces()[meshFacei];
2745 interMeshTopPatch[zoneI],
2759 interMeshTopPatch[zoneI],
2769 forAll(extrudeMeshFaces, zoneFacei)
2771 label meshFacei = extrudeMeshFaces[zoneFacei];
2772 label zoneI = zoneID[zoneFacei];
2773 bool flip = zoneFlipMap[zoneFacei];
2774 const face& f = mesh.
faces()[meshFacei];
2789 interMeshTopPatch[zoneI],
2806 interMeshTopPatch[zoneI],
2815 addBafflesMap = meshMod.changeMesh(mesh,
false);
2826 if (addBafflesMap().hasMotionPoints())
2828 mesh.
movePoints(addBafflesMap().preMotionPoints());
2834 deleteEmptyPatches(mesh);
2836 Info<<
"Writing mesh " << mesh.
name()
2843 <<
"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.
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.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
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.
static bool master(const label communicator=0)
Am I the master process.
label findPatchID(const word &patchName) const
Find patch index given a name.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
const Field< PointType > & faceNormals() const
Return face normals for 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.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
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.
mode_t mode(const fileName &, const bool followLink=true)
Return the file mode.
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 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.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
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 occurence 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")
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.
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.
virtual bool write(const bool valid=true) const
Write using setting from DB.
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.