From 35395ea438d00aed567578d379b850b3f85d426c Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Nov 2011 15:15:06 +0000 Subject: [PATCH] BUG: cyclicAMI: differentiate between coupled geometry and coupled fields --- .../derived/coupled/coupledFacePointPatch.H | 12 ---------- .../polyPatches/polyPatch/polyPatch.H | 3 ++- .../cyclicAMI/cyclicAMIFvPatchField.C | 23 ++++++++++++++++++- .../cyclicAMI/cyclicAMIFvPatchField.H | 6 ++++- .../processor/processorFvPatchField.H | 2 +- .../cyclicAMI/cyclicAMIFvsPatchField.C | 23 +++++++++++++++++++ .../cyclicAMI/cyclicAMIFvsPatchField.H | 8 +++++++ .../leastSquaresGrad/leastSquaresVectors.C | 6 ++--- .../cellToFace/extendedCellToFaceStencil.C | 2 +- .../faceToCell/extendedFaceToCellStencil.C | 2 +- .../schemes/clippedLinear/clippedLinear.H | 2 +- .../schemes/reverseLinear/reverseLinear.H | 2 +- .../FacePostProcessing/FacePostProcessing.C | 2 +- .../cyclicAMIPointPatch/cyclicAMIPointPatch.H | 11 +++++++++ .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 17 -------------- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 10 ++++---- .../sampledSurface/isoSurface/isoSurface.C | 2 +- 17 files changed, 87 insertions(+), 46 deletions(-) diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H index 368782d0a3..91db5fc873 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H @@ -96,18 +96,6 @@ public: //- Destructor virtual ~coupledFacePointPatch(); - - - // Member Functions - - // Access - - //- Return true because this patch is coupled - virtual bool coupled() const - { - return true; - } - }; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index ceb6220585..5601c1e993 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -285,7 +285,8 @@ public: //- Return boundaryMesh reference const polyBoundaryMesh& boundaryMesh() const; - //- Return true if this patch field is coupled + //- Return true if this patch is geometrically coupled (i.e. faces and + // points correspondence) virtual bool coupled() const { return false; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 8e358063fa..31729346e2 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -106,7 +106,7 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField << exit(FatalIOError); } - if (cyclicAMIPatch_.coupled()) + if (this->coupled()) { this->evaluate(Pstream::blocking); } @@ -140,6 +140,27 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +bool Foam::cyclicAMIFvPatchField::coupled() const +{ + if + ( + Pstream::parRun() + || ( + this->cyclicAMIPatch_.size() + && this->cyclicAMIPatch_.cyclicAMIPatch().neighbPatch().size() + ) + ) + { + return true; + } + else + { + return false; + } +} + + template Foam::tmp > Foam::cyclicAMIFvPatchField::patchNeighbourField() const diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index 9a4e5f6b4c..2e05111cb6 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -147,8 +147,12 @@ public: // Evaluation functions + //- Return true if coupled. Note that the underlying patch + // is not coupled() - the points don't align. + virtual bool coupled() const; + //- Return neighbour coupled internal cell data - tmp > patchNeighbourField() const; + virtual tmp > patchNeighbourField() const; //- Return reference to neighbour patchField const cyclicAMIFvPatchField& neighbourPatchField() const; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index 7e3152e131..0130909d04 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -154,7 +154,7 @@ public: } //- Return neighbour field given internal field - tmp > patchNeighbourField() const; + virtual tmp > patchNeighbourField() const; // Evaluation functions diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C index a347bc4347..0ffe6b9c95 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C @@ -123,4 +123,27 @@ Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::cyclicAMIFvsPatchField::coupled() const +{ + if + ( + Pstream::parRun() + || ( + this->cyclicAMIPatch_.size() + && this->cyclicAMIPatch_.cyclicAMIPatch().neighbPatch().size() + ) + ) + { + return true; + } + else + { + return false; + } +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H index fe84983134..d55ff5cd5d 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H @@ -123,6 +123,14 @@ public: new cyclicAMIFvsPatchField(*this, iF) ); } + + // Member functions + + // Access + + //- Return true if running parallel + virtual bool coupled() const; + }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 6002a07e1c..27f5b72fcf 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -132,7 +132,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Build the d-vectors vectorField pd = p.delta(); - if (p.coupled()) + if (pw.coupled()) { forAll(pd, patchFacei) { @@ -185,7 +185,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Build the d-vectors vectorField pd = p.delta(); - if (p.coupled()) + if (pw.coupled()) { forAll(pd, patchFacei) { @@ -256,7 +256,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const label patchFacei = facei - mesh.boundaryMesh()[patchi].start(); - if (mesh.boundary()[patchi].coupled()) + if (w.boundaryField()[patchi].coupled()) { scalar wf = max ( diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C index 85c6f3f61f..021241fa27 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C @@ -103,7 +103,7 @@ Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh) forAll(patches, patchI) { - if (isA(patches[patchI])) + if (patches[patchI].coupled()) { const coupledPolyPatch& cpp = refCast(patches[patchI]); diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C index 0943d86685..4f364dc288 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C @@ -38,7 +38,7 @@ Foam::extendedFaceToCellStencil::extendedFaceToCellStencil(const polyMesh& mesh) forAll(patches, patchI) { - if (isA(patches[patchI])) + if (patches[patchI].coupled()) { const coupledPolyPatch& cpp = refCast(patches[patchI]); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H index 312a453c44..b69b2a05dc 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H @@ -157,7 +157,7 @@ public: forAll(mesh.boundary(), patchi) { - if (mesh.boundary()[patchi].coupled()) + if (clippedLinearWeights.boundaryField()[patchi].coupled()) { clippedLinearWeights.boundaryField()[patchi] = max diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H index 5dd8ee104a..3f3cae05fe 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H @@ -129,7 +129,7 @@ public: forAll(mesh.boundary(), patchI) { - if (mesh.boundary()[patchI].coupled()) + if (reverseLinearWeights.boundaryField()[patchI].coupled()) { reverseLinearWeights.boundaryField()[patchI] = 1.0 - cdWeights.boundaryField()[patchI]; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index 0f2a765ea8..36fb2aa035 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -316,7 +316,7 @@ Foam::FacePostProcessing::FacePostProcessing if ( - !pp.coupled() + !magSf.boundaryField()[patchI].coupled() || refCast(pp).owner() ) { diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H index 3ade3aeaef..78c69e0ad0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H @@ -107,6 +107,17 @@ public: //- Destructor virtual ~cyclicAMIPointPatch(); + + + // Member Functions + + //- Is patch 'coupled'. Note that on AMI the geometry is not + // coupled but the fields are! + virtual bool coupled() const + { + return false; + } + }; diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index b6769849f7..d281afc21f 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -548,23 +548,6 @@ Foam::cyclicAMIPolyPatch::~cyclicAMIPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::cyclicAMIPolyPatch::coupled() const -{ - if - ( - Pstream::parRun() - || (size() && neighbPatch().size()) - ) - { - return true; - } - else - { - return false; - } -} - - Foam::label Foam::cyclicAMIPolyPatch::neighbPatchID() const { if (nbrPatchID_ == -1) diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index ced7968171..9ced39571a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -254,10 +254,12 @@ public: // Access - //- Return true only if is coupled. Note that for non-parallel - // operation of a decomposed case this can return the wrong - // result - virtual bool coupled() const; + //- Is patch 'coupled'. Note that on AMI the geometry is not + // coupled but the fields are! + virtual bool coupled() const + { + return false; + } //- Neighbour patch name inline const word& neighbPatchName() const; diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index 81497e47a0..f96983d27a 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -1769,7 +1769,7 @@ Foam::isoSurface::isoSurface const polyPatch& pp = patches[patchI]; // Adapt separated coupled (proc and cyclic) patches - if (isA(pp)) + if (pp.coupled()) { fvPatchVectorField& pfld = const_cast (