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 in between 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 1087 transformDict.
add(
"matchTolerance", 1e6);
1093 forAll(zoneZonePatch_min, minZone)
1095 for (
label maxZone = minZone; maxZone < zoneNames.
size(); maxZone++)
1097 label index = minZone*zoneNames.
size()+maxZone;
1099 if (zoneZonePatch_min[index] > 0)
1104 + zoneNames[maxZone];
1108 + zoneNames[minZone];
1111 transformDict.
set(
"neighbourPatch", maxToMin);
1112 zoneZonePatch_min[index] =
1113 addPatch<nonuniformTransformCyclicPolyPatch>
1120 Pout<< zoneZonePatch_min[index] <<
'\t' << minToMax
1124 transformDict.
set(
"neighbourPatch", minToMax);
1125 zoneZonePatch_max[index] =
1126 addPatch<nonuniformTransformCyclicPolyPatch>
1133 Pout<< zoneZonePatch_max[index] <<
'\t' << maxToMin
1141 Pout<<
"Added " << newPatches.
size()-nOldPatches <<
" inter-zone patches." 1162 point patchFc = extrudePatch[patchFacei].centre
1166 offsets[i] = patchFc - fc[i];
1172 void setCouplingInfo
1176 const word& sampleRegion,
1189 forAll(zoneToPatch, zoneI)
1191 label patchi = zoneToPatch[zoneI];
1197 if (isA<mappedWallPolyPatch>(pp))
1215 forAll(newPatches, patchi)
1217 if (!newPatches[patchi])
1229 void extrudeGeometricProperties
1343 faceCentres[facei] = model
1345 patchFaceCentres[patchFacei],
1363 patchEdgeCentres[patchEdgeI],
1364 patchEdgeNormals[patchEdgeI],
1370 patchEdgeCentres[patchEdgeI],
1371 patchEdgeNormals[patchEdgeI],
1376 faceCentres[facei] = 0.5*(pt0+pt1);
1405 patchFaceCentres[patchFacei],
1411 patchFaceCentres[patchFacei],
1417 cellCentres[celli] = 0.5*(pt0+pt1);
1427 forAll(faceCentres, facei)
1429 Pout<<
"Model :" << faceCentres[facei] << endl
1440 forAll(cellCentres, celli)
1442 Pout<<
"Model :" << cellCentres[celli] << endl
1457 Info<<
"Writing geometric properties for mesh " << regionMesh.
name()
1461 bool ok = faceCentres.
write() && cellCentres.
write();
1466 <<
"Failed writing " << faceCentres.objectPath()
1467 <<
" and " << cellCentres.objectPath()
1475 int main(
int argc,
char *argv[])
1494 <<
"Patches are not synchronised on all processors." 1495 <<
" Per processor patches " << allNames
1516 const word shellRegionName(dict.
lookup(
"region"));
1522 bool hasZones = dict.
found(
"faceZones");
1525 dict.
lookup(
"faceZones") >> zoneNames;
1529 if (dict.
found(
"faceSets"))
1532 <<
"Please supply faces to extrude either through 'faceZones'" 1533 <<
" or 'faceSets' entry. Found both." 1539 dict.
lookup(
"faceSets") >> zoneNames;
1548 Switch oneDNonManifoldEdges(
false);
1549 word oneDPatchType(emptyPolyPatch::typeName);
1553 dict.
lookup(
"oneDPolyPatchType") >> oneDPatchType;
1560 Info<<
"Extruding zones " << zoneNames
1561 <<
" on mesh " << regionName
1562 <<
" into shell mesh " << shellRegionName
1567 Info<<
"Extruding faceSets " << zoneNames
1568 <<
" on mesh " << regionName
1569 <<
" into shell mesh " << shellRegionName
1573 if (shellRegionName == regionName)
1576 <<
"Cannot extrude into same region as mesh." << endl
1577 <<
"Mesh region : " << regionName << endl
1578 <<
"Shell region : " << shellRegionName
1585 if (oneDNonManifoldEdges)
1587 Info<<
"Extruding as 1D columns with sides in patch type " 1589 <<
" and connected points (except on non-manifold areas)." 1594 Info<<
"Extruding as 1D columns with sides in patch type " 1596 <<
" and duplicated points (overlapping volumes)." 1652 createDummyFvMeshFiles(mesh, shellRegionName);
1663 meshInstance = oldInstance;
1665 Info<<
"Writing meshes to " << meshInstance <<
nl <<
endl;
1679 boolList isInternal(zoneNames.size(),
false);
1695 meshZoneID.
setSize(zoneNames.size());
1698 meshZoneID[i] = faceZones.
findZoneID(zoneNames[i]);
1699 if (meshZoneID[i] == -1)
1702 <<
"Cannot find zone " << zoneNames[i] << endl
1703 <<
"Valid zones are " << faceZones.
names()
1708 label nExtrudeFaces = 0;
1711 nExtrudeFaces += faceZones[meshZoneID[i]].
size();
1713 extrudeMeshFaces.setSize(nExtrudeFaces);
1714 zoneFaces.
setSize(nExtrudeFaces);
1715 zoneID.
setSize(nExtrudeFaces);
1716 zoneFlipMap.
setSize(nExtrudeFaces);
1720 const faceZone& fz = faceZones[meshZoneID[i]];
1724 extrudeMeshFaces[nExtrudeFaces] = fz[j];
1725 zoneFaces[nExtrudeFaces] = fzp[j];
1726 zoneID[nExtrudeFaces] = i;
1727 zoneFlipMap[nExtrudeFaces] = fz.
flipMap()[j];
1732 isInternal[i] =
true;
1740 if (zoneShadowNames.
size())
1743 forAll(zoneShadowNames, i)
1745 zoneShadowIDs[i] = faceZones.
findZoneID(zoneShadowNames[i]);
1746 if (zoneShadowIDs[i] == -1)
1749 <<
"Cannot find zone " << zoneShadowNames[i] << endl
1750 <<
"Valid zones are " << faceZones.
names()
1755 label nShadowFaces = 0;
1758 nShadowFaces += faceZones[zoneShadowIDs[i]].
size();
1761 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1762 zoneShadowFlipMap.
setSize(nShadowFaces);
1763 zoneShadowID.
setSize(nShadowFaces);
1768 const faceZone& fz = faceZones[zoneShadowIDs[i]];
1771 extrudeMeshShadowFaces[nShadowFaces] = fz[j];
1772 zoneShadowFlipMap[nShadowFaces] = fz.
flipMap()[j];
1773 zoneShadowID[nShadowFaces] = i;
1781 meshZoneID.
setSize(zoneNames.size(), -1);
1786 Info<<
"Loading faceSet " << zoneNames[i] <<
endl;
1787 zones.set(i,
new faceSet(mesh, zoneNames[i]));
1792 label nExtrudeFaces = 0;
1795 nExtrudeFaces += zones[i].size();
1797 extrudeMeshFaces.setSize(nExtrudeFaces);
1798 zoneFaces.
setSize(nExtrudeFaces);
1799 zoneID.
setSize(nExtrudeFaces);
1800 zoneFlipMap.
setSize(nExtrudeFaces);
1808 label facei = iter.key();
1812 <<
"faceSet " << fz.
name()
1813 <<
"contains internal faces." 1814 <<
" This is not permitted." 1817 extrudeMeshFaces[nExtrudeFaces] = facei;
1818 zoneFaces[nExtrudeFaces] = mesh.
faces()[facei];
1819 zoneID[nExtrudeFaces] = i;
1820 zoneFlipMap[nExtrudeFaces] =
false;
1825 isInternal[i] =
true;
1835 if (zoneShadowNames.
size())
1837 zoneShadowIDs.
setSize(zoneShadowNames.
size(), -1);
1838 forAll(zoneShadowNames, i)
1840 shadowZones.set(i,
new faceSet(mesh, zoneShadowNames[i]));
1843 label nShadowFaces = 0;
1846 nShadowFaces += shadowZones[i].size();
1849 if (nExtrudeFaces != nShadowFaces)
1852 <<
"Extruded faces " << nExtrudeFaces << endl
1853 <<
"is different from shadow faces. " << nShadowFaces
1854 <<
"This is not permitted " << endl
1858 extrudeMeshShadowFaces.
setSize(nShadowFaces);
1859 zoneShadowFlipMap.
setSize(nShadowFaces);
1860 zoneShadowID.
setSize(nShadowFaces);
1865 const faceSet& fz = shadowZones[i];
1868 label facei = iter.key();
1872 <<
"faceSet " << fz.
name()
1873 <<
"contains internal faces." 1874 <<
" This is not permitted." 1877 extrudeMeshShadowFaces[nShadowFaces] = facei;
1878 zoneShadowFlipMap[nShadowFaces] =
false;
1879 zoneShadowID[nShadowFaces] = i;
1892 checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
1901 Info<<
"extrudePatch :" 1902 <<
" faces:" << extrudePatch.size()
1903 <<
" points:" << extrudePatch.
nPoints()
1904 <<
" edges:" << extrudePatch.
nEdges()
1922 const globalIndex globalExtrudeFaces(extrudePatch.size());
1939 extrudeEdgeGlobalFaces,
1953 extrudeEdgeFacesMap,
1954 extrudeEdgeGlobalFaces,
1968 if (!isA<processorPolyPatch>(patches[patchi]))
1970 label newPatchi = regionPatches.size();
1971 regionPatches.append
1973 patches[patchi].clone
2003 interRegionTopPatch,
2004 interRegionBottomPatch
2020 newPatches.
append(patches[patchi].clone(patches).ptr());
2036 interMeshBottomPatch
2041 mesh.removeFvBoundary();
2042 mesh.addFvPatches(newPatches,
true);
2049 labelList extrudeTopPatchID(extrudePatch.size());
2050 labelList extrudeBottomPatchID(extrudePatch.size());
2054 extrudeTopPatchID[facei] = interRegionTopPatch[zoneID[facei]];
2055 extrudeBottomPatchID[facei] = interRegionBottomPatch[zoneID[facei]];
2063 labelList zoneSidePatch(zoneNames.size(), 0);
2065 labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), 0);
2067 labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0);
2078 extrudeEdgeGlobalFaces,
2125 extrudeEdgeFacesMap,
2126 extrudeEdgeGlobalFaces,
2176 const labelList& eFaces = edgeFaces[edgeI];
2178 labelList& ePatches = extrudeEdgePatches[edgeI];
2185 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2188 if (oneDNonManifoldEdges)
2193 if (eFaces.
size() != 2)
2195 nonManifoldEdge[edgeI] = 1;
2200 nonManifoldEdge[edgeI] = 1;
2203 else if (eFaces.
size() == 2)
2205 label zone0 = zoneID[eFaces[0]];
2206 label zone1 = zoneID[eFaces[1]];
2212 label index = minZone*zoneNames.size()+maxZone;
2214 ePatches.
setSize(eFaces.size());
2216 if (zone0 == minZone)
2218 ePatches[0] = zoneZonePatch_min[index];
2219 ePatches[1] = zoneZonePatch_max[index];
2223 ePatches[0] = zoneZonePatch_max[index];
2224 ePatches[1] = zoneZonePatch_min[index];
2227 nonManifoldEdge[edgeI] = 1;
2230 else if (sidePatchID[edgeI] != -1)
2233 ePatches.
setSize(eFaces.size());
2236 ePatches[i] = sidePatchID[edgeI];
2241 label facei = findUncoveredPatchFace
2245 extrudeMeshEdges[edgeI]
2250 label newPatchi = findPatchID
2255 ePatches.
setSize(eFaces.size(), newPatchi);
2259 ePatches.
setSize(eFaces.size());
2262 ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
2265 nonManifoldEdge[edgeI] = 1;
2293 forAll(pointLocalRegions, facei)
2296 const face& pRegions = pointLocalRegions[facei];
2299 localRegionPoints[pRegions[fp]] = f[fp];
2308 forAll(pointLocalRegions, facei)
2310 const face& pRegions = pointLocalRegions[facei];
2313 label localRegionI = pRegions[fp];
2314 localSum[localRegionI] += extrudePatch.
faceNormals()[facei];
2320 forAll(localSum, localRegionI)
2322 label globalRegionI = localToGlobalRegion[localRegionI];
2323 globalSum.insert(globalRegionI, localSum[localRegionI]);
2330 forAll(localToGlobalRegion, localRegionI)
2332 label globalRegionI = localToGlobalRegion[localRegionI];
2333 localRegionNormals[localRegionI] = globalSum[globalRegionI];
2335 localRegionNormals /=
mag(localRegionNormals);
2347 forAll(pointLocalRegions, facei)
2349 const face& f = extrudeFaces[facei];
2353 label region = pointLocalRegions[facei][fp];
2354 const point& pt = extrudePoints[f[fp]];
2361 pt+thickness*localRegionNormals[region]
2364 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
2372 forAll(firstDisp, regionI)
2379 localRegionPoints[regionI]
2382 const vector& n = localRegionNormals[regionI];
2383 firstDisp[regionI] = model()(regionPt,
n, 1) - regionPt;
2418 forAll(regionPatches, patchi)
2425 regionMesh.removeFvBoundary();
2426 regionMesh.addFvPatches(regionPatches,
true);
2434 model().expansionRatio(),
2437 extrudeBottomPatchID,
2451 forAll(localRegionPoints, regionI)
2453 label pointi = localRegionPoints[regionI];
2455 const vector& n = localRegionNormals[regionI];
2457 for (
label layerI = 1; layerI <= model().
nLayers(); layerI++)
2459 newPoints[meshPointi++] = model()(pt,
n, layerI);
2463 shellMap = meshMod.changeMesh
2488 if (isA<mappedWallPolyPatch>(pp))
2490 if (
findIndex(interRegionTopPatch, patchi) != -1)
2493 topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2495 else if (
findIndex(interRegionBottomPatch, patchi) != -1)
2498 bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
2512 interRegionTopPatch,
2522 interRegionBottomPatch,
2529 deleteEmptyPatches(regionMesh);
2551 interMeshBottomPatch,
2567 "cellToPatchFaceAddressing",
2577 cellToPatchFaceAddressing.
note() =
"cell to patch face addressing";
2583 "faceToPatchFaceAddressing",
2593 faceToPatchFaceAddressing.
note() =
2594 "front/back face + turning index to patch face addressing";
2600 "faceToPatchEdgeAddressing",
2610 faceToPatchEdgeAddressing.
note() =
2611 "side face to patch edge addressing";
2617 "pointToPatchPointAddressing",
2627 pointToPatchPointAddressing.
note() =
2628 "point to patch point addressing";
2631 Info<<
"Writing mesh " << regionMesh.
name()
2637 && cellToPatchFaceAddressing.write()
2638 && faceToPatchFaceAddressing.write()
2639 && faceToPatchEdgeAddressing.write()
2640 && pointToPatchPointAddressing.write();
2645 <<
"Failed writing mesh " << regionMesh.
name()
2666 Info<<
"Reading patch face,edge centres : " 2667 << io.name() <<
" and patchEdgeCentres" <<
endl;
2669 extrudeGeometricProperties
2693 forAll(extrudeMeshFaces, zoneFacei)
2695 label meshFacei = extrudeMeshFaces[zoneFacei];
2696 label zoneI = zoneID[zoneFacei];
2697 bool flip = zoneFlipMap[zoneFacei];
2698 const face& f = mesh.
faces()[meshFacei];
2709 interMeshBottomPatch[zoneI],
2723 interMeshBottomPatch[zoneI],
2730 if (zoneShadowNames.
size() > 0)
2732 forAll(extrudeMeshFaces, zoneFacei)
2734 label meshFacei = extrudeMeshShadowFaces[zoneFacei];
2735 label zoneI = zoneShadowID[zoneFacei];
2736 bool flip = zoneShadowFlipMap[zoneFacei];
2737 const face& f = mesh.
faces()[meshFacei];
2748 interMeshTopPatch[zoneI],
2762 interMeshTopPatch[zoneI],
2772 forAll(extrudeMeshFaces, zoneFacei)
2774 label meshFacei = extrudeMeshFaces[zoneFacei];
2775 label zoneI = zoneID[zoneFacei];
2776 bool flip = zoneFlipMap[zoneFacei];
2777 const face& f = mesh.
faces()[meshFacei];
2792 interMeshTopPatch[zoneI],
2809 interMeshTopPatch[zoneI],
2818 addBafflesMap = meshMod.changeMesh(mesh,
false);
2829 if (addBafflesMap().hasMotionPoints())
2831 mesh.
movePoints(addBafflesMap().preMotionPoints());
2837 deleteEmptyPatches(mesh);
2839 Info<<
"Writing mesh " << mesh.
name()
2846 <<
"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.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
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 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")
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.