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",
|
"cellDist",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
|
mesh.dbDir(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
|
@ -914,7 +915,7 @@ int main(int argc, char *argv[])
|
||||||
"faBoundary",
|
"faBoundary",
|
||||||
mesh.time().findInstance
|
mesh.time().findInstance
|
||||||
(
|
(
|
||||||
mesh.dbDir()/polyMesh::meshSubDir,
|
mesh.meshDir(),
|
||||||
"boundary"
|
"boundary"
|
||||||
),
|
),
|
||||||
faMesh::meshSubDir,
|
faMesh::meshSubDir,
|
||||||
|
@ -989,12 +990,20 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
faMesh procMesh(procFvMesh);
|
faMesh procMesh(procFvMesh);
|
||||||
|
|
||||||
|
word faceLabelsInstance =
|
||||||
|
procMesh.time().findInstance
|
||||||
|
(
|
||||||
|
procMesh.meshDir(),
|
||||||
|
"faceLabels"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
labelIOList faceProcAddressing
|
labelIOList faceProcAddressing
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -1007,7 +1016,7 @@ int main(int argc, char *argv[])
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"boundaryProcAddressing",
|
"boundaryProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -1031,7 +1040,7 @@ int main(int argc, char *argv[])
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"edgeProcAddressing",
|
"edgeProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
|
|
@ -78,7 +78,7 @@ void faMeshDecomposition::distributeFaces()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
"constant",
|
procMesh.facesInstance(),
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procMesh,
|
procMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -94,7 +94,7 @@ void faMeshDecomposition::distributeFaces()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"owner",
|
"owner",
|
||||||
"constant",
|
procMesh.facesInstance(),
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procMesh,
|
procMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -127,7 +127,7 @@ void faMeshDecomposition::distributeFaces()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
"constant",
|
procMesh.facesInstance(),
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procMesh,
|
procMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -263,7 +263,7 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"pointProcAddressing",
|
"pointProcAddressing",
|
||||||
"constant",
|
procFvMesh.facesInstance(),
|
||||||
procFvMesh.meshSubDir,
|
procFvMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -279,7 +279,7 @@ void faMeshDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
"constant",
|
procFvMesh.facesInstance(),
|
||||||
procFvMesh.meshSubDir,
|
procFvMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -1202,7 +1202,7 @@ bool faMeshDecomposition::writeDecomposition()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"boundaryProcAddressing",
|
"boundaryProcAddressing",
|
||||||
"constant",
|
procFvMesh.facesInstance(),
|
||||||
procFvMesh.meshSubDir,
|
procFvMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
|
@ -1340,13 +1340,20 @@ bool faMeshDecomposition::writeDecomposition()
|
||||||
maxProcPatches = max(maxProcPatches, nProcPatches);
|
maxProcPatches = max(maxProcPatches, nProcPatches);
|
||||||
maxProcEdges = max(maxProcEdges, nProcEdges);
|
maxProcEdges = max(maxProcEdges, nProcEdges);
|
||||||
|
|
||||||
|
word faceLabelsInstance =
|
||||||
|
procMesh.time().findInstance
|
||||||
|
(
|
||||||
|
procMesh.meshDir(),
|
||||||
|
"faceLabels"
|
||||||
|
);
|
||||||
|
|
||||||
// create and write the addressing information
|
// create and write the addressing information
|
||||||
labelIOList pointProcAddressing
|
labelIOList pointProcAddressing
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"pointProcAddressing",
|
"pointProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
@ -1361,7 +1368,7 @@ bool faMeshDecomposition::writeDecomposition()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"edgeProcAddressing",
|
"edgeProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
@ -1376,7 +1383,7 @@ bool faMeshDecomposition::writeDecomposition()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
@ -1391,7 +1398,7 @@ bool faMeshDecomposition::writeDecomposition()
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"boundaryProcAddressing",
|
"boundaryProcAddressing",
|
||||||
"constant",
|
faceLabelsInstance,
|
||||||
procMesh.meshSubDir,
|
procMesh.meshSubDir,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
|
|
@ -157,6 +157,16 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||||
// Check if any new meshes need to be read.
|
// Check if any new meshes need to be read.
|
||||||
polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
|
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
|
// Combine into overall mesh change status
|
||||||
if (stat == polyMesh::UNCHANGED)
|
if (stat == polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
|
@ -196,8 +206,36 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||||
|
|
||||||
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
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
|
// 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)
|
forAll (meshes_, procI)
|
||||||
{
|
{
|
||||||
|
@ -225,8 +263,8 @@ void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
newPoints.write();
|
||||||
mesh.write();
|
mesh.readUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,16 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||||
// Check if any new meshes need to be read.
|
// Check if any new meshes need to be read.
|
||||||
polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
|
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
|
// Combine into overall mesh change status
|
||||||
if (stat == polyMesh::UNCHANGED)
|
if (stat == polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
|
@ -196,8 +206,36 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||||
|
|
||||||
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
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
|
// 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)
|
forAll (meshes_, procI)
|
||||||
{
|
{
|
||||||
|
@ -225,8 +263,8 @@ void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
newPoints.write();
|
||||||
mesh.write();
|
mesh.readUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ Foam::faMesh::faMesh(const polyMesh& pMesh)
|
||||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||||
boundary_.calcGeometry();
|
boundary_.calcGeometry();
|
||||||
|
|
||||||
if (isFile(pMesh.time().timePath()/"S0"))
|
if (isFile(pMesh.time().timePath()/pMesh.dbDir()/"S0"))
|
||||||
{
|
{
|
||||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
||||||
(
|
(
|
||||||
|
@ -808,7 +808,7 @@ Foam::faMesh::faMesh
|
||||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||||
boundary_.calcGeometry();
|
boundary_.calcGeometry();
|
||||||
|
|
||||||
if (isFile(mesh().time().timePath()/"S0"))
|
if (isFile(mesh().time().timePath()/mesh().dbDir()/"S0"))
|
||||||
{
|
{
|
||||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
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
|
// Check the existance of the cell volumes and read if present
|
||||||
// and set the storage of V00
|
// and set the storage of V00
|
||||||
if (isFile(time().timePath()/"V0"))
|
if (isFile(time().timePath()/polyMesh::dbDir()/"V0"))
|
||||||
{
|
{
|
||||||
if (debug)
|
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
|
// Check the existance of the mesh fluxes, read if present and set the
|
||||||
// mesh to be moving
|
// mesh to be moving
|
||||||
if (isFile(time().timePath()/"meshPhi"))
|
if (isFile(time().timePath()/polyMesh::dbDir()/"meshPhi"))
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue