74 const bool flipFaceFlux,
75 const label newPatchI,
82 if (!modifiedFace[faceI])
100 modifiedFace[faceI] = 1;
131 const Type& exposedValue,
132 const word GeomVolType,
142 if (iter()->headerClassName() == GeomVolType)
144 const word fieldName = iter()->name();
146 Info<<
"Subsetting field " << fieldName <<
endl;
160 subFields[i++].boundaryField()[patchI];
162 label newStart =
fld.patch().patch().start();
179 ].patch().patch().start();
185 if (oldFaceI < oldStart || oldFaceI >= oldStart+oldSize)
187 fld[j] = exposedValue;
203 const Type& exposedValue,
204 const word GeomSurfType,
214 if (iter()->headerClassName() == GeomSurfType)
216 const word& fieldName = iter.key();
218 Info<<
"Subsetting field " << fieldName <<
endl;
233 subFields[i++].boundaryField()[patchI];
235 label newStart =
fld.patch().patch().start();
252 ].patch().patch().start();
258 if (oldFaceI < oldStart || oldFaceI >= oldStart+oldSize)
260 fld[j] = exposedValue;
272 template<
class GeoField>
273 void initCreatedPatches
277 const typename GeoField::value_type initValue
282 mesh.objectRegistry::lookupClass<GeoField>()
288 iterator fieldIter =
fields.begin();
289 fieldIter !=
fields.end();
293 GeoField& field =
const_cast<GeoField&
>(*fieldIter());
300 field.boundaryField()[
patchi] = initValue;
302 if (field.boundaryField()[
patchi].fixesValue())
304 field.boundaryField()[
patchi] == initValue;
312 void createCoupledBaffles
322 forAll(coupledWantedPatch, faceI)
324 if (coupledWantedPatch[faceI] != -1)
328 bool zoneFlip =
false;
332 const faceZone& fZone = faceZones[zoneID];
344 coupledWantedPatch[faceI],
353 bool zoneFlip =
false;
357 const faceZone& fZone = faceZones[zoneID];
368 coupledWantedPatch[faceI],
379 void createCyclicCoupledBaffles
390 forAll(cyclicMasterPatch, faceI)
392 if (cyclicMasterPatch[faceI] != -1)
397 bool zoneFlip =
false;
401 const faceZone& fZone = faceZones[zoneID];
412 cyclicMasterPatch[faceI],
420 forAll(cyclicSlavePatch, faceI)
422 if (cyclicSlavePatch[faceI] != -1)
428 bool zoneFlip =
false;
432 const faceZone& fZone = faceZones[zoneID];
443 cyclicSlavePatch[faceI],
462 Info <<
"faceZone:createBaffle " << faceZones <<
endl;
463 forAll(wantedPatch, faceI)
465 if (wantedPatch[faceI] != -1)
470 bool zoneFlip =
false;
474 const faceZone& fZone = faceZones[zoneID];
497 bool zoneFlip =
false;
501 const faceZone& fZone = faceZones[zoneID];
535 <<
"Illegal patch " << patchName
536 <<
nl <<
"Valid patches are " <<
patches.names()
542 label newPatch = patchI;
545 if (newPatch != patchI)
548 <<
"Patch " << patchName
549 <<
" should have the same patch index on all processors." <<
nl
550 <<
"On my processor it has index " << patchI
551 <<
" ; on some other processor it has index " << newPatch
560 int main(
int argc,
char *argv[])
565 runTime.functionObjects().off();
592 if (!iter().isDict())
596 const word& key = iter().keyword();
602 nameAndType[0] = key;
603 nameAndType[1] = wallName;
604 nameAndType[2] = cyclicName;
605 coupledAndPatches.append(nameAndType);
608 forAll(setsAndPatches, setI)
610 Info<<
"Faces in faceSet " << setsAndPatches[setI][0]
611 <<
" become baffles in patch " << setsAndPatches[setI][1]
615 forAll(coupledAndPatches, setI)
617 Info<<
"Faces in faceSet " << coupledAndPatches[setI][0]
618 <<
" become coupled baffles in patch " << coupledAndPatches[setI][1]
625 Info<<
"Faces that get exposed become boundary faces in patch "
626 << defaultPatch <<
endl;
630 Info<<
"Reading blocked cells from cellSet " << blockedSetName
641 forAll(setsAndPatches, setI)
645 label patchI = findPatch
648 setsAndPatches[setI][1]
653 if (wantedPatch[iter.key()] != -1)
656 <<
"Face " << iter.key()
657 <<
" is in faceSet " << setsAndPatches[setI][0]
658 <<
" destined for patch " << setsAndPatches[setI][1]
659 <<
" but also in patch " << wantedPatch[iter.key()]
662 wantedPatch[iter.key()] = patchI;
671 forAll(coupledAndPatches, setI)
674 const label cyclicId =
675 findPatch(
patches, coupledAndPatches[setI][2]);
677 const label cyclicSlaveId = findPatch
680 refCast<const cyclicFvPatch>
683 ).neighbFvPatch().name()
687 label patchI = findPatch(
patches, coupledAndPatches[setI][1]);
691 if (coupledWantedPatch[iter.key()] != -1)
694 <<
"Face " << iter.key()
695 <<
" is in faceSet " << coupledAndPatches[setI][0]
696 <<
" destined for patch " << coupledAndPatches[setI][1]
697 <<
" but also in patch " << coupledWantedPatch[iter.key()]
700 coupledWantedPatch[iter.key()] = patchI;
701 cyclicWantedPatch_half0[iter.key()] = cyclicId;
702 cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId;
742 cyclicWantedPatch_half0,
748 cyclicWantedPatch_half1,
759 iter()->headerClassName() == volScalarField::typeName
760 || iter()->headerClassName() == volVectorField::typeName
761 || iter()->headerClassName() == volSphericalTensorField::typeName
762 || iter()->headerClassName() == volTensorField::typeName
763 || iter()->headerClassName() == volSymmTensorField::typeName
764 || iter()->headerClassName() == surfaceScalarField::typeName
765 || iter()->headerClassName() == surfaceVectorField::typeName
766 || iter()->headerClassName()
767 == surfaceSphericalTensorField::typeName
768 || iter()->headerClassName() == surfaceSymmTensorField::typeName
769 || iter()->headerClassName() == surfaceTensorField::typeName
772 objects.add(*iter());
778 wordList scalarNames(objects.names(volScalarField::typeName));
786 volScalarField::typeName,
790 wordList vectorNames(objects.names(volVectorField::typeName));
798 volVectorField::typeName,
804 objects.names(volSphericalTensorField::typeName)
808 sphericalTensorNames.size()
816 volSphericalTensorField::typeName,
820 wordList symmTensorNames(objects.names(volSymmTensorField::typeName));
828 volSymmTensorField::typeName,
832 wordList tensorNames(objects.names(volTensorField::typeName));
840 volTensorField::typeName,
846 wordList surfScalarNames(objects.names(surfaceScalarField::typeName));
854 surfaceScalarField::typeName,
858 wordList surfVectorNames(objects.names(surfaceVectorField::typeName));
866 surfaceVectorField::typeName,
872 objects.names(surfaceSphericalTensorField::typeName)
876 surfSphericalTensorNames.size()
884 surfaceSphericalTensorField::typeName,
885 surfSphericalTensorFlds
890 objects.names(surfaceSymmTensorField::typeName)
895 surfSymmTensorNames.size()
904 surfaceSymmTensorField::typeName,
908 wordList surfTensorNames(objects.names(surfaceTensorField::typeName));
916 surfaceTensorField::typeName,
925 Info<<
"Writing mesh without blockedCells to time " << runTime.value()
931 scalarFlds[i].rename(scalarNames[i]);
936 vectorFlds[i].rename(vectorNames[i]);
939 forAll(sphericalTensorFlds, i)
941 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
946 symmTensorFlds[i].rename(symmTensorNames[i]);
951 tensorFlds[i].rename(tensorNames[i]);
958 surfScalarFlds[i].rename(surfScalarNames[i]);
963 surfVectorFlds[i].rename(surfVectorNames[i]);
966 forAll(surfSphericalTensorFlds, i)
968 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
971 forAll(surfSymmTensorFlds, i)
973 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
976 forAll(surfTensorNames, i)
978 surfTensorFlds[i].rename(surfTensorNames[i]);
1010 cyclicWantedPatch_half0,
1018 cyclicWantedPatch_half1,
1030 createCoupledBaffles
1039 createCyclicCoupledBaffles
1042 cyclicWantedPatch_half0,
1043 cyclicWantedPatch_half1,
1069 initCreatedPatches<volScalarField>
1075 initCreatedPatches<volVectorField>
1081 initCreatedPatches<volSphericalTensorField>
1087 initCreatedPatches<volSymmTensorField>
1093 initCreatedPatches<volTensorField>
1100 initCreatedPatches<surfaceScalarField>
1106 initCreatedPatches<surfaceVectorField>
1112 initCreatedPatches<surfaceSphericalTensorField>
1118 initCreatedPatches<surfaceSymmTensorField>
1124 initCreatedPatches<surfaceTensorField>
1133 if (map().hasMotionPoints())
1138 Info<<
"Writing mesh with split blockedFaces to time " << runTime.value()
1153 if (cellRegion.nRegions() > 1)
1156 <<
"Removing blocked faces and cells created "
1157 << cellRegion.nRegions()
1158 <<
" regions that are not connected via a face." <<
nl
1159 <<
" This is not supported in solvers." <<
nl
1160 <<
" Use" <<
nl <<
nl
1161 <<
" splitMeshRegions <root> <case> -largestOnly" <<
nl <<
nl
1162 <<
" to extract a single region of the mesh." <<
nl
1163 <<
" This mesh will be written to a new timedirectory"
1164 <<
" so might have to be moved back to constant/" <<
nl
1167 word startFrom(runTime.controlDict().lookup(
"startFrom"));
1169 if (startFrom !=
"latestTime")
1172 <<
"To run splitMeshRegions please set your"
1173 <<
" startFrom entry to latestTime" <<
endl;