BUG: meshes with differing pointsInstance and facesInstance were not decomposed correctly.

In case of differing pointsInstance and facesInstance it will
- read the points belonging to the facesInstance
- construct and write the mesh belonging to the facesInstance
  (so with the old, facesInstance, points)
- additionally write the current points to pointsInstance
This commit is contained in:
mattijs
2010-02-08 11:12:52 +00:00
parent dd2b8a8200
commit 379eac4f74
3 changed files with 125 additions and 13 deletions

View File

@ -69,6 +69,24 @@ void Foam::domainDecomposition::mark
Foam::domainDecomposition::domainDecomposition(const IOobject& io) Foam::domainDecomposition::domainDecomposition(const IOobject& io)
: :
fvMesh(io), fvMesh(io),
facesInstancePointsPtr_
(
pointsInstance() != facesInstance()
? new pointIOField
(
IOobject
(
"points",
facesInstance(),
polyMesh::meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
: NULL
),
decompositionDict_ decompositionDict_
( (
IOobject IOobject
@ -262,20 +280,65 @@ bool Foam::domainDecomposition::writeDecomposition()
"system", "system",
"constant" "constant"
); );
processorDb.setTime(time());
// create the mesh // create the mesh. Two situations:
polyMesh procMesh // - points and faces come from the same time ('instance'). The mesh
( // will get constructed in the same instance.
IOobject // - points come from a different time (moving mesh cases).
// It will read the points belonging to the faces instance and
// construct the procMesh with it which then gets handled as above.
// (so with 'old' geometry).
// Only at writing time will it additionally write the current
// points.
autoPtr<polyMesh> procMeshPtr;
if (facesInstancePointsPtr_.valid())
{
// Construct mesh from facesInstance.
pointField facesInstancePoints
( (
this->polyMesh::name(), // region name of undecomposed mesh facesInstancePointsPtr_(),
pointsInstance(), curPointLabels
processorDb );
),
xferMove(procPoints), procMeshPtr.reset
xferMove(procFaces), (
xferMove(procCells) new polyMesh
); (
IOobject
(
this->polyMesh::name(), // region of undecomposed mesh
facesInstance(),
processorDb
),
xferMove(facesInstancePoints),
xferMove(procFaces),
xferMove(procCells)
)
);
}
else
{
procMeshPtr.reset
(
new polyMesh
(
IOobject
(
this->polyMesh::name(), // region of undecomposed mesh
facesInstance(),
processorDb
),
xferMove(procPoints),
xferMove(procFaces),
xferMove(procCells)
)
);
}
polyMesh& procMesh = procMeshPtr();
// Create processor boundary patches // Create processor boundary patches
const labelList& curPatchSizes = procPatchSize_[procI]; const labelList& curPatchSizes = procPatchSize_[procI];
@ -584,6 +647,26 @@ bool Foam::domainDecomposition::writeDecomposition()
procMesh.write(); procMesh.write();
// Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid())
{
pointIOField pointsInstancePoints
(
IOobject
(
"points",
pointsInstance(),
polyMesh::meshSubDir,
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
xferMove(procPoints)
);
pointsInstancePoints.write();
}
Info<< endl Info<< endl
<< "Processor " << procI << nl << "Processor " << procI << nl
<< " Number of cells = " << procMesh.nCells() << " Number of cells = " << procMesh.nCells()

View File

@ -55,6 +55,9 @@ class domainDecomposition
{ {
// Private data // Private data
//- Optional: points at the facesInstance
autoPtr<pointIOField> facesInstancePointsPtr_;
//- Mesh decomposition control dictionary //- Mesh decomposition control dictionary
IOdictionary decompositionDict_; IOdictionary decompositionDict_;

View File

@ -61,7 +61,33 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver
) )
) )
) )
{} {
if (points0_.size() != mesh.nPoints())
{
FatalErrorIn
(
"displacementFvMotionSolver::displacementFvMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" Istream&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
<< " read from file "
<<
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
).filePath()
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //