diff --git a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C index a7e652c6b8c93dfa4ebbab2831ac4755c9a08add..39bcdf70b4b40286485dffe253682d369f5659ea 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C @@ -374,12 +374,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const { 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); DebugInFunction << "patch:" << name() - << " moving this side from:" - << gAverage(thisPatch.points()) + << " moving this side from:" << oldAvg << " to:" << gAverage(thisPoints) << endl; thisPatch.movePoints(thisPoints); @@ -398,12 +405,19 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const } 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); DebugInFunction << "patch:" << name() - << " moving neighbour side from:" - << gAverage(nbrPatch.points()) + << " moving neighbour side from:" << oldAvg << " to:" << gAverage(nbrPoints) << endl; nbrPatch.movePoints(nbrPoints); diff --git a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatchTemplates.C index 05d286cb8b4b9372eb7e8d8f8e5cba9b5ffe97e4..2727656f31c551a35c989a0d40ccd6463c330918 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatchTemplates.C @@ -54,11 +54,8 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate { Pout<< "For patch " << this->name() << " found periodic:" << pp.name() - //<< " own:" << pp.owner() << " rank:" << pTraits<Type>::rank << " parallel:" << pp.parallel() - //<< " forwardT:" << pp.forwardT() - //<< " reverseT:" << pp.reverseT() << endl; } @@ -130,7 +127,7 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate if (debug&2) { - const pointField& nbrFc = nbrPp.faceCentres(); + const vectorField::subField nbrFc(nbrPp.faceCentres()); Pout<< "On patch:" << this->name() << " size:" << this->size() @@ -147,17 +144,6 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicPeriodicAMIPolyPatch::interpolate << " cyli:" << localFld[i] << nl << 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 auto tinterp = cyclicAMIPolyPatch::interpolate(localFld, localDeflt); // Transform back. Result is now at *this - List<Type> oldResult; - if (debug&2) - { - oldResult = tinterp(); - } - - const pointField& fc = this->faceCentres(); - tmp<tensorField> T(cs.R(fc)); - auto tresult = Foam::transform(T, tinterp); + const vectorField::subField fc(this->faceCentres()); + auto tresult = Foam::transform(cs.R(fc), tinterp); if (debug&2) { - const pointField& fc = this->faceCentres(); forAll(fc, i) { Pout<< "Results: At local :" << fc[i] << nl - << " cyli:" << oldResult[i] << nl + << " cyli:" << tinterp()[i] << nl << " cart:" << tresult()[i] << nl << endl; }