cyclicACMI: Updated handling of magFaceAreas

Resolves bug-report https://bugs.openfoam.org/view.php?id=3502
This commit is contained in:
Henry Weller
2020-06-03 17:11:01 +01:00
parent 4250d7ce42
commit 6ef064984d
3 changed files with 18 additions and 9 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,28 +52,28 @@ void Foam::cyclicACMIFvPatch::updateAreas() const
// owner couple
const_cast<vectorField&>(Sf()) = patch().faceAreas();
const_cast<scalarField&>(magSf()) = mag(patch().faceAreas());
const_cast<scalarField&>(magSf()) = patch().magFaceAreas();
// owner non-overlapping
const fvPatch& nonOverlapPatch = nonOverlapFvPatch();
const_cast<vectorField&>(nonOverlapPatch.Sf()) =
nonOverlapPatch.patch().faceAreas();
const_cast<scalarField&>(nonOverlapPatch.magSf()) =
mag(nonOverlapPatch.patch().faceAreas());
nonOverlapPatch.patch().magFaceAreas();
// neighbour couple
const cyclicACMIFvPatch& nbrACMI = neighbFvPatch();
const_cast<vectorField&>(nbrACMI.Sf()) =
nbrACMI.patch().faceAreas();
const_cast<scalarField&>(nbrACMI.magSf()) =
mag(nbrACMI.patch().faceAreas());
nbrACMI.patch().magFaceAreas();
// neighbour non-overlapping
const fvPatch& nbrNonOverlapPatch = nbrACMI.nonOverlapFvPatch();
const_cast<vectorField&>(nbrNonOverlapPatch.Sf()) =
nbrNonOverlapPatch.patch().faceAreas();
const_cast<scalarField&>(nbrNonOverlapPatch.magSf()) =
mag(nbrNonOverlapPatch.patch().faceAreas());
nbrNonOverlapPatch.patch().magFaceAreas();
// set the updated flag
cyclicACMIPatch().setUpdated(false);

View File

@ -73,6 +73,7 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
// Trigger re-building of faceAreas
(void)boundaryMesh().mesh().faceAreas();
// Calculate the AMI using partial face-area-weighted. This leaves
// the weights as fractions of local areas (sum(weights) = 1 means
// face is fully covered)
@ -92,12 +93,16 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
if (srcMask_.size())
{
vectorField::subField Sf = faceAreas();
scalarField::subField magSf = magFaceAreas();
vectorField::subField noSf = nonOverlapPatch.faceAreas();
scalarField::subField noMagSf = nonOverlapPatch.magFaceAreas();
forAll(Sf, facei)
{
Sf[facei] *= srcMask_[facei];
magSf[facei] = mag(Sf[facei]);
noSf[facei] *= 1.0 - srcMask_[facei];
noMagSf[facei] = mag(noSf[facei]);
}
}
// Adapt slave side areas
@ -108,12 +113,16 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
const polyPatch& pp = cp.nonOverlapPatch();
vectorField::subField Sf = cp.faceAreas();
scalarField::subField magSf = cp.magFaceAreas();
vectorField::subField noSf = pp.faceAreas();
scalarField::subField noMagSf = pp.magFaceAreas();
forAll(Sf, facei)
{
Sf[facei] *= tgtMask_[facei];
magSf[facei] = mag(Sf[facei]);
noSf[facei] *= 1.0 - tgtMask_[facei];
noMagSf[facei] = mag(noSf[facei]);
}
}
@ -403,8 +412,8 @@ Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const
if (size() == noPp.size())
{
const scalarField magSf(mag(faceAreas()));
const scalarField noMagSf(mag(noPp.faceAreas()));
const scalarField magSf(magFaceAreas());
const scalarField noMagSf(noPp.magFaceAreas());
forAll(magSf, facei)
{

View File

@ -127,8 +127,8 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
// patch from its neighbour
label n = 0;
{
const scalarField thisMagAreas(mag(this->faceAreas()));
const scalarField nbrMagAreas(mag(nbrPatch().faceAreas()));
const scalarField thisMagAreas(this->magFaceAreas());
const scalarField nbrMagAreas(nbrPatch().magFaceAreas());
vector thisCentre =
gSum(this->faceCentres()*thisMagAreas)/gSum(thisMagAreas);