From 3c0fef819b68b767b5b0cff1b218b9ff4c8e7b89 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 6 Oct 2021 11:04:10 +0100 Subject: [PATCH] BUG: cyclicAMI: defaultValues are on *this. Fixes #2226. --- .../cyclicAMIPolyPatchTemplates.C | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C index e5230eb628..6b8abe0a23 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C @@ -92,20 +92,11 @@ Foam::tmp> Foam::cyclicAMIPolyPatch::interpolate auto tlocalFld(tmp>::New(fld.size())); Field& localFld = tlocalFld.ref(); - List localDeflt(defaultValues.size()); // Transform to cylindrical coords { tmp nbrT(cs().R(nbrPp.faceCentres())); localFld = Foam::invTransform(nbrT(), fld); - if (defaultValues.size() == fld.size()) - { - // We get in UList (why? Copied from cyclicAMI). Convert to - // Field so we can use transformField routines. - const SubField defaultSubFld(defaultValues); - const Field& defaultFld(defaultSubFld); - localDeflt = Foam::invTransform(nbrT, defaultFld); - } } if (debug&2) @@ -129,13 +120,26 @@ Foam::tmp> Foam::cyclicAMIPolyPatch::interpolate } } - const vectorField::subField fc(this->faceCentres()); + + const tmp T(cs().R(this->faceCentres())); + + List localDeflt(defaultValues.size()); + if (defaultValues.size() == size()) + { + // Transform default values into cylindrical coords (using + // *this faceCentres) + // We get in UList (why? Copied from cyclicAMI). Convert to + // Field so we can use transformField routines. + const SubField defaultSubFld(defaultValues); + const Field& defaultFld(defaultSubFld); + localDeflt = Foam::invTransform(T(), defaultFld); + } // Do the actual interpolation and interpolate back to cartesian // coords return Foam::transform ( - cs().R(fc), + T, interpolateUntransformed(localFld, localDeflt) ); }