mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -69,6 +69,24 @@ void Foam::domainDecomposition::mark
|
||||
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
facesInstancePointsPtr_
|
||||
(
|
||||
pointsInstance() != facesInstance()
|
||||
? new pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
facesInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
*this,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
: NULL
|
||||
),
|
||||
decompositionDict_
|
||||
(
|
||||
IOobject
|
||||
@ -262,20 +280,65 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
"system",
|
||||
"constant"
|
||||
);
|
||||
processorDb.setTime(time());
|
||||
|
||||
// create the mesh
|
||||
polyMesh procMesh
|
||||
// create the mesh. Two situations:
|
||||
// - points and faces come from the same time ('instance'). The mesh
|
||||
// will get constructed in the same instance.
|
||||
// - 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
|
||||
(
|
||||
facesInstancePointsPtr_(),
|
||||
curPointLabels
|
||||
);
|
||||
|
||||
procMeshPtr.reset
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region name of undecomposed mesh
|
||||
pointsInstance(),
|
||||
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
|
||||
const labelList& curPatchSizes = procPatchSize_[procI];
|
||||
@ -584,6 +647,26 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
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
|
||||
<< "Processor " << procI << nl
|
||||
<< " Number of cells = " << procMesh.nCells()
|
||||
|
||||
@ -55,6 +55,9 @@ class domainDecomposition
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Optional: points at the facesInstance
|
||||
autoPtr<pointIOField> facesInstancePointsPtr_;
|
||||
|
||||
//- Mesh decomposition control dictionary
|
||||
IOdictionary decompositionDict_;
|
||||
|
||||
|
||||
@ -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 * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user