From bdaca3a63f5b942c0a3e63d6baf7d71565d88233 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 Apr 2010 15:57:36 +0100 Subject: [PATCH] ENH: Store additional information to handle split cyclics (still not correct though) --- .../fvMeshDistribute/fvMeshDistribute.C | 615 ++++++++++++------ .../fvMeshDistribute/fvMeshDistribute.H | 24 +- 2 files changed, 451 insertions(+), 188 deletions(-) diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index de902fa436..9b7f372a05 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -30,6 +30,9 @@ License #include "faceCoupleInfo.H" #include "processorFvPatchField.H" #include "processorFvsPatchField.H" +#include "processorCyclicPolyPatch.H" +#include "processorCyclicFvPatchField.H" +#include "processorCyclicFvsPatchField.H" #include "polyTopoChange.H" #include "removeCells.H" #include "polyModifyFace.H" @@ -129,6 +132,7 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh) { Pout<< "Primitives:" << nl << " points :" << mesh.nPoints() << nl + << " bb :" << boundBox(mesh.points(), false) << nl << " internalFaces:" << mesh.nInternalFaces() << nl << " faces :" << mesh.nFaces() << nl << " cells :" << mesh.nCells() << nl; @@ -188,7 +192,8 @@ void Foam::fvMeshDistribute::printCoupleInfo const primitiveMesh& mesh, const labelList& sourceFace, const labelList& sourceProc, - const labelList& sourceNewProc + const labelList& sourcePatch, + const labelList& sourceNewNbrProc ) { Pout<< nl @@ -203,7 +208,7 @@ void Foam::fvMeshDistribute::printCoupleInfo << " fc:" << mesh.faceCentres()[meshFaceI] << " connects to proc:" << sourceProc[bFaceI] << "/face:" << sourceFace[bFaceI] - << " which will move to proc:" << sourceNewProc[bFaceI] + << " which will move to proc:" << sourceNewNbrProc[bFaceI] << endl; } } @@ -271,32 +276,87 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const } -// Appends processorPolyPatch. Returns patchID. -Foam::label Foam::fvMeshDistribute::addProcPatch -( - const word& patchName, - const label nbrProc -) +//// Appends processorPolyPatch. Returns patchID. +//Foam::label Foam::fvMeshDistribute::addProcPatch +//( +// const word& patchName, +// const label nbrProc +//) +//{ +// // Clear local fields and e.g. polyMesh globalMeshData. +// mesh_.clearOut(); +// +// +// polyBoundaryMesh& polyPatches = +// const_cast(mesh_.boundaryMesh()); +// fvBoundaryMesh& fvPatches = const_cast(mesh_.boundary()); +// +// if (polyPatches.findPatchID(patchName) != -1) +// { +// FatalErrorIn("fvMeshDistribute::addProcPatch(const word&, const label)") +// << "Cannot create patch " << patchName << " since already exists." +// << nl +// << "Current patch names:" << polyPatches.names() +// << exit(FatalError); +// } +// +// +// +// // Add the patch +// // ~~~~~~~~~~~~~ +// +// label sz = polyPatches.size(); +// +// // Add polyPatch +// polyPatches.setSize(sz+1); +// polyPatches.set +// ( +// sz, +// new processorPolyPatch +// ( +// patchName, +// 0, // size +// mesh_.nFaces(), +// sz, +// mesh_.boundaryMesh(), +// Pstream::myProcNo(), +// nbrProc +// ) +// ); +// fvPatches.setSize(sz+1); +// fvPatches.set +// ( +// sz, +// fvPatch::New +// ( +// polyPatches[sz], // point to newly added polyPatch +// mesh_.boundary() +// ) +// ); +// +// return sz; +//} + + +// Appends polyPatch. Returns patchID. +Foam::label Foam::fvMeshDistribute::addPatch(polyPatch* patchPtr) { // Clear local fields and e.g. polyMesh globalMeshData. mesh_.clearOut(); - polyBoundaryMesh& polyPatches = const_cast(mesh_.boundaryMesh()); fvBoundaryMesh& fvPatches = const_cast(mesh_.boundary()); - if (polyPatches.findPatchID(patchName) != -1) + if (polyPatches.findPatchID(patchPtr->name()) != -1) { - FatalErrorIn("fvMeshDistribute::addProcPatch(const word&, const label)") - << "Cannot create patch " << patchName << " since already exists." - << nl - << "Current patch names:" << polyPatches.names() - << exit(FatalError); + FatalErrorIn("fvMeshDistribute::addPatch(polyPatch*)") + << "Cannot create patch " << patchPtr->name() + << " since already exists." << nl + << "Current patch names:" << polyPatches.names() << exit(FatalError); } - // Add the patch // ~~~~~~~~~~~~~ @@ -304,20 +364,7 @@ Foam::label Foam::fvMeshDistribute::addProcPatch // Add polyPatch polyPatches.setSize(sz+1); - polyPatches.set - ( - sz, - new processorPolyPatch - ( - patchName, - 0, // size - mesh_.nFaces(), - sz, - mesh_.boundaryMesh(), - Pstream::myProcNo(), - nbrProc - ) - ); + polyPatches.set(sz, patchPtr); fvPatches.setSize(sz+1); fvPatches.set ( @@ -625,25 +672,27 @@ void Foam::fvMeshDistribute::getNeighbourData const labelList& distribution, labelList& sourceFace, labelList& sourceProc, - labelList& sourceNewProc + labelList& sourcePatch, + labelList& sourceNewNbrProc ) const { label nBnd = mesh_.nFaces() - mesh_.nInternalFaces(); sourceFace.setSize(nBnd); sourceProc.setSize(nBnd); - sourceNewProc.setSize(nBnd); + sourcePatch.setSize(nBnd); + sourceNewNbrProc.setSize(nBnd); const polyBoundaryMesh& patches = mesh_.boundaryMesh(); // Get neighbouring meshFace labels and new processor of coupled boundaries. labelList nbrFaces(nBnd, -1); - labelList nbrNewProc(nBnd, -1); + labelList nbrNewNbrProc(nBnd, -1); forAll(patches, patchI) { const polyPatch& pp = patches[patchI]; - if (isA(pp)) + if (pp.coupled()) { label offset = pp.start() - mesh_.nInternalFaces(); @@ -655,7 +704,7 @@ void Foam::fvMeshDistribute::getNeighbourData } // Which processor they will end up on - SubList