mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: cyclicACMI: change order of AMI initialisation
The resetAMI in the cyclicAMI would go up to cyclicACMI and do the initPatchFaceAreas again - but with already masked areas
This commit is contained in:
@ -44,7 +44,7 @@ const Foam::scalar Foam::cyclicACMIPolyPatch::tolerance_ = 1e-6;
|
|||||||
|
|
||||||
void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
|
void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
|
||||||
{
|
{
|
||||||
if (!empty() && faceAreas0_.empty())
|
if (!empty() && (faceAreas0_.empty() || boundaryMesh().mesh().moving()))
|
||||||
{
|
{
|
||||||
faceAreas0_ = faceAreas();
|
faceAreas0_ = faceAreas();
|
||||||
}
|
}
|
||||||
@ -52,9 +52,13 @@ void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
|
|||||||
const cyclicACMIPolyPatch& nbrACMI =
|
const cyclicACMIPolyPatch& nbrACMI =
|
||||||
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
|
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
|
||||||
|
|
||||||
if (!nbrACMI.empty() && nbrACMI.faceAreas0().empty())
|
if
|
||||||
|
(
|
||||||
|
!nbrACMI.empty()
|
||||||
|
&& (nbrACMI.faceAreas0().empty() || boundaryMesh().mesh().moving())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
nbrACMI.initPatchFaceAreas();
|
nbrACMI.faceAreas0_ = nbrACMI.faceAreas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,11 +140,13 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
|
|||||||
|
|
||||||
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||||
{
|
{
|
||||||
// Initialise the AMI so that base geometry (e.g. cell volumes) are
|
// Note: cyclicAMIPolyPatch clears AMI so do first
|
||||||
// correctly evaluated
|
|
||||||
resetAMI();
|
|
||||||
|
|
||||||
cyclicAMIPolyPatch::initGeometry(pBufs);
|
cyclicAMIPolyPatch::initGeometry(pBufs);
|
||||||
|
|
||||||
|
// Initialise the AMI so that base geometry (e.g. cell volumes) are
|
||||||
|
// correctly evaluated before e.g. any of the processor patches gets
|
||||||
|
// hit (since uses cell volumes in its initGeometry)
|
||||||
|
resetAMI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +162,13 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
|
|||||||
const pointField& p
|
const pointField& p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Note: cyclicAMIPolyPatch clears AMI so do first
|
||||||
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
|
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
|
||||||
|
|
||||||
|
// Initialise the AMI so that base geometry (e.g. cell volumes) are
|
||||||
|
// correctly evaluated before e.g. any of the processor patches gets
|
||||||
|
// hit (since uses cell volumes in its initGeometry)
|
||||||
|
resetAMI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,7 +37,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
|
|||||||
|
|
||||||
if (owner())
|
if (owner())
|
||||||
{
|
{
|
||||||
const scalarField& w = srcMask_;
|
const scalarField& w = AMI().srcWeightsSum();
|
||||||
|
|
||||||
tmp<Field<Type> > interpField(AMI().interpolateToSource(fldCouple));
|
tmp<Field<Type> > interpField(AMI().interpolateToSource(fldCouple));
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const scalarField& w = neighbPatch().tgtMask();
|
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
|
||||||
|
|
||||||
tmp<Field<Type> > interpField
|
tmp<Field<Type> > interpField
|
||||||
(
|
(
|
||||||
@ -82,16 +82,18 @@ void Foam::cyclicACMIPolyPatch::interpolate
|
|||||||
|
|
||||||
if (owner())
|
if (owner())
|
||||||
{
|
{
|
||||||
const scalarField& w = srcMask_;
|
const scalarField& w = AMI().srcWeightsSum();
|
||||||
|
|
||||||
AMI().interpolateToSource(fldCouple, cop, result);
|
AMI().interpolateToSource(fldCouple, cop, result);
|
||||||
|
|
||||||
result = result + (1.0 - w)*fldNonOverlap;
|
result = result + (1.0 - w)*fldNonOverlap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const scalarField& w = neighbPatch().tgtMask();
|
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
|
||||||
|
|
||||||
neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result);
|
neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result);
|
||||||
|
|
||||||
result = result + (1.0 - w)*fldNonOverlap;
|
result = result + (1.0 - w)*fldNonOverlap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,13 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cyclicAMIPolyPatch.H"
|
#include "cyclicAMIPolyPatch.H"
|
||||||
|
#include "transformField.H"
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "faceAreaIntersect.H"
|
||||||
|
#include "ops.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -172,18 +176,19 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
|||||||
scalar errorPos = mag(transformedAreaPos + area0);
|
scalar errorPos = mag(transformedAreaPos + area0);
|
||||||
scalar errorNeg = mag(transformedAreaNeg + area0);
|
scalar errorNeg = mag(transformedAreaNeg + area0);
|
||||||
|
|
||||||
if (errorPos < errorNeg)
|
scalar scaledErrorPos = errorPos/(mag(area0) + ROOTVSMALL);
|
||||||
{
|
scalar scaledErrorNeg = errorNeg/(mag(area0) + ROOTVSMALL);
|
||||||
revT = revTPos;
|
|
||||||
}
|
// One of the errors should be (close to) zero. If this is
|
||||||
else
|
// the reverse transformation flip the rotation angle.
|
||||||
|
revT = revTPos;
|
||||||
|
if (errorPos > errorNeg && scaledErrorNeg <= matchTolerance())
|
||||||
{
|
{
|
||||||
revT = revTNeg;
|
revT = revTNeg;
|
||||||
rotationAngle_ *= -1;
|
rotationAngle_ *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar areaError =
|
scalar areaError = min(scaledErrorPos, scaledErrorNeg);
|
||||||
min(errorPos, errorNeg)/(mag(area0) + ROOTVSMALL);
|
|
||||||
|
|
||||||
if (areaError > matchTolerance())
|
if (areaError > matchTolerance())
|
||||||
{
|
{
|
||||||
@ -406,6 +411,9 @@ void Foam::cyclicAMIPolyPatch::resetAMI
|
|||||||
|
|
||||||
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||||
{
|
{
|
||||||
|
// The AMI is no longer valid. Leave it up to demand-driven calculation
|
||||||
|
AMIPtr_.clear();
|
||||||
|
|
||||||
polyPatch::initGeometry(pBufs);
|
polyPatch::initGeometry(pBufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +439,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
|
|||||||
const pointField& p
|
const pointField& p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// The AMI is no longer valid. Leave it up to demand-driven calculation
|
||||||
|
AMIPtr_.clear();
|
||||||
|
|
||||||
polyPatch::initMovePoints(pBufs, p);
|
polyPatch::initMovePoints(pBufs, p);
|
||||||
|
|
||||||
// See below. Clear out any local geometry
|
// See below. Clear out any local geometry
|
||||||
@ -447,19 +458,15 @@ void Foam::cyclicAMIPolyPatch::movePoints
|
|||||||
polyPatch::movePoints(pBufs, p);
|
polyPatch::movePoints(pBufs, p);
|
||||||
|
|
||||||
calcTransforms();
|
calcTransforms();
|
||||||
|
|
||||||
// Note: resetAMI is called whilst in geometry update. So the slave
|
|
||||||
// side might not have reached 'movePoints'. Is explicitly handled by
|
|
||||||
// - clearing geometry of neighbour inside initMovePoints
|
|
||||||
// - not using localPoints() inside resetAMI
|
|
||||||
resetAMI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||||
{
|
{
|
||||||
polyPatch::initUpdateMesh(pBufs);
|
// The AMI is no longer valid. Leave it up to demand-driven calculation
|
||||||
AMIPtr_.clear();
|
AMIPtr_.clear();
|
||||||
|
|
||||||
|
polyPatch::initUpdateMesh(pBufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user