81 Info<<
"Reusing existing pointZone "
82 <<
mesh.pointZones()[zoneID].name()
83 <<
" at index " << zoneID <<
endl;
88 zoneID = pointZones.size();
89 Info<<
"Adding pointZone " <<
name <<
" at index " << zoneID <<
endl;
91 pointZones.setSize(zoneID+1);
114 Info<<
"Reusing existing faceZone " <<
mesh.faceZones()[zoneID].name()
115 <<
" at index " << zoneID <<
endl;
120 zoneID = faceZones.size();
121 Info<<
"Adding faceZone " <<
name <<
" at index " << zoneID <<
endl;
123 faceZones.setSize(zoneID+1);
147 Info<<
"Reusing existing cellZone " <<
mesh.cellZones()[zoneID].name()
148 <<
" at index " << zoneID <<
endl;
153 zoneID = cellZones.size();
154 Info<<
"Adding cellZone " <<
name <<
" at index " << zoneID <<
endl;
156 cellZones.setSize(zoneID+1);
174 void checkPatch(
const polyBoundaryMesh&
bMesh,
const word&
name)
181 <<
"Cannot find patch " <<
name <<
endl
182 <<
"It should be present and of non-zero size" <<
endl
183 <<
"Valid patches are " <<
bMesh.names()
187 if (
bMesh[patchI].empty())
190 <<
"Patch " <<
name <<
" is present but zero size"
197 int main(
int argc,
char *argv[])
201 "Merge the faces on the specified patches (if geometrically possible)\n"
202 "so the faces become internal.\n"
203 "Integral matching is used when the options -partial and -perfect are "
207 argList::noParallel();
211 argList::validArgs.append(
"masterPatch");
212 argList::validArgs.append(
"slavePatch");
214 argList::addBoolOption
217 "couple partially overlapping patches (optional)"
219 argList::addBoolOption
222 "couple perfectly aligned patches (optional)"
228 "dictionary file with tolerances"
233 runTime.functionObjects().off();
236 const word oldInstance =
mesh.pointsInstance();
238 const word masterPatchName =
args[1];
239 const word slavePatchName =
args[2];
245 if (partialCover && perfectCover)
248 <<
"Cannot supply both partial and perfect." <<
endl
249 <<
"Use perfect match option if the patches perfectly align"
250 <<
" (both vertex positions and face centres)" <<
endl
255 const word mergePatchName(masterPatchName + slavePatchName);
256 const word cutZoneName(mergePatchName +
"CutFaceZone");
258 slidingInterface::typeOfMatch tom = slidingInterface::INTEGRAL;
262 Info<<
"Coupling partially overlapping patches "
263 << masterPatchName <<
" and " << slavePatchName <<
nl
264 <<
"Resulting internal faces will be in faceZone " << cutZoneName
266 <<
"Any uncovered faces will remain in their patch"
269 tom = slidingInterface::PARTIAL;
271 else if (perfectCover)
273 Info<<
"Coupling perfectly aligned patches "
274 << masterPatchName <<
" and " << slavePatchName <<
nl
275 <<
"Resulting (internal) faces will be in faceZone " << cutZoneName
277 <<
"Note: both patches need to align perfectly." <<
nl
279 <<
" positions and the face centres need to align to within" <<
nl
280 <<
"a tolerance given by the minimum edge length on the patch"
285 Info<<
"Coupling patches " << masterPatchName <<
" and "
286 << slavePatchName <<
nl
287 <<
"Resulting (internal) faces will be in faceZone " << cutZoneName
289 <<
"Note: the overall area covered by both patches should be"
290 <<
" identical (\"integral\" interface)." <<
endl
291 <<
"If this is not the case use the -partial option" <<
nl <<
endl;
295 dictionary slidingTolerances;
298 IOdictionary toleranceFile
305 IOobject::MUST_READ_IF_MODIFIED,
309 slidingTolerances += toleranceFile;
313 checkPatch(
mesh.boundaryMesh(), masterPatchName);
314 checkPatch(
mesh.boundaryMesh(), slavePatchName);
319 const polyPatch& masterPatch =
mesh.boundaryMesh()[masterPatchName];
326 isf[i] = masterPatch.start() + i;
329 polyTopoChanger stitcher(
mesh);
332 mesh.pointZones().clearAddressing();
333 mesh.faceZones().clearAddressing();
334 mesh.cellZones().clearAddressing();
339 label cutZoneID = addFaceZone(
mesh, cutZoneName);
341 mesh.faceZones()[cutZoneID].resetAddressing
367 label masterZoneID = addFaceZone(
mesh, mergePatchName +
"MasterZone");
369 mesh.faceZones()[masterZoneID].resetAddressing
376 const polyPatch& slavePatch =
mesh.boundaryMesh()[slavePatchName];
382 osf[i] = slavePatch.start() + i;
385 label slaveZoneID = addFaceZone(
mesh, mergePatchName +
"SlaveZone");
386 mesh.faceZones()[slaveZoneID].resetAddressing
393 label cutZoneID = addFaceZone(
mesh, cutZoneName);
394 mesh.faceZones()[cutZoneID].resetAddressing
410 mergePatchName +
"MasterZone",
411 mergePatchName +
"SlaveZone",
412 mergePatchName +
"CutPointZone",
420 static_cast<slidingInterface&
>(stitcher[0]).setTolerances
429 IOobjectList objects(
mesh, runTime.timeName());
432 Info<<
"Reading all current volfields" <<
endl;
433 PtrList<volScalarField> volScalarFields;
436 PtrList<volVectorField> volVectorFields;
439 PtrList<volSphericalTensorField> volSphericalTensorFields;
442 PtrList<volSymmTensorField> volSymmTensorFields;
445 PtrList<volTensorField> volTensorFields;
465 autoPtr<mapPolyMesh> morphMap = stitcher.changeMesh(
true);
467 mesh.movePoints(morphMap->preMotionPoints());
472 mesh.setInstance(oldInstance);
473 stitcher.instance() = oldInstance;
475 Info<<
nl <<
"Writing polyMesh to time " << runTime.timeName() <<
endl;
477 IOstream::defaultPrecision(
max(10u, IOstream::defaultPrecision()));
482 !runTime.objectRegistry::writeObject
484 runTime.writeFormat(),
485 IOstream::currentVersion,
486 runTime.writeCompression()
491 <<
"Failed writing polyMesh."
495 mesh.faceZones().write();
496 mesh.pointZones().write();
497 mesh.cellZones().write();