From a5a15f29c596c0cb47f67d47beda21bc4fb3d9ca Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 22 May 2013 18:27:36 +0100 Subject: [PATCH 1/7] ENH: Moved cyclicAMI patches into cyclicAMI sub-folder --- .../cyclicAMILduInterface.C | 2 +- .../cyclicAMILduInterface.H | 2 +- .../cyclicAMILduInterfaceField.C | 2 +- .../cyclicAMILduInterfaceField.H | 2 +- .../cyclicAMIPointPatch/cyclicAMIPointPatch.C | 2 +- .../cyclicAMIPointPatch/cyclicAMIPointPatch.H | 2 +- .../cyclicAMIPointPatchField.C | 2 +- .../cyclicAMIPointPatchField.H | 2 +- .../cyclicAMIPointPatchFields.C | 2 +- .../cyclicAMIPointPatchFields.H | 2 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 11 +++++++---- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 12 ++++++++---- .../cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H | 2 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C | 2 +- 14 files changed, 27 insertions(+), 20 deletions(-) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMILduInterfaceField/cyclicAMILduInterface.C (95%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMILduInterfaceField/cyclicAMILduInterface.H (97%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C (96%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H (98%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatch/cyclicAMIPointPatch.C (97%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatch/cyclicAMIPointPatch.H (98%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C (98%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H (98%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C (95%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H (95%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C (99%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H (97%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H (96%) rename src/meshTools/AMIInterpolation/patches/{cyclic => cyclicAMI}/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C (97%) diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.C similarity index 95% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.C index 863013080f..19afeced63 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H similarity index 97% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H index 0bcbf3a4ef..55ecbf5514 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C similarity index 96% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C index 0752825b56..d3b5a52b6b 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H similarity index 98% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H index 533437df08..ad0a4e66ac 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C similarity index 97% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C index fec146018d..2b4e6b8ad3 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H similarity index 98% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H index 477892745e..3cbe4c29f6 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C similarity index 98% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C index 8aa29db5cb..1bf86bea35 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H similarity index 98% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 845ecb46a2..e9f9212eab 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C similarity index 95% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C index 56e1aef405..889d4f73a3 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H similarity index 95% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H index 0fb94a64c7..e85dfa4d3d 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C similarity index 99% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 0458dad9de..6632fdb6d2 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -232,7 +232,12 @@ void Foam::cyclicAMIPolyPatch::calcTransforms } -void Foam::cyclicAMIPolyPatch::resetAMI() const +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::cyclicAMIPolyPatch::resetAMI +( + const AMIPatchToPatchInterpolation::interpolationMethod& AMIMethod +) const { if (owner()) { @@ -283,7 +288,7 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const nbrPatch0, surfPtr(), faceAreaIntersect::tmMesh, - AMIPatchToPatchInterpolation::imFaceAreaWeight, + AMIMethod, AMIReverse_ ) ); @@ -301,8 +306,6 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs) { polyPatch::initGeometry(pBufs); diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H similarity index 97% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index 45aef51952..51a9c1dc0d 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,14 +108,18 @@ private: const vectorField& half1Areas ); - //- Reset the AMI interpolator - void resetAMI() const; - protected: // Protected Member Functions + //- Reset the AMI interpolator + virtual void resetAMI + ( + const AMIPatchToPatchInterpolation::interpolationMethod& AMIMethod = + AMIPatchToPatchInterpolation::imFaceAreaWeight + ) const; + //- Recalculate the transformation tensors virtual void calcTransforms(); diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H similarity index 96% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H index 6d726e9df7..66a273e0c7 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C similarity index 97% rename from src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C rename to src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C index bf4507ff8e..3c5fc6e027 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 8205da653a1b5d714311096dfa5c0573a8e39959 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 28 May 2013 12:31:47 +0100 Subject: [PATCH 2/7] ENH: AMI - added optional normailisation flag/function --- .../AMIMethod/AMIMethod/AMIMethod.C | 24 ++++++++++++------- .../AMIMethod/AMIMethod/AMIMethod.H | 3 +++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C index b5ab236b92..e6d15ccd77 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C @@ -241,17 +241,16 @@ Foam::label Foam::AMIMethod::findTargetFace pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea); - - if (debug) - { - Pout<< "Source point = " << srcPt << ", Sample point = " - << sample.hitPoint() << ", Sample index = " << sample.index() - << endl; - } - if (sample.hit()) { targetFaceI = sample.index(); + + if (debug) + { + Pout<< "Source point = " << srcPt << ", Sample point = " + << sample.hitPoint() << ", Sample index = " << sample.index() + << endl; + } } return targetFaceI; @@ -352,4 +351,13 @@ Foam::AMIMethod::~AMIMethod() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::AMIMethod::normalise() const +{ + return true; +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H index 7b6482b7c6..2a56a5645d 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H @@ -207,6 +207,9 @@ public: // Note: this should be empty for correct functioning inline const labelList& srcNonOverlap() const; + //- Flag to indicate that weights should be normalised + virtual bool normalise() const; + // Manipulation From 2f8f797134c979400661550840555062ad815ef2 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 28 May 2013 12:34:44 +0100 Subject: [PATCH 3/7] ENH: AMI - added new partialFaceAreaWeightAMI option --- .../AMIInterpolation/AMIInterpolation.C | 120 ++-- .../AMIInterpolation/AMIInterpolation.H | 4 +- .../partialFaceAreaWeightAMI.C | 542 ++++++++++++++++++ .../partialFaceAreaWeightAMI.H | 172 ++++++ .../AMIPatchToPatchInterpolation.C | 2 + 5 files changed, 790 insertions(+), 50 deletions(-) create mode 100644 src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C create mode 100644 src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 8bc8b86d2e..1be3be8dad 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -56,6 +56,11 @@ Foam::AMIInterpolation::interpolationMethodToWord method = "faceAreaWeightAMI"; break; } + case imPartialFaceAreaWeight: + { + method = "partialFaceAreaWeightAMI"; + break; + } default: { FatalErrorIn @@ -87,7 +92,15 @@ Foam::AMIInterpolation::wordTointerpolationMethod wordList methods ( - IStringStream("(directAMI mapNearestAMI faceAreaWeightAMI)")() + IStringStream + ( + "(" + "directAMI " + "mapNearestAMI " + "faceAreaWeightAMI " + "partialFaceAreaWeightAMI" + ")" + )() ); if (im == "directAMI") @@ -102,6 +115,10 @@ Foam::AMIInterpolation::wordTointerpolationMethod { method = imFaceAreaWeight; } + else if (im == "partialFaceAreaWeightAMI") + { + method = imPartialFaceAreaWeight; + } else { FatalErrorIn @@ -183,6 +200,7 @@ void Foam::AMIInterpolation::normaliseWeights const labelListList& addr, scalarListList& wght, scalarField& wghtSum, + const bool normalise, const bool output ) { @@ -191,12 +209,19 @@ void Foam::AMIInterpolation::normaliseWeights forAll(wght, faceI) { scalarList& w = wght[faceI]; + scalar denom = patchAreas[faceI]; + scalar s = sum(w); - scalar t = s/patchAreas[faceI]; + scalar t = s/denom; + + if (normalise) + { + denom = s; + } forAll(w, i) { - w[i] /= s; + w[i] /= denom; } wghtSum[faceI] = t; @@ -476,6 +501,7 @@ void Foam::AMIInterpolation::agglomerate srcAddress, srcWeights, srcWeightsSum, + true, false ); } @@ -749,7 +775,6 @@ void Foam::AMIInterpolation::update tgtMagSf_[faceI] = tgtPatch[faceI].mag(tgtPatch.points()); } - // Calculate if patches present on multiple processors singlePatchProc_ = calcDistribution(srcPatch, tgtPatch); @@ -794,32 +819,28 @@ void Foam::AMIInterpolation::update newTgtPoints ); - // calculate AMI interpolation - { - autoPtr > AMIPtr + autoPtr > AMIPtr + ( + AMIMethod::New ( - AMIMethod::New - ( - interpolationMethodToWord(method_), - srcPatch, - newTgtPatch, - srcMagSf_, - tgtMagSf_, - triMode_, - reverseTarget_ - ) - ); - - AMIPtr->calculate - ( - srcAddress_, - srcWeights_, - tgtAddress_, - tgtWeights_ - ); - } + interpolationMethodToWord(method_), + srcPatch, + newTgtPatch, + srcMagSf_, + tgtMagSf_, + triMode_, + reverseTarget_ + ) + ); + AMIPtr->calculate + ( + srcAddress_, + srcWeights_, + tgtAddress_, + tgtWeights_ + ); // Now // ~~~ @@ -886,6 +907,7 @@ void Foam::AMIInterpolation::update srcAddress_, srcWeights_, srcWeightsSum_, + AMIPtr->normalise(), true ); normaliseWeights @@ -895,6 +917,7 @@ void Foam::AMIInterpolation::update tgtAddress_, tgtWeights_, tgtWeightsSum_, + AMIPtr->normalise(), true ); @@ -903,7 +926,6 @@ void Foam::AMIInterpolation::update srcMapPtr_.reset(new mapDistribute(globalSrcFaces, tgtAddress_, cMap)); tgtMapPtr_.reset(new mapDistribute(globalTgtFaces, srcAddress_, cMap)); - if (debug) { writeFaceConnectivity(srcPatch, newTgtPatch, srcAddress_); @@ -913,29 +935,27 @@ void Foam::AMIInterpolation::update { // calculate AMI interpolation - { - autoPtr > AMIPtr + autoPtr > AMIPtr + ( + AMIMethod::New ( - AMIMethod::New - ( - interpolationMethodToWord(method_), - srcPatch, - tgtPatch, - srcMagSf_, - tgtMagSf_, - triMode_, - reverseTarget_ - ) - ); + interpolationMethodToWord(method_), + srcPatch, + tgtPatch, + srcMagSf_, + tgtMagSf_, + triMode_, + reverseTarget_ + ) + ); - AMIPtr->calculate - ( - srcAddress_, - srcWeights_, - tgtAddress_, - tgtWeights_ - ); - } + AMIPtr->calculate + ( + srcAddress_, + srcWeights_, + tgtAddress_, + tgtWeights_ + ); normaliseWeights ( @@ -944,6 +964,7 @@ void Foam::AMIInterpolation::update srcAddress_, srcWeights_, srcWeightsSum_, + AMIPtr->normalise(), true ); normaliseWeights @@ -953,6 +974,7 @@ void Foam::AMIInterpolation::update tgtAddress_, tgtWeights_, tgtWeightsSum_, + AMIPtr->normalise(), true ); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index e31eb91e1c..c9df62ee76 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -88,7 +88,8 @@ public: { imDirect, imMapNearest, - imFaceAreaWeight + imFaceAreaWeight, + imPartialFaceAreaWeight }; //- Convert interpolationMethod to word representation @@ -236,6 +237,7 @@ private: const labelListList& addr, scalarListList& wght, scalarField& wghtSum, + const bool normalise, const bool output ); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C new file mode 100644 index 0000000000..e4a44b925f --- /dev/null +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C @@ -0,0 +1,542 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "partialFaceAreaWeightAMI.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +bool Foam::partialFaceAreaWeightAMI::processSourceFace +( + const label srcFaceI, + const label tgtStartFaceI, + + // list of tgt face neighbour faces + DynamicList