diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 8fa1c434b9..121c8c7244 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -585,18 +585,24 @@ void Foam::cellCellStencils::cellVolumeWeight::combineCellTypes case PATCH: { - if (allCellTypes[cellI] != HOLE) - { - scalar overlapVol = sum(weights[subCellI]); - scalar v = mesh_.V()[cellI]; - if (overlapVol < (1.0-overlapTolerance_)*v) - { - //Pout<< "** Patch overlap:" << cellI - // << " at:" << mesh_.cellCentres()[cellI] << endl; - allCellTypes[cellI] = HOLE; - validDonors = false; - } - } + // Patch-patch interaction... For now disable always + allCellTypes[cellI] = HOLE; + validDonors = false; + + // Alternative is to look at the amount of overlap but this + // is not very robust + //if (allCellTypes[cellI] != HOLE) + //{ + // scalar overlapVol = sum(weights[subCellI]); + // scalar v = mesh_.V()[cellI]; + // if (overlapVol < (1.0-overlapTolerance_)*v) + // { + // //Pout<< "** Patch overlap:" << cellI + // // << " at:" << mesh_.cellCentres()[cellI] << endl; + // allCellTypes[cellI] = HOLE; + // validDonors = false; + // } + //} } break; @@ -994,6 +1000,41 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() } + // Check previous iteration cellTypes_ for any hole->calculated changes + // If so set the cell either to interpolated (if there are donors) or + // holes (if there are no donors). Note that any interpolated cell might + // still be overwritten by the flood filling + { + label nCalculated = 0; + + forAll(cellTypes_, celli) + { + if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) + { + if (allStencil[celli].size() == 0) + { + // Reset to hole + allCellTypes[celli] = HOLE; + allWeights[celli].clear(); + allStencil[celli].clear(); + } + else + { + allCellTypes[celli] = INTERPOLATED; + nCalculated++; + } + } + } + + if (debug) + { + Pout<< "Detected " << nCalculated << " cells changing from hole" + << " to calculated. Changed these to interpolated" + << endl; + } + } + + // Mark unreachable bits findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); @@ -1022,40 +1063,6 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() tfld().write(); } - // Check previous iteration cellTypes_ for any hole->calculated changes - { - label nCalculated = 0; - - forAll(cellTypes_, celli) - { - if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) - { - if (allStencil[celli].size() == 0) - { - FatalErrorInFunction - << "Cell:" << celli - << " at:" << mesh_.cellCentres()[celli] - << " zone:" << zoneID[celli] - << " changed from hole to calculated" - << " but there is no donor" - << exit(FatalError); - } - else - { - allCellTypes[celli] = INTERPOLATED; - nCalculated++; - } - } - } - - if (debug) - { - Pout<< "Detected " << nCalculated << " cells changing from hole" - << " to calculated. Changed these to interpolated" - << endl; - } - } - // Normalise weights, Clear storage forAll(allCellTypes, cellI) { diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C index 1e019dab39..9bb6c6fef8 100644 --- a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C @@ -2048,6 +2048,41 @@ bool Foam::cellCellStencils::inverseDistance::update() tfld().write(); } + + // Check previous iteration cellTypes_ for any hole->calculated changes + // If so set the cell either to interpolated (if there are donors) or + // holes (if there are no donors). Note that any interpolated cell might + // still be overwritten by the flood filling + { + label nCalculated = 0; + + forAll(cellTypes_, celli) + { + if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) + { + if (allStencil[celli].size() == 0) + { + // Reset to hole + allCellTypes[celli] = HOLE; + allStencil[celli].clear(); + } + else + { + allCellTypes[celli] = INTERPOLATED; + nCalculated++; + } + } + } + + if (debug) + { + Pout<< "Detected " << nCalculated << " cells changing from hole" + << " to calculated. Changed to interpolated" + << endl; + } + } + + // Mark unreachable bits findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); @@ -2088,47 +2123,6 @@ bool Foam::cellCellStencils::inverseDistance::update() } - // Check previous iteration cellTypes_ for any hole->calculated changes - { - label nCalculated = 0; - - forAll(cellTypes_, celli) - { - if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) - { - if (allStencil[celli].size() == 0) - { - FatalErrorInFunction - //WarningInFunction - << "Cell:" << celli - << " at:" << mesh_.cellCentres()[celli] - << " zone:" << zoneID[celli] - << " changed from hole to calculated" - << " but there is no donor" - //<< endl; - << exit(FatalError); - } - else - { - //Pout<< "cell:" << mesh_.cellCentres()[celli] - // << " changed from hole to calculated" - // << " using donors:" << allStencil[celli] - // << endl; - allCellTypes[celli] = INTERPOLATED; - nCalculated++; - } - } - } - - if (debug) - { - Pout<< "Detected " << nCalculated << " cells changing from hole" - << " to calculated. Changed to interpolated" - << endl; - } - } - - // Convert cell-cell addressing to stencil in compact notation cellTypes_.transfer(allCellTypes); diff --git a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C index 96fb1a445c..db10a358c4 100644 --- a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C @@ -865,6 +865,40 @@ bool Foam::cellCellStencils::trackingInverseDistance::update() } + // Check previous iteration cellTypes_ for any hole->calculated changes + // If so set the cell either to interpolated (if there are donors) or + // holes (if there are no donors). Note that any interpolated cell might + // still be overwritten by the flood filling + { + label nCalculated = 0; + + forAll(cellTypes_, celli) + { + if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) + { + if (allStencil[celli].size() == 0) + { + // Reset to hole + allCellTypes[celli] = HOLE; + allStencil[celli].clear(); + } + else + { + allCellTypes[celli] = INTERPOLATED; + nCalculated++; + } + } + } + + if (debug) + { + Pout<< "Detected " << nCalculated << " cells changing from hole" + << " to calculated. Changed to interpolated" + << endl; + } + } + + // Mark unreachable bits findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes); DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl; @@ -893,47 +927,6 @@ bool Foam::cellCellStencils::trackingInverseDistance::update() } - // Check previous iteration cellTypes_ for any hole->calculated changes - { - label nCalculated = 0; - - forAll(cellTypes_, celli) - { - if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) - { - if (allStencil[celli].size() == 0) - { - FatalErrorInFunction - //WarningInFunction - << "Cell:" << celli - << " at:" << mesh_.cellCentres()[celli] - << " zone:" << zoneID[celli] - << " changed from hole to calculated" - << " but there is no donor" - //<< endl; - << exit(FatalError); - } - else - { - Pout<< "cell:" << mesh_.cellCentres()[celli] - << " changed from hole to calculated" - << " using donors:" << allStencil[celli] - << endl; - allCellTypes[celli] = INTERPOLATED; - nCalculated++; - } - } - } - - if (debug) - { - Pout<< "Detected " << nCalculated << " cells changing from hole" - << " to calculated. Changed to interpolated" - << endl; - } - } - - // Convert cell-cell addressing to stencil in compact notation cellTypes_.transfer(allCellTypes);