Added rebuild of surfaceVectorFields

This commit is contained in:
Hrvoje Jasak 2018-05-17 12:31:53 +01:00
parent 2a90c4f924
commit 4d3303023a
2 changed files with 38 additions and 3 deletions

View file

@ -125,7 +125,6 @@ public:
//- Construct from objectRegistry, and read/write options //- Construct from objectRegistry, and read/write options
explicit topoChangerFvMesh(const IOobject& io); explicit topoChangerFvMesh(const IOobject& io);
//- Construct from components without boundary. //- Construct from components without boundary.
// Boundary is added using addPatches() member function // Boundary is added using addPatches() member function
topoChangerFvMesh topoChangerFvMesh
@ -138,7 +137,6 @@ public:
const bool syncPar = true const bool syncPar = true
); );
//- Construct from components with cells rather than owner //- Construct from components with cells rather than owner
// and neighbour without boundary. // and neighbour without boundary.
// Boundary is added using addPatches() member function // Boundary is added using addPatches() member function

View file

@ -132,6 +132,9 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
HashTable<const surfaceScalarField*> surfaceScalarFields = HashTable<const surfaceScalarField*> surfaceScalarFields =
thisDb().lookupClass<surfaceScalarField>(); thisDb().lookupClass<surfaceScalarField>();
HashTable<const surfaceVectorField*> surfaceVectorFields =
thisDb().lookupClass<surfaceVectorField>();
//HJ, HERE: remove the fields that should not be load balanced //HJ, HERE: remove the fields that should not be load balanced
// Prepare fields for reconstruction // Prepare fields for reconstruction
@ -152,6 +155,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
surfaceScalarFields.size() surfaceScalarFields.size()
); );
List<PtrList<surfaceVectorField> > receivedSurfaceVectorFields
(
surfaceVectorFields.size()
);
forAll (receivedVolScalarFields, fieldI) forAll (receivedVolScalarFields, fieldI)
{ {
receivedVolScalarFields[fieldI].setSize(Pstream::nProcs()); receivedVolScalarFields[fieldI].setSize(Pstream::nProcs());
@ -167,6 +175,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
receivedSurfaceScalarFields[fieldI].setSize(Pstream::nProcs()); receivedSurfaceScalarFields[fieldI].setSize(Pstream::nProcs());
} }
forAll (receivedSurfaceVectorFields, fieldI)
{
receivedSurfaceVectorFields[fieldI].setSize(Pstream::nProcs());
}
for (label procI = 0; procI < meshDecomp.nProcs(); procI++) for (label procI = 0; procI < meshDecomp.nProcs(); procI++)
{ {
// Check if there is a mesh to send // Check if there is a mesh to send
@ -211,6 +224,7 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
sendFields(volScalarFields, fieldDecomposer, toProc); sendFields(volScalarFields, fieldDecomposer, toProc);
sendFields(volVectorFields, fieldDecomposer, toProc); sendFields(volVectorFields, fieldDecomposer, toProc);
sendFields(surfaceScalarFields, fieldDecomposer, toProc); sendFields(surfaceScalarFields, fieldDecomposer, toProc);
sendFields(surfaceVectorFields, fieldDecomposer, toProc);
} }
else else
{ {
@ -247,6 +261,13 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
fieldDecomposer, fieldDecomposer,
receivedSurfaceScalarFields receivedSurfaceScalarFields
); );
insertFields
(
surfaceVectorFields,
fieldDecomposer,
receivedSurfaceVectorFields
);
} }
} }
} }
@ -314,6 +335,14 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
procMeshes[procI], procMeshes[procI],
fromProc fromProc
); );
receiveFields
(
procI,
receivedSurfaceVectorFields,
procMeshes[procI],
fromProc
);
} }
} }
} }
@ -644,6 +673,14 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
meshMap meshMap
); );
rebuildFields
(
surfaceVectorFields,
fieldReconstructor,
receivedSurfaceVectorFields,
meshMap
);
// Debug // Debug
checkMesh(true); checkMesh(true);