mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONTRIBUTION: overset: handling patch interactions. See #1288.
- in case of cell overlapping a patch : set cell to hole always - in case of cell changing from hole to calculated: set to hole and continue. Do so before 'flood filling' holes. Patch supplied by Nicolas Edh.
This commit is contained in:
@ -585,18 +585,24 @@ void Foam::cellCellStencils::cellVolumeWeight::combineCellTypes
|
|||||||
|
|
||||||
case PATCH:
|
case PATCH:
|
||||||
{
|
{
|
||||||
if (allCellTypes[cellI] != HOLE)
|
// Patch-patch interaction... For now disable always
|
||||||
{
|
allCellTypes[cellI] = HOLE;
|
||||||
scalar overlapVol = sum(weights[subCellI]);
|
validDonors = false;
|
||||||
scalar v = mesh_.V()[cellI];
|
|
||||||
if (overlapVol < (1.0-overlapTolerance_)*v)
|
// Alternative is to look at the amount of overlap but this
|
||||||
{
|
// is not very robust
|
||||||
//Pout<< "** Patch overlap:" << cellI
|
//if (allCellTypes[cellI] != HOLE)
|
||||||
// << " at:" << mesh_.cellCentres()[cellI] << endl;
|
//{
|
||||||
allCellTypes[cellI] = HOLE;
|
// scalar overlapVol = sum(weights[subCellI]);
|
||||||
validDonors = false;
|
// 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;
|
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
|
// Mark unreachable bits
|
||||||
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
|
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
|
||||||
|
|
||||||
@ -1022,40 +1063,6 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
|
|||||||
tfld().write();
|
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
|
// Normalise weights, Clear storage
|
||||||
forAll(allCellTypes, cellI)
|
forAll(allCellTypes, cellI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2048,6 +2048,41 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
tfld().write();
|
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
|
// Mark unreachable bits
|
||||||
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
|
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
|
// Convert cell-cell addressing to stencil in compact notation
|
||||||
|
|
||||||
cellTypes_.transfer(allCellTypes);
|
cellTypes_.transfer(allCellTypes);
|
||||||
|
|||||||
@ -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
|
// Mark unreachable bits
|
||||||
findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes);
|
findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes);
|
||||||
DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl;
|
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
|
// Convert cell-cell addressing to stencil in compact notation
|
||||||
|
|
||||||
cellTypes_.transfer(allCellTypes);
|
cellTypes_.transfer(allCellTypes);
|
||||||
|
|||||||
Reference in New Issue
Block a user