Load balancing support, fvMesh
This commit is contained in:
parent
685151b9be
commit
942ecf88c1
6 changed files with 109 additions and 20 deletions
|
@ -27,33 +27,63 @@ License
|
|||
#include "fvBoundaryMesh.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void fvBoundaryMesh::addFvPatches()
|
||||
void Foam::fvBoundaryMesh::addFvPatches()
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
|
||||
|
||||
// Clear existing patches and resize the list
|
||||
clear();
|
||||
setSize(bMesh.size());
|
||||
|
||||
// Set boundary patches, using the patches added to the polyMesh
|
||||
// Bug fix. HJ, 1/Mar/2018
|
||||
fvPatchList& Patches = *this;
|
||||
|
||||
forAll(Patches, patchI)
|
||||
forAll (Patches, patchI)
|
||||
{
|
||||
Patches.set(patchI, fvPatch::New(bMesh[patchI], *this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvBoundaryMesh::resetFvPatches(const boolList& resetFvPatchFlag)
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
|
||||
|
||||
if (resetFvPatchFlag.size() != bMesh.size())
|
||||
{
|
||||
FatalErrorIn("void resetFvPatches(const boolList& resetFvPatchFlag)")
|
||||
<< "Incorrect size of reset list. Boundary size: "
|
||||
<< bMesh.size() << " reset size: " << resetFvPatchFlag.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Reset list size. This will delete pointers to patches
|
||||
// if the list is truncated
|
||||
setSize(bMesh.size());
|
||||
|
||||
// Set boundary patches, using the patches added to the polyMesh
|
||||
// Bug fix. HJ, 1/Mar/2018
|
||||
fvPatchList& Patches = *this;
|
||||
|
||||
// In order to preserve patch links on resize of boundary,
|
||||
// only reset the empty slots
|
||||
forAll (Patches, patchI)
|
||||
{
|
||||
if (resetFvPatchFlag[patchI])
|
||||
{
|
||||
// Set new patch. This also deletes old pointer
|
||||
Patches.set(patchI, fvPatch::New(bMesh[patchI], *this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fvBoundaryMesh::fvBoundaryMesh
|
||||
Foam::fvBoundaryMesh::fvBoundaryMesh
|
||||
(
|
||||
const fvMesh& m
|
||||
)
|
||||
|
@ -67,7 +97,7 @@ fvBoundaryMesh::fvBoundaryMesh
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fvBoundaryMesh::movePoints()
|
||||
void Foam::fvBoundaryMesh::movePoints()
|
||||
{
|
||||
forAll(*this, patchi)
|
||||
{
|
||||
|
@ -81,7 +111,7 @@ void fvBoundaryMesh::movePoints()
|
|||
}
|
||||
|
||||
|
||||
lduInterfacePtrsList fvBoundaryMesh::interfaces() const
|
||||
Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
|
||||
{
|
||||
lduInterfacePtrsList interfaces(size());
|
||||
|
||||
|
@ -101,15 +131,11 @@ lduInterfacePtrsList fvBoundaryMesh::interfaces() const
|
|||
}
|
||||
|
||||
|
||||
void fvBoundaryMesh::readUpdate()
|
||||
void Foam::fvBoundaryMesh::readUpdate()
|
||||
{
|
||||
clear();
|
||||
addFvPatches();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -73,6 +73,11 @@ private:
|
|||
//- Add fvPatches corresponding to the polyBoundaryMesh
|
||||
void addFvPatches();
|
||||
|
||||
//- Reset fvPatches corresponding to the polyBoundaryMesh
|
||||
// When the mesh is resized, the existing patches may be preserved
|
||||
// or reset depending on the resetFlag
|
||||
void resetFvPatches(const boolList& resetFvPatchFlag);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -392,13 +392,49 @@ void Foam::fvMesh::removeFvBoundary()
|
|||
|
||||
// Remove fvBoundaryMesh data first.
|
||||
boundary_.clear();
|
||||
boundary_.setSize(0);
|
||||
polyMesh::removeBoundary();
|
||||
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMesh::resetFvPrimitives
|
||||
(
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<labelList>& owner,
|
||||
const Xfer<labelList>& neighbour,
|
||||
const labelList& patchSizes,
|
||||
const labelList& patchStarts,
|
||||
const boolList& resetFvPatchFlag,
|
||||
const bool validBoundary
|
||||
)
|
||||
{
|
||||
// Reset polyMesh primitives
|
||||
polyMesh::resetPrimitives
|
||||
(
|
||||
points,
|
||||
faces,
|
||||
owner,
|
||||
neighbour,
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
validBoundary
|
||||
);
|
||||
|
||||
boundary_.resetFvPatches(resetFvPatchFlag);
|
||||
surfaceInterpolation::clearOut();
|
||||
clearGeomNotOldVol();
|
||||
|
||||
// Reset fvPatches? HJ, 16/Apr/2018
|
||||
|
||||
// Clear LDU
|
||||
clearAddressing();
|
||||
|
||||
// Clear cell volumes?
|
||||
}
|
||||
|
||||
|
||||
Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
|
||||
{
|
||||
if (debug)
|
||||
|
|
|
@ -360,6 +360,25 @@ public:
|
|||
// these fvPatches.
|
||||
void removeFvBoundary();
|
||||
|
||||
//- Reset mesh primitive data. Assumes all patch info correct
|
||||
// (so does e.g. parallel communication). If not, use
|
||||
// validBoundary = false
|
||||
// (still assumes patchStarts[0] = nInternalFaces and last
|
||||
// patch ends at nActiveFaces) and change patches with addPatches.
|
||||
// resetFvPatchFlag indicates which fvPatches will be rebuilt
|
||||
// if the flag is set to false, original patch is preserved
|
||||
void resetFvPrimitives
|
||||
(
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<labelList>& owner,
|
||||
const Xfer<labelList>& neighbour,
|
||||
const labelList& patchSizes,
|
||||
const labelList& patchStarts,
|
||||
const boolList& resetFvPatchFlag,
|
||||
const bool validBoundary = true
|
||||
);
|
||||
|
||||
//- Return cell face motion fluxes
|
||||
surfaceScalarField& setPhi();
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ void fvMesh::makeC() const
|
|||
*this,
|
||||
dimLength,
|
||||
cellCentres(),
|
||||
faceCentres()
|
||||
faceCentres(),
|
||||
false // Do not preserve couples in geometry fields
|
||||
);
|
||||
|
||||
// This piece of code is necessary for cyclic and cyclicGgi interfaces
|
||||
|
@ -231,7 +232,8 @@ void fvMesh::makeCf() const
|
|||
),
|
||||
*this,
|
||||
dimLength,
|
||||
faceCentres()
|
||||
faceCentres(),
|
||||
false // Do not preserve couples in geometry fields
|
||||
);
|
||||
|
||||
// Boundary update. Used in complex geometries, eg. immersed boundary
|
||||
|
|
|
@ -146,7 +146,8 @@ tmp<vectorField> fvPatch::Cn() const
|
|||
// Get reference to global cell centres
|
||||
// Bugfix: access cell centres from fvMesh data, not polyMesh.
|
||||
// HJ, 30/Nov/2017
|
||||
const vectorField& gcc = boundaryMesh().mesh().C().internalField();
|
||||
// const vectorField& gcc = boundaryMesh().mesh().C().internalField();
|
||||
const vectorField& gcc = boundaryMesh().mesh().cellCentres();
|
||||
|
||||
forAll (faceCells, faceI)
|
||||
{
|
||||
|
|
Reference in a new issue