diff --git a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H index 75c1d5ffe..ad4214c7f 100644 --- a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H +++ b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H @@ -125,7 +125,6 @@ public: //- Construct from objectRegistry, and read/write options explicit topoChangerFvMesh(const IOobject& io); - //- Construct from components without boundary. // Boundary is added using addPatches() member function topoChangerFvMesh @@ -138,7 +137,6 @@ public: const bool syncPar = true ); - //- Construct from components with cells rather than owner // and neighbour without boundary. // Boundary is added using addPatches() member function @@ -160,7 +158,7 @@ public: //- Load balance the mesh in parallel execution bool loadBalance(const dictionary& dict); - + //- Update the mesh for both mesh motion and topology change virtual bool update() = 0; }; diff --git a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C index ca7ec14bc..e335ff02d 100644 --- a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C +++ b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C @@ -132,6 +132,9 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) HashTable surfaceScalarFields = thisDb().lookupClass(); + HashTable surfaceVectorFields = + thisDb().lookupClass(); + //HJ, HERE: remove the fields that should not be load balanced // Prepare fields for reconstruction @@ -152,6 +155,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) surfaceScalarFields.size() ); + List > receivedSurfaceVectorFields + ( + surfaceVectorFields.size() + ); + forAll (receivedVolScalarFields, fieldI) { receivedVolScalarFields[fieldI].setSize(Pstream::nProcs()); @@ -167,6 +175,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) receivedSurfaceScalarFields[fieldI].setSize(Pstream::nProcs()); } + forAll (receivedSurfaceVectorFields, fieldI) + { + receivedSurfaceVectorFields[fieldI].setSize(Pstream::nProcs()); + } + for (label procI = 0; procI < meshDecomp.nProcs(); procI++) { // Check if there is a mesh to send @@ -211,6 +224,7 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) sendFields(volScalarFields, fieldDecomposer, toProc); sendFields(volVectorFields, fieldDecomposer, toProc); sendFields(surfaceScalarFields, fieldDecomposer, toProc); + sendFields(surfaceVectorFields, fieldDecomposer, toProc); } else { @@ -247,6 +261,13 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) fieldDecomposer, receivedSurfaceScalarFields ); + + insertFields + ( + surfaceVectorFields, + fieldDecomposer, + receivedSurfaceVectorFields + ); } } } @@ -314,6 +335,14 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) procMeshes[procI], fromProc ); + + receiveFields + ( + procI, + receivedSurfaceVectorFields, + procMeshes[procI], + fromProc + ); } } } @@ -644,6 +673,14 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) meshMap ); + rebuildFields + ( + surfaceVectorFields, + fieldReconstructor, + receivedSurfaceVectorFields, + meshMap + ); + // Debug checkMesh(true);