Skip to content
Snippets Groups Projects
Commit e44d0c27 authored by mattijs's avatar mattijs
Browse files

BUG: cyclicPeriodicAMI: incorrect faceCentres. See #2145

parent 827a27e9
No related branches found
No related tags found
No related merge requests found
...@@ -374,12 +374,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const ...@@ -374,12 +374,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
{ {
if (direction) if (direction)
{ {
// Note: primitive patch holds reference to external points so
// make sure to calculate stats before changing points
point oldAvg(Zero);
if (debug)
{
oldAvg = gAverage(thisPatch.points());
}
periodicPatch.transformPosition(thisPoints); periodicPatch.transformPosition(thisPoints);
DebugInFunction DebugInFunction
<< "patch:" << name() << "patch:" << name()
<< " moving this side from:" << " moving this side from:" << oldAvg
<< gAverage(thisPatch.points())
<< " to:" << gAverage(thisPoints) << endl; << " to:" << gAverage(thisPoints) << endl;
thisPatch.movePoints(thisPoints); thisPatch.movePoints(thisPoints);
...@@ -398,12 +405,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const ...@@ -398,12 +405,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
} }
else else
{ {
// Note: primitive patch holds reference to external points so
// make sure to calculate stats before changing points
point oldAvg(Zero);
if (debug)
{
oldAvg = gAverage(nbrPatch.points());
}
periodicPatch.transformPosition(nbrPoints); periodicPatch.transformPosition(nbrPoints);
DebugInFunction DebugInFunction
<< "patch:" << name() << "patch:" << name()
<< " moving neighbour side from:" << " moving neighbour side from:" << oldAvg
<< gAverage(nbrPatch.points())
<< " to:" << gAverage(nbrPoints) << endl; << " to:" << gAverage(nbrPoints) << endl;
nbrPatch.movePoints(nbrPoints); nbrPatch.movePoints(nbrPoints);
......
...@@ -54,11 +54,8 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate ...@@ -54,11 +54,8 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate
{ {
Pout<< "For patch " << this->name() Pout<< "For patch " << this->name()
<< " found periodic:" << pp.name() << " found periodic:" << pp.name()
//<< " own:" << pp.owner()
<< " rank:" << pTraits<Type>::rank << " rank:" << pTraits<Type>::rank
<< " parallel:" << pp.parallel() << " parallel:" << pp.parallel()
//<< " forwardT:" << pp.forwardT()
//<< " reverseT:" << pp.reverseT()
<< endl; << endl;
} }
...@@ -130,7 +127,7 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate ...@@ -130,7 +127,7 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate
if (debug&2) if (debug&2)
{ {
const pointField& nbrFc = nbrPp.faceCentres(); const vectorField::subField nbrFc(nbrPp.faceCentres());
Pout<< "On patch:" << this->name() Pout<< "On patch:" << this->name()
<< " size:" << this->size() << " size:" << this->size()
...@@ -147,17 +144,6 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate ...@@ -147,17 +144,6 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate
<< " cyli:" << localFld[i] << nl << " cyli:" << localFld[i] << nl
<< endl; << endl;
} }
if (defaultValues.size())
{
forAll(defaultValues, i)
{
Pout<< "Defaults At:" << nbrFc[i] << nl
<< " cart:" << defaultValues[i] << nl
<< " cyli:" << localDeflt[i] << nl
<< endl;
}
}
} }
...@@ -165,23 +151,15 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate ...@@ -165,23 +151,15 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate
auto tinterp = cyclicAMIPolyPatch::interpolate(localFld, localDeflt); auto tinterp = cyclicAMIPolyPatch::interpolate(localFld, localDeflt);
// Transform back. Result is now at *this // Transform back. Result is now at *this
List<Type> oldResult; const vectorField::subField fc(this->faceCentres());
if (debug&2) auto tresult = Foam::transform(cs.R(fc), tinterp);
{
oldResult = tinterp();
}
const pointField& fc = this->faceCentres();
tmp<tensorField> T(cs.R(fc));
auto tresult = Foam::transform(T, tinterp);
if (debug&2) if (debug&2)
{ {
const pointField& fc = this->faceCentres();
forAll(fc, i) forAll(fc, i)
{ {
Pout<< "Results: At local :" << fc[i] << nl Pout<< "Results: At local :" << fc[i] << nl
<< " cyli:" << oldResult[i] << nl << " cyli:" << tinterp()[i] << nl
<< " cart:" << tresult()[i] << nl << " cart:" << tresult()[i] << nl
<< endl; << endl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment