Skip to content
Snippets Groups Projects
Commit 0e5c9356 authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

BUG: overset: out-of-range indexing. Fixes #1321

parent 5f9b6d7a
No related branches found
No related tags found
No related merge requests found
......@@ -106,13 +106,14 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
forAll(stencil, celli)
{
const labelList& nbrs = stencil[celli];
stencilPatches_[celli].setSize(nbrs.size(), -1);
stencilPatches_[celli].setSize(nbrs.size());
stencilPatches_[celli] = -1;
forAll(nbrs, nbri)
{
const label nbrCelli = nbrs[nbri];
if (stencilFaces_[celli][nbri] == -1)
{
const label nbrCelli = nbrs[nbri];
label globalNbr = globalCellIDs[nbrCelli];
label proci = globalNumbering.whichProcID(globalNbr);
label remoteCelli = globalNumbering.toLocal(proci, globalNbr);
......@@ -164,10 +165,12 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
{
if (proci < Pstream::myProcNo() && procOwner[proci].size())
{
//Pout<< "Adding interface " << nbri
// << " to receive my " << procOwner[proci]
// << " from " << proci << endl;
if (debug)
{
Pout<< "Adding interface " << nbri
<< " to receive my " << procOwner[proci].size()
<< " from " << proci << endl;
}
procToInterface[proci] = nbri;
remoteStencilInterfaces_.set
(
......@@ -184,9 +187,12 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
}
else if (proci > Pstream::myProcNo() && mySendCells[proci].size())
{
//Pout<< "Adding interface " << nbri
// << " to send my " << mySendCells[proci]
// << " to " << proci << endl;
if (debug)
{
Pout<< "Adding interface " << nbri
<< " to send my " << mySendCells[proci].size()
<< " to " << proci << endl;
}
remoteStencilInterfaces_.set
(
nbri++,
......@@ -205,9 +211,12 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
{
if (proci > Pstream::myProcNo() && procOwner[proci].size())
{
//Pout<< "Adding interface " << nbri
// << " to receive my " << procOwner[proci]
// << " from " << proci << endl;
if (debug)
{
Pout<< "Adding interface " << nbri
<< " to receive my " << procOwner[proci].size()
<< " from " << proci << endl;
}
procToInterface[proci] = nbri;
remoteStencilInterfaces_.set
(
......@@ -224,9 +233,12 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const
}
else if (proci < Pstream::myProcNo() && mySendCells[proci].size())
{
//Pout<< "Adding interface " << nbri
// << " to send my " << mySendCells[proci]
// << " to " << proci << endl;
if (debug)
{
Pout<< "Adding interface " << nbri
<< " to send my " << mySendCells[proci].size()
<< " to " << proci << endl;
}
remoteStencilInterfaces_.set
(
nbri++,
......@@ -634,28 +646,13 @@ bool Foam::dynamicOversetFvMesh::writeObject
const labelIOList& zoneID = overlap.zoneID();
const labelListList& cellStencil = overlap.cellStencil();
// Get remote zones
labelList donorZoneID(zoneID);
overlap.cellInterpolationMap().distribute(donorZoneID);
forAll(cellStencil, cellI)
{
const labelList& stencil = cellStencil[cellI];
if (stencil.size())
{
donorZoneID[cellI] = zoneID[stencil[0]];
for (label i = 1; i < stencil.size(); i++)
{
if (zoneID[stencil[i]] != donorZoneID[cellI])
{
WarningInFunction << "Mixed donor meshes for cell "
<< cellI << " at " << C()[cellI]
<< " donors:" << UIndirectList<point>(C(), stencil)
<< endl;
donorZoneID[cellI] = -2;
}
}
}
}
// Get remote cellCentres
pointField cc(C());
overlap.cellInterpolationMap().distribute(cc);
volScalarField volDonorZoneID
(
......@@ -672,9 +669,25 @@ bool Foam::dynamicOversetFvMesh::writeObject
dimensionedScalar("minOne", dimless, scalar(-1)),
zeroGradientFvPatchScalarField::typeName
);
forAll(donorZoneID, celli)
forAll(cellStencil, cellI)
{
volDonorZoneID[celli] = donorZoneID[celli];
const labelList& stencil = cellStencil[cellI];
if (stencil.size())
{
volDonorZoneID[cellI] = donorZoneID[stencil[0]];
for (label i = 1; i < stencil.size(); i++)
{
if (donorZoneID[stencil[i]] != volDonorZoneID[cellI])
{
WarningInFunction << "Mixed donor meshes for cell "
<< cellI << " at " << C()[cellI]
<< " donors:" << UIndirectList<point>(cc, stencil)
<< endl;
volDonorZoneID[cellI] = -2;
}
}
}
}
//- Do not correctBoundaryConditions since re-interpolates!
//volDonorZoneID.correctBoundaryConditions();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment