Skip to content
Snippets Groups Projects
Commit 73cd7b29 authored by Andrew Heather's avatar Andrew Heather
Browse files

BUG: cyclicACMI - corrected ordering to achieve expected patch face area scaling. See #1953

parent b1272e38
Branches
Tags
1 merge request!419Fix cyclicACMI (runtime-selection-geometry, scaling-of-weights)
......@@ -899,6 +899,10 @@ public:
//- Clear geometry
void clearGeom();
//- Clear cell-based geometry only
// Use with care! currently used by cyclicACMI
void clearCellGeom();
//- Clear topological data
void clearAddressing();
......
......@@ -140,6 +140,20 @@ void Foam::primitiveMesh::clearGeom()
}
void Foam::primitiveMesh::clearCellGeom()
{
if (debug)
{
Pout<< "primitiveMesh::clearCellGeom() : "
<< "clearing cell centres and volumes"
<< endl;
}
deleteDemandDrivenData(cellCentresPtr_);
deleteDemandDrivenData(cellVolumesPtr_);
}
void Foam::primitiveMesh::clearAddressing()
{
if (debug)
......
......@@ -288,24 +288,27 @@ void Foam::cyclicACMIPolyPatch::resetAMI(const UList<point>& points) const
{
DebugPout
<< "cyclicACMIPolyPatch::resetAMI : clearing cellCentres"
<< " for " << name() << " and " << nonOverlapPatch.name()
<< endl;
WarningInFunction
<< "The mesh already has cellCentres calculated when"
<< " resetting ACMI " << name() << "." << nl
<< "This is a problem since ACMI adapts the face areas"
<< " (to close cells) so this has" << nl
<< "to be done before cell centre calculation." << nl
<< "This can happen if e.g. the cyclicACMI is after"
<< " any processor patches in the boundary." << endl;
const_cast<polyMesh&>(mesh).primitiveMesh::clearGeom();
<< " for " << name() << " and " << nonOverlapPatch.name() << nl
<< "The mesh already has cellCentres calculated when"
<< " resetting ACMI " << name() << "." << nl
<< "This is a problem since ACMI adapts the face areas"
<< " (to close cells) so this has" << nl
<< "to be done before cell centre calculation." << nl
<< "This can happen if e.g. the cyclicACMI is after"
<< " any processor patches in the boundary." << endl;
const_cast<polyMesh&>(mesh).primitiveMesh::clearCellGeom();
}
// Trigger re-building of faceAreas
(void)mesh.faceAreas();
// At this point we want face geometry but not cell geometry since we want
// correct the face area on duplicate baffles before calculating the cell
// centres and volumes.
if (!mesh.hasFaceAreas())
{
FatalErrorInFunction
<< "primitiveMesh must already have face geometry"
<< abort(FatalError);
}
// Calculate the AMI using partial face-area-weighted. This leaves
// the weights as fractions of local areas (sum(weights) = 1 means
......@@ -423,9 +426,13 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
DebugPout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl;
// Note: calculates transformation and triggers face centre calculation
// - Note: resetAMI called by cyclicAMIPolyPatch::initMovePoints
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
if (!createAMIFaces_ && canResetAMI())
{
resetAMI();
}
scalePatchFaceAreas();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment