diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2bd488e86..0ca245717 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -276,6 +276,7 @@ $(GAMGInterfaces)/processorGAMGInterface/processorGAMGInterface.C $(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C $(GAMGInterfaces)/ggiGAMGInterface/ggiGAMGInterface.C $(GAMGInterfaces)/cyclicGgiGAMGInterface/cyclicGgiGAMGInterface.C +$(GAMGInterfaces)/regionCoupleGAMGInterface/regionCoupleGAMGInterface.C /*$(GAMGInterfaces)/mixingPlaneGAMGInterface/mixingPlaneGAMGInterface.C*/ GAMGInterfaceFields = $(GAMG)/interfaceFields @@ -285,6 +286,7 @@ $(GAMGInterfaceFields)/processorGAMGInterfaceField/processorGAMGInterfaceField.C $(GAMGInterfaceFields)/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C $(GAMGInterfaceFields)/ggiGAMGInterfaceField/ggiGAMGInterfaceField.C $(GAMGInterfaceFields)/cyclicGgiGAMGInterfaceField/cyclicGgiGAMGInterfaceField.C +$(GAMGInterfaceFields)/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.C /*$(GAMGInterfaceFields)/mixingPlaneGAMGInterfaceField/mixingPlaneGAMGInterfaceField.C*/ GAMGAgglomerations = $(GAMG)/GAMGAgglomerations diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H index 07ad46219..5607ec377 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H @@ -84,6 +84,9 @@ public: // Access + //- Return true if interface is coupled + virtual bool coupled() const = 0; + //- Return faceCell addressing virtual const unallocLabelList& faceCells() const = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C index 47967a673..c003af797 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C @@ -217,11 +217,14 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing { if (fineInterfaces.set(inti)) { - fineInterfaces[inti].initInternalFieldTransfer - ( - Pstream::blocking, - restrictMap - ); + if (fineInterfaces[inti].coupled()) + { + fineInterfaces[inti].initInternalFieldTransfer + ( + Pstream::blocking, + restrictMap + ); + } } } @@ -233,18 +236,21 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing { if (fineInterfaces.set(inti)) { - fineInterfaceAddr.set - ( - inti, - new labelField + if (fineInterfaces[inti].coupled()) + { + fineInterfaceAddr.set ( - fineInterfaces[inti].internalFieldTransfer + inti, + new labelField ( - Pstream::blocking, - restrictMap + fineInterfaces[inti].internalFieldTransfer + ( + Pstream::blocking, + restrictMap + ) ) - ) - ); + ); + } } } @@ -279,19 +285,25 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing { if (fineInterfaces.set(inti)) { - coarseInterfaces.set - ( - inti, - GAMGInterface::New + if (fineInterfaces[inti].coupled()) + { + coarseInterfaces.set ( - meshLevels_[fineLevelIndex], - fineInterfaces[inti], - fineInterfaces[inti].interfaceInternalField(restrictMap), - fineInterfaceAddr[inti] - ).ptr() - ); + inti, + GAMGInterface::New + ( + meshLevels_[fineLevelIndex], + fineInterfaces[inti], + fineInterfaces[inti].interfaceInternalField + ( + restrictMap + ), + fineInterfaceAddr[inti] + ).ptr() + ); - coarseInterfaceAddr[inti] = coarseInterfaces[inti].faceCells(); + coarseInterfaceAddr[inti] = coarseInterfaces[inti].faceCells(); + } } } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.C new file mode 100644 index 000000000..2d2023020 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.C @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupleGAMGInterfaceField.H" +#include "addToRunTimeSelectionTable.H" +#include "lduMatrix.H" + +#include "OSspecific.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupleGAMGInterfaceField, 0); + addToRunTimeSelectionTable + ( + GAMGInterfaceField, + regionCoupleGAMGInterfaceField, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupleGAMGInterfaceField::regionCoupleGAMGInterfaceField +( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterface +) +: + ggiGAMGInterfaceField(GAMGCp, fineInterface), + regionCoupleInterface_(refCast(GAMGCp)) +{} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupleGAMGInterfaceField::~regionCoupleGAMGInterfaceField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionCoupleGAMGInterfaceField::initInterfaceMatrixUpdate +( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix& m, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const +{ + // This must have a reduce in it. HJ, 15/May/2009 + if (regionCoupleInterface_.coupled()) + { + ggiGAMGInterfaceField::initInterfaceMatrixUpdate + ( + psiInternal, + result, + m, + coeffs, + cmpt, + commsType + ); + } +} + + +void Foam::regionCoupleGAMGInterfaceField::updateInterfaceMatrix +( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix& m, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const +{ + // Get expanded data to zone size. No global reduce allowed + // HJ, 15/May/2009 + if (regionCoupleInterface_.coupled()) + { + ggiGAMGInterfaceField::updateInterfaceMatrix + ( + psiInternal, + result, + m, + coeffs, + cmpt, + commsType + ); + } +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.H new file mode 100644 index 000000000..65001e8f7 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.H @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::regionCoupleGAMGInterfaceField + +Description + GAMG agglomerated regionCouple interface field. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + regionCoupleGAMGInterfaceField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupleGAMGInterfaceField_H +#define regionCoupleGAMGInterfaceField_H + +#include "regionCoupleGAMGInterface.H" +#include "ggiGAMGInterfaceField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupleGAMGInterfaceField Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupleGAMGInterfaceField +: + public ggiGAMGInterfaceField +{ + // Private data + + //- Local reference cast into the regionCouple interface + const regionCoupleGAMGInterface& regionCoupleInterface_; + +public: + + //- Runtime type information + TypeName("regionCouple"); + + + // Constructors + + //- Construct from GAMG interface and fine level interface field + regionCoupleGAMGInterfaceField + ( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterfaceField + ); + + + // Destructor + + virtual ~regionCoupleGAMGInterfaceField(); + + + // Member Functions + + // Interface matrix update + + //- Initialise neighbour matrix update + virtual void initInterfaceMatrixUpdate + ( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix& m, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix&, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H index ac6a85d54..6307bd0d8 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H @@ -95,6 +95,15 @@ public: // Member Functions + // Access + + //- Return true if interface is coupled + virtual bool coupled() const + { + return true; + } + + // Interface transfer functions //- Transfer and return neighbour field diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/ggiGAMGInterface/ggiGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/ggiGAMGInterface/ggiGAMGInterface.H index 849ed021c..699f63965 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/ggiGAMGInterface/ggiGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/ggiGAMGInterface/ggiGAMGInterface.H @@ -138,6 +138,15 @@ public: // Member Functions + // Access + + //- Return true if interface is coupled + virtual bool coupled() const + { + return true; + } + + // Agglomeration //- Agglomerating the given fine-level coefficients and return diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H index 824678a9b..38f01d324 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H @@ -95,6 +95,15 @@ public: // Member Functions + // Access + + //- Return true if interface is coupled + virtual bool coupled() const + { + return true; + } + + // Interface transfer functions //- Initialise interface data transfer diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.C new file mode 100644 index 000000000..75f31952f --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupleGAMGInterface.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupleGAMGInterface, 0); + addToRunTimeSelectionTable + ( + GAMGInterface, + regionCoupleGAMGInterface, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupleGAMGInterface::regionCoupleGAMGInterface +( + const lduPrimitiveMesh& lduMesh, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing +) +: + ggiGAMGInterface + ( + lduMesh, + fineInterface, + localRestrictAddressing, + neighbourRestrictAddressing + ), + coupled_(fineInterface.coupled()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionCoupleGAMGInterface::~regionCoupleGAMGInterface() +{} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.H new file mode 100644 index 000000000..e8a34e319 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/regionCoupleGAMGInterface/regionCoupleGAMGInterface.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::regionCoupleGAMGInterface + +Description + GAMG agglomerated regionCouple interface. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + regionCoupleGAMGInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupleGAMGInterface_H +#define regionCoupleGAMGInterface_H + +#include "ggiGAMGInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupleGAMGInterface Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupleGAMGInterface +: + public ggiGAMGInterface +{ + + // Private data + + //- Is the interface coupled? + const bool coupled_; + + +public: + + //- Runtime type information + TypeName("regionCouple"); + + + // Constructors + + //- Construct from fine level interface, + // local and neighbour restrict addressing + regionCoupleGAMGInterface + ( + const lduPrimitiveMesh& lduMesh, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing + ); + + + // Destructor + + virtual ~regionCoupleGAMGInterface(); + + + // Member Functions + + // Access + + //- Return true if interface is coupled + virtual bool coupled() const + {Info<< "BANANA" << endl; + return coupled_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index cb69faba4..c4974ad8c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -156,7 +156,7 @@ public: // Access - //- Return true because this patch is coupled + //- Return true if patch is coupled virtual bool coupled() const { return true; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C index 87e20aabb..7e00ac500 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C @@ -85,8 +85,12 @@ void Foam::ggiPolyPatch::calcZoneAddressing() const // Check zone addressing if (zAddr.size() > 0 && min(zAddr) < 0) { + Info<< "myZone: " << myZone << nl + << "my start and size: " << start() << " and " << size() << nl + << "zAddr: " << zAddr << endl; + FatalErrorIn("void ggiPolyPatch::calcZoneAddressing() const") - << "Problem with patch-to zone addressing: some patch faces " + << "Problem with patch-to-zone addressing: some patch faces " << "not found in interpolation zone" << abort(FatalError); } @@ -439,6 +443,9 @@ void Foam::ggiPolyPatch::clearOut() { clearGeom(); + shadowIndex_ = -1; + zoneIndex_ = -1; + deleteDemandDrivenData(zoneAddressingPtr_); deleteDemandDrivenData(patchToPatchPtr_); deleteDemandDrivenData(localParallelPtr_); diff --git a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H index 1d42b8a68..33d25ec98 100644 --- a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H @@ -102,7 +102,7 @@ public: // Access - //- Return true because this patch is coupled + //- Return true if patch is coupled virtual bool coupled() const { return coupledPolyPatch_.coupled();