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
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

View file

@ -132,6 +132,9 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict)
HashTable<const surfaceScalarField*> surfaceScalarFields =
thisDb().lookupClass<surfaceScalarField>();
HashTable<const surfaceVectorField*> surfaceVectorFields =
thisDb().lookupClass<surfaceVectorField>();
//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<PtrList<surfaceVectorField> > 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);