Bugfixes and improvements for parallel decomposition/reconstruction of regions
This commit is contained in:
parent
31c930c970
commit
1f6f708da8
6 changed files with 116 additions and 24 deletions
|
@ -284,6 +284,7 @@ int main(int argc, char *argv[])
|
|||
(
|
||||
"cellDist",
|
||||
runTime.timeName(),
|
||||
mesh.dbDir(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -914,7 +915,7 @@ int main(int argc, char *argv[])
|
|||
"faBoundary",
|
||||
mesh.time().findInstance
|
||||
(
|
||||
mesh.dbDir()/polyMesh::meshSubDir,
|
||||
mesh.meshDir(),
|
||||
"boundary"
|
||||
),
|
||||
faMesh::meshSubDir,
|
||||
|
@ -989,12 +990,20 @@ int main(int argc, char *argv[])
|
|||
|
||||
faMesh procMesh(procFvMesh);
|
||||
|
||||
word faceLabelsInstance =
|
||||
procMesh.time().findInstance
|
||||
(
|
||||
procMesh.meshDir(),
|
||||
"faceLabels"
|
||||
);
|
||||
|
||||
|
||||
labelIOList faceProcAddressing
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -1007,7 +1016,7 @@ int main(int argc, char *argv[])
|
|||
IOobject
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -1031,7 +1040,7 @@ int main(int argc, char *argv[])
|
|||
IOobject
|
||||
(
|
||||
"edgeProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
|
|
@ -78,7 +78,7 @@ void faMeshDecomposition::distributeFaces()
|
|||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
"constant",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -94,7 +94,7 @@ void faMeshDecomposition::distributeFaces()
|
|||
IOobject
|
||||
(
|
||||
"owner",
|
||||
"constant",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -127,7 +127,7 @@ void faMeshDecomposition::distributeFaces()
|
|||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
"constant",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -263,7 +263,7 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
"constant",
|
||||
procFvMesh.facesInstance(),
|
||||
procFvMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -279,7 +279,7 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
"constant",
|
||||
procFvMesh.facesInstance(),
|
||||
procFvMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -1202,7 +1202,7 @@ bool faMeshDecomposition::writeDecomposition()
|
|||
IOobject
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
"constant",
|
||||
procFvMesh.facesInstance(),
|
||||
procFvMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::MUST_READ,
|
||||
|
@ -1340,13 +1340,20 @@ bool faMeshDecomposition::writeDecomposition()
|
|||
maxProcPatches = max(maxProcPatches, nProcPatches);
|
||||
maxProcEdges = max(maxProcEdges, nProcEdges);
|
||||
|
||||
word faceLabelsInstance =
|
||||
procMesh.time().findInstance
|
||||
(
|
||||
procMesh.meshDir(),
|
||||
"faceLabels"
|
||||
);
|
||||
|
||||
// create and write the addressing information
|
||||
labelIOList pointProcAddressing
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::NO_READ,
|
||||
|
@ -1361,7 +1368,7 @@ bool faMeshDecomposition::writeDecomposition()
|
|||
IOobject
|
||||
(
|
||||
"edgeProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::NO_READ,
|
||||
|
@ -1376,7 +1383,7 @@ bool faMeshDecomposition::writeDecomposition()
|
|||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::NO_READ,
|
||||
|
@ -1391,7 +1398,7 @@ bool faMeshDecomposition::writeDecomposition()
|
|||
IOobject
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
"constant",
|
||||
faceLabelsInstance,
|
||||
procMesh.meshSubDir,
|
||||
procFvMesh,
|
||||
IOobject::NO_READ,
|
||||
|
|
|
@ -157,6 +157,16 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
|||
// Check if any new meshes need to be read.
|
||||
polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
|
||||
|
||||
// Force changed mesh if the processor mesh holds points. This is
|
||||
// essential for changed region meshes and if the current time is
|
||||
// equal to the initial time during construction.
|
||||
// Pascal Beckstein, 14/Jul/2016
|
||||
fileName timePath = meshes_[procI].time().timePath();
|
||||
if (isFile(timePath/meshes_[procI].meshDir()/"points"))
|
||||
{
|
||||
procStat = polyMesh::POINTS_MOVED;
|
||||
}
|
||||
|
||||
// Combine into overall mesh change status
|
||||
if (stat == polyMesh::UNCHANGED)
|
||||
{
|
||||
|
@ -196,8 +206,36 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
|||
|
||||
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
||||
{
|
||||
// We may not use
|
||||
// mesh.movePoints(newPoints);
|
||||
// mesh.write();
|
||||
// here, as this will fail for mesh regions containing
|
||||
// directMappedPolyPatches or
|
||||
// directMappedWallPolyPatches
|
||||
// and probably other region-coupled patches. E.g. for both above
|
||||
// mentioned directMapped patch types we have calls to
|
||||
// directMappedPatchBase::map()
|
||||
// in the corresponding initMovePoints(const pointField& p) member
|
||||
// function. This however involves parallel communication and it would
|
||||
// require all other connected regions to be already reconstructed and
|
||||
// registered during reconstruction of the current region!
|
||||
// Pascal Beckstein, 14/Jul/2016
|
||||
|
||||
// Create the new points
|
||||
vectorField newPoints(mesh.nPoints());
|
||||
pointIOField newPoints
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().timeName(),
|
||||
mesh.meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh.allPoints()
|
||||
);
|
||||
|
||||
forAll (meshes_, procI)
|
||||
{
|
||||
|
@ -225,8 +263,8 @@ void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
|||
}
|
||||
}
|
||||
|
||||
mesh.movePoints(newPoints);
|
||||
mesh.write();
|
||||
newPoints.write();
|
||||
mesh.readUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -157,6 +157,16 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
|||
// Check if any new meshes need to be read.
|
||||
polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
|
||||
|
||||
// Force changed mesh if the processor mesh holds points. This is
|
||||
// essential for changed region meshes and if the current time is
|
||||
// equal to the initial time during construction.
|
||||
// Pascal Beckstein, 14/Jul/2016
|
||||
fileName timePath = meshes_[procI].time().timePath();
|
||||
if (isFile(timePath/meshes_[procI].meshDir()/"points"))
|
||||
{
|
||||
procStat = polyMesh::POINTS_MOVED;
|
||||
}
|
||||
|
||||
// Combine into overall mesh change status
|
||||
if (stat == polyMesh::UNCHANGED)
|
||||
{
|
||||
|
@ -196,8 +206,36 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
|||
|
||||
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
||||
{
|
||||
// We may not use
|
||||
// mesh.movePoints(newPoints);
|
||||
// mesh.write();
|
||||
// here, as this will fail for mesh regions containing
|
||||
// directMappedPolyPatches or
|
||||
// directMappedWallPolyPatches
|
||||
// and probably other region-coupled patches. E.g. for both above
|
||||
// mentioned directMapped patch types we have calls to
|
||||
// directMappedPatchBase::map()
|
||||
// in the corresponding initMovePoints(const pointField& p) member
|
||||
// function. This however involves parallel communication and it would
|
||||
// require all other connected regions to be already reconstructed and
|
||||
// registered during reconstruction of the current region!
|
||||
// Pascal Beckstein, 14/Jul/2016
|
||||
|
||||
// Create the new points
|
||||
vectorField newPoints(mesh.nPoints());
|
||||
pointIOField newPoints
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().timeName(),
|
||||
mesh.meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh.allPoints()
|
||||
);
|
||||
|
||||
forAll (meshes_, procI)
|
||||
{
|
||||
|
@ -225,8 +263,8 @@ void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
|||
}
|
||||
}
|
||||
|
||||
mesh.movePoints(newPoints);
|
||||
mesh.write();
|
||||
newPoints.write();
|
||||
mesh.readUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ Foam::faMesh::faMesh(const polyMesh& pMesh)
|
|||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
if (isFile(pMesh.time().timePath()/"S0"))
|
||||
if (isFile(pMesh.time().timePath()/pMesh.dbDir()/"S0"))
|
||||
{
|
||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
||||
(
|
||||
|
@ -808,7 +808,7 @@ Foam::faMesh::faMesh
|
|||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
if (isFile(mesh().time().timePath()/"S0"))
|
||||
if (isFile(mesh().time().timePath()/mesh().dbDir()/"S0"))
|
||||
{
|
||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
||||
(
|
||||
|
|
|
@ -123,7 +123,7 @@ Foam::fvMesh::fvMesh(const IOobject& io)
|
|||
|
||||
// Check the existance of the cell volumes and read if present
|
||||
// and set the storage of V00
|
||||
if (isFile(time().timePath()/"V0"))
|
||||
if (isFile(time().timePath()/polyMesh::dbDir()/"V0"))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ Foam::fvMesh::fvMesh(const IOobject& io)
|
|||
|
||||
// Check the existance of the mesh fluxes, read if present and set the
|
||||
// mesh to be moving
|
||||
if (isFile(time().timePath()/"meshPhi"))
|
||||
if (isFile(time().timePath()/polyMesh::dbDir()/"meshPhi"))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
|
Reference in a new issue