From bff9bb6f067b2a12fe7224c3522472a59be4f861 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Thu, 25 Aug 2011 10:53:52 +0100 Subject: [PATCH] ENH: Updates to AMI and tutorial --- src/AMIInterpolation/AMIInterpolation.C | 35 ++++++++-------- src/AMIInterpolation/AMIInterpolation.H | 4 -- .../mixerVesselAMI2D/system/decomposeParDict | 40 +++++++++++++++++++ .../mixerVesselAMI2D/system/fvSchemes | 7 +--- 4 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/decomposeParDict diff --git a/src/AMIInterpolation/AMIInterpolation.C b/src/AMIInterpolation/AMIInterpolation.C index 9bc928d69a7..485978cf6b3 100644 --- a/src/AMIInterpolation/AMIInterpolation.C +++ b/src/AMIInterpolation/AMIInterpolation.C @@ -275,8 +275,6 @@ distributeAndMergePatches tgtFaces.setSize(nFaces); tgtPoints.setSize(nPoints); - -//reduce(nFaces, sumOp<label>()); tgtFaceIDs.setSize(nFaces); nFaces = 0; @@ -1052,9 +1050,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights { scalar s = sum(wght[faceI]); wghtSum[faceI] = s; - - scalar t = 1; // s/patch[faceI].mag(patch.localPoints()); + scalar t = s/patch[faceI].mag(patch.points()); if (t < minBound) { minBound = t; @@ -1096,7 +1093,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation srcWeights_(), tgtAddress_(), tgtWeights_(), - tgtPatchSize_(tgtPatch.size()), startSeedI_(0), triMode_(triMode), projectPoints_(projectPoints), @@ -1146,8 +1142,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update globalIndex globalTgtFaces(tgtPatch.size()); // Create processor map of overlapping faces. This map gets - // (possibly remote) faces from the tgtPatch such that they together - // cover all of the srcPatch. + // (possibly remote) faces from the tgtPatch such that they (together) + // cover all of the srcPatch autoPtr<mapDistribute> mapPtr = calcProcMap(srcPatch, tgtPatch); const mapDistribute& map = mapPtr(); @@ -1161,7 +1157,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update labelList tgtFaceIDs; distributeAndMergePatches ( - map, tgtPatch, globalTgtFaces, newTgtFaces, newTgtPoints, tgtFaceIDs + map, + tgtPatch, + globalTgtFaces, + newTgtFaces, + newTgtPoints, + tgtFaceIDs ); primitivePatch @@ -1178,7 +1179,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update checkPatches(srcPatch, newTgtPatch); - // calculate AMI interpolation. + // calculate AMI interpolation calcAddressing(srcPatch, newTgtPatch, surf); // Now @@ -1212,7 +1213,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update } // send data back to originating procs. Note that contributions - // from different processors get added (ListPlusEqOp). + // from different processors get added (ListPlusEqOp) mapDistribute::distribute ( @@ -1239,8 +1240,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update ); // weights normalisation - normaliseWeights(srcPatch, "source", srcAddress_, srcWeights_, true); - normaliseWeights(tgtPatch, "target", tgtAddress_, tgtWeights_, true); + normaliseWeights(tgtPatch, "source", srcAddress_, srcWeights_, true); + normaliseWeights(srcPatch, "target", tgtAddress_, tgtWeights_, true); // cache maps and reset addresses List<Map<label> > cMap; @@ -1267,8 +1268,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update writeWeights(tgtWeights_, tgtPatch, "VTK", "target"); } - normaliseWeights(srcPatch, "source", srcAddress_, srcWeights_, true); - normaliseWeights(tgtPatch, "target", tgtAddress_, tgtWeights_, true); + normaliseWeights(tgtPatch, "source", srcAddress_, srcWeights_, true); + normaliseWeights(srcPatch, "target", tgtAddress_, tgtWeights_, true); } patchI++; @@ -1283,13 +1284,13 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource const Field<Type>& fld ) const { - if (fld.size() != tgtPatchSize_) + if (fld.size() != tgtAddress_.size()) { FatalErrorIn ( "AMIInterpolation::interpolateToSource(const Field<Type>) const" ) << "Supplied field size is not equal to target patch size. " - << "Target patch = " << tgtPatchSize_ << ", supplied field = " + << "Target patch = " << tgtAddress_.size() << ", supplied field = " << fld.size() << abort(FatalError); } @@ -1375,7 +1376,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget ( new Field<Type> ( - tgtPatchSize_, + tgtAddress_.size(), pTraits<Type>::zero ) ); diff --git a/src/AMIInterpolation/AMIInterpolation.H b/src/AMIInterpolation/AMIInterpolation.H index f9d72271241..4173362f542 100644 --- a/src/AMIInterpolation/AMIInterpolation.H +++ b/src/AMIInterpolation/AMIInterpolation.H @@ -122,10 +122,6 @@ class AMIInterpolation //- Weights of wource faces per target face scalarListList tgtWeights_; - //- Cache local size of target patch - // Note: size could be manipulated in parallel - label tgtPatchSize_; - //- Starting face seed index label startSeedI_; diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/decomposeParDict b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/decomposeParDict new file mode 100644 index 00000000000..c19a5c12d48 --- /dev/null +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/decomposeParDict @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +/* +preservePatches +( + AMI1 + AMI2 +); +*/ +numberOfSubdomains 4; + +method simple; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/fvSchemes index 82ae10e9a59..5e6c6725c51 100644 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/system/fvSchemes @@ -24,7 +24,6 @@ gradSchemes { default Gauss linear; grad(p) Gauss linear; -// grad(U) cellLimited Gauss linear 1; grad(U) Gauss linear 1; } @@ -37,8 +36,7 @@ divSchemes laplacianSchemes { -// default Gauss linear corrected; - default Gauss linear uncorrected; + default Gauss linear corrected; } interpolationSchemes @@ -49,8 +47,7 @@ interpolationSchemes snGradSchemes { -// default corrected; - default uncorrected; + default corrected; } fluxRequired -- GitLab