diff --git a/src/Allwmake b/src/Allwmake index 94afb0d9855672992449aaf02e4080bdbf440fd5..1809dad242f81265570e653f2b9f9c59a730eea5 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -61,6 +61,8 @@ wmake $makeType topoChangerFvMesh wmake $makeType ODE wmake $makeType randomProcesses +# ThermophysicalModels needs regionCoupled +wmakeLnInclude regionCoupled thermophysicalModels/Allwmake $* transportModels/Allwmake $* turbulenceModels/Allwmake $* @@ -76,6 +78,8 @@ wmake $makeType engine wmake $makeType fieldSources +wmake $makeType regionCoupled + postProcessing/Allwmake $* # ----------------------------------------------------------------- end-of-file 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 94e5073fa338e982bf12aa4f7d7f6b624c9d8af2..725433247ccb515452f431cd23307a85526f75b1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C @@ -258,7 +258,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing ( Pstream::nonBlocking, restrictMap - ) + ), + fineLevelIndex ).ptr() ); diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H index ed6c7ca7468009f6849e67e6e5ce173378287585..69ed4414043c5bcb6c141a453f43b1cb3048d570 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H @@ -38,6 +38,7 @@ SourceFiles #include "autoPtr.H" #include "lduInterfacePtrsList.H" +#include "GAMGAgglomeration.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -99,14 +100,16 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ), ( index, coarseInterfaces, fineInterface, localRestrictAddressing, - neighbourRestrictAddressing + neighbourRestrictAddressing, + fineLevelIndex ) ); @@ -121,7 +124,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ); @@ -135,7 +139,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface&, const labelField&, - const labelField& + const labelField&, + const label fineLevelIndex = -1 ) : index_(index), diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceNew.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceNew.C index 48bc4320b1aff102c1ef1b7dfdd7c55ca8b6c89e..faeaada1cca8053e3ce89768310a4f71587be27d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceNew.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceNew.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "GAMGInterface.H" +#include "GAMGAgglomeration.H" #include "lduMatrix.H" @@ -35,7 +36,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ) { const word coupleType(fineInterface.type()); @@ -65,7 +67,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New coarseInterfaces, fineInterface, localRestrictAddressing, - neighbourRestrictAddressing + neighbourRestrictAddressing, + fineLevelIndex ) ); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C index 39038f5f299e9bc411ffeddf41ecc760ce7e997f..cab5661f8e579b96d824ff6c9e3c07fbdc5b45ba 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C @@ -50,7 +50,8 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ) : GAMGInterface 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 aa83d23ff8facc3f8e53d22213c4d554022098c4..5a8255212c3b32b0fcbe660bf973bde5a4b71739 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.H @@ -84,7 +84,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& restrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ); diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C index 88ee47cd1735f4a3538f9ea38c8d9152628a1626..45db4356f95c54167344eaeba04cfd6f1e7fdf78 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C @@ -49,7 +49,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ) : processorGAMGInterface @@ -58,7 +59,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface coarseInterfaces, fineInterface, localRestrictAddressing, - neighbourRestrictAddressing + neighbourRestrictAddressing, + fineLevelIndex ) {} diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.H index 95a6957335dfc686a7f5e958e185f62a3ad1feee..e53b11cc0410be27bba7fc842b834c02e4e1e68b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.H @@ -75,7 +75,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& restrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ); diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C index e5e640f6f810380215419bf6de4a5ce1b928a7af..45d0dc4bfcb7b781710b799f3066d9e310c20686 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.C @@ -50,7 +50,8 @@ Foam::processorGAMGInterface::processorGAMGInterface const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ) : GAMGInterface 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 ee2a0eaf678f0141b321f626556db0e7cbdc1a9d..8ef90c74fe15d4150a6986a7b4124e5bab112687 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H @@ -84,7 +84,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& restrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ); diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index eee3fd6894de4f6bde53846973c0a223103a5eea..0c6e9fa2c7a14d23d7fd242892102e0d849a142d 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -30,6 +30,10 @@ derivedFvPatches = $(fvPatches)/derived $(derivedFvPatches)/wall/wallFvPatch.C $(derivedFvPatches)/mapped/mappedFvPatch.C $(derivedFvPatches)/mapped/mappedWallFvPatch.C +$(derivedFvPatches)/regionCoupled/regionCoupledBaseFvPatch.C +$(derivedFvPatches)/regionCoupled/regionCoupledFvPatch.C +$(derivedFvPatches)/regionCoupled/regionCoupledWallFvPatch.C + wallDist = fvMesh/wallDist $(wallDist)/wallPointYPlus/wallPointYPlus.C diff --git a/src/finiteVolume/Make/options b/src/finiteVolume/Make/options index b91061399ee1cebe26a7b6f122b5231e7f7ff7e3..1c1990e5f3e5f624194a3d86a9cd7f3f30ce2aca 100644 --- a/src/finiteVolume/Make/options +++ b/src/finiteVolume/Make/options @@ -1,6 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ LIB_LIBS = \ -lOpenFOAM \ diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C index 7d07ca649fd99962ffb481d85a0ae7b232351276..dfb73c3607e8f97b48995c405dad69e9213e0eec 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C @@ -40,6 +40,7 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New "const fvPatch&, const DimensionedField<Type, volMesh>&) :" " patchFieldType=" << patchFieldType + << " : " << p.type() << endl; } @@ -50,7 +51,7 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New { FatalErrorIn ( - "fvPatchField<Type>::New(const word&, const word&, const fvPatch&, " + "fvPatchField<Type>::New(const word&, const word&, const fvPatch&," "const DimensionedField<Type, volMesh>&)" ) << "Unknown patchField type " << patchFieldType << nl << nl diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..94dfecc3b408a631058f90eb7259b11be96f530a --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Description + + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledBaseFvPatch.H" + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledBaseFvPatch, 0); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..9b67e8c2329fae28e435dff21a7b510de14d9ddc --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledBaseFvPatch.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledBaseFvPatch + +Description + Base class of regionCoupledFvPatch with common functionality for + regionCoupledFvPatch and regionCoupledWallFvPatch + +SourceFiles + regionCoupledBaseFvPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledBaseFvPatch_H +#define regionCoupledBaseFvPatch_H + +#include "regionCoupledBase.H" +#include "fvMesh.H" +#include "Time.H" +#include "polyPatch.H" +#include "regionCoupledLduInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledBaseFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledBaseFvPatch +: + public regionCoupledLduInterface +{ +protected: + + // Protected data + + //- Reference to regionCoupledBase + const regionCoupledBase& regionCoupledBase_; + + //- Reference to fvPatch + const fvPatch& patch_; + + + // Protected members + + //- Returns fvMesh + const fvMesh& nbrFvMesh() const + { + return + ( + patch_.boundaryMesh().mesh().time().lookupObject<fvMesh> + ( + regionCoupledBase_.nbrRegionName() + ) + ); + } + + +public: + + //- Runtime type information + TypeName("regionCoupledBase"); + + + // Constructors + + //- Construct from polyPatch + regionCoupledBaseFvPatch + ( + const polyPatch& pp, + const fvPatch& patch + ) + : + regionCoupledLduInterface(), + regionCoupledBase_ + ( + refCast<const regionCoupledBase>(pp) + ), + patch_(patch) + {} + + + //- Destructor + virtual ~regionCoupledBaseFvPatch() + {} + + + // Member Functions + + // Access + + //- Return neighbour + virtual label neighbPatchID() const + { + return regionCoupledBase_.neighbPatchID(); + } + + //- Is it the owner? + virtual bool owner() const + { + return regionCoupledBase_.owner(); + } + + //- Return regionCoupledBase neighb Patch + virtual const regionCoupledBaseFvPatch& neighbPatch() const + { + return refCast<const regionCoupledBaseFvPatch> + ( + nbrFvMesh().boundary() + [ + regionCoupledBase_.neighbPatchID() + ] + ); + } + + //- Return a reference to the AMI interpolator + virtual const AMIPatchToPatchInterpolation& AMI() const + { + return regionCoupledBase_.AMI(); + } + + //- Returns neighbour polyMesh + virtual const polyMesh& nbrMesh() const + { + return + ( + patch_.boundaryMesh().mesh().time().lookupObject<polyMesh> + ( + regionCoupledBase_.nbrRegionName() + ) + ); + } + + //- Return fvPatch + const fvPatch& patch() const + { + return patch_; + } + + //- Returns if it is the same Region + bool sameRegion() const + { + return regionCoupledBase_.sameRegion(); + } + + //- Return regionCoupledPolyPatch + const regionCoupledBase& regionCoupledPatch() const + { + return regionCoupledBase_; + } + + //- Return neighbor fvPatch + const fvPatch& neighbFvPatch() const + { + return refCast<const fvPatch> + ( + nbrFvMesh().boundary() + [ + regionCoupledBase_.neighbPatchID() + ] + ); + } + + //- Return the interface type + const word& regionCoupleType() const + { + return regionCoupledBase_.regionCoupleType(); + } + + + //- Return faceCell addressing + virtual const labelUList& faceCells() const = 0; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..d43c48ac9b6c528e294ae2a3da7af2934ee7ad08 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Description + coupledFvPatch is an abstract base class for patches that couple regions + of the computational domain e.g. cyclic and processor-processor links. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledFvPatch, 0); + addToRunTimeSelectionTable(fvPatch, regionCoupledFvPatch, polyPatch); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> Foam::regionCoupledFvPatch::interfaceInternalField +( + const labelUList& internalData +) const +{ + return patchInternalField(internalData); +} + + +Foam::tmp<Foam::labelField> Foam::regionCoupledFvPatch::internalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& iF +) const +{ + if (neighbFvPatch().sameRegion()) + { + return neighbFvPatch().patchInternalField(iF); + } + else + { + /* + WarningIn + ( + "regionCoupledFvPatch::internalFieldTransfer" + "( const Pstream::commsTypes, const labelUList&)" + " the internal field can not be transfered " + " as the neighbFvPatch are in different meshes " + ); + */ + return tmp<labelField>(new labelField(iF.size(), 0)); + + } + return tmp<labelField>(NULL); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..9c22929437c72b4a97eb35e9081d520b01ac11ce --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledFvPatch.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledFvPatch + +Description + Common functionality for regionCoupleFvPatch and regionCoupledWallFvPatch + +SourceFiles + regionCoupledFvPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledFvPatch_H +#define regionCoupledFvPatch_H + +#include "fvPatch.H" +#include "fvMesh.H" +#include "Time.H" +#include "regionCoupledPolyPatch.H" +#include "regionCoupledBaseFvPatch.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledFvPatch +: + public lduInterface, + public fvPatch, + public regionCoupledBaseFvPatch +{ + // Private data + + const regionCoupledPolyPatch& regionCoupledPolyPatch_; + + // Private members + + //- Return regionCoupledFvPatch nbr + const regionCoupledFvPatch& neighbFvPatch() const + { + return refCast<const regionCoupledFvPatch> + ( + nbrFvMesh().boundary() + [ + neighbPatchID() + ] + ); + } + + +public: + + //- Runtime type information + TypeName(regionCoupledPolyPatch::typeName_()); + + + // Constructors + + //- Construct from polyPatch + regionCoupledFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm) + : + fvPatch(patch, bm), + regionCoupledBaseFvPatch + ( + patch, + *this + ), + regionCoupledPolyPatch_ + ( + refCast<const regionCoupledPolyPatch>(patch) + ) + {} + + + //- Destructor + ~regionCoupledFvPatch() + {} + + + // Member Functions + + + // Access + + //- Return faceCell addressing + virtual const labelUList& faceCells() const + { + return fvPatch::faceCells(); + } + + //- Return true because this patch is coupled + virtual bool coupled() const + { + return regionCoupledPolyPatch_.coupled(); + } + + + // Interface transfer functions + + //- Return the values of the given internal data adjacent to + // the interface as a field + virtual tmp<labelField> interfaceInternalField + ( + const labelUList& internalData + ) const; + + //- Initialise neighbour field transfer + virtual void initInternalFieldTransfer + ( + const Pstream::commsTypes commsType, + labelUList& iF + ) const + {} + + //- Return neighbour field + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..382fff4e799f7b7eb3cd54664faa5a6e7f1a4ab9 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledWallFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledWallFvPatch, 0); + addToRunTimeSelectionTable(fvPatch, regionCoupledWallFvPatch, polyPatch); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> Foam::regionCoupledWallFvPatch:: +interfaceInternalField +( + const labelUList& internalData +) const +{ + return patchInternalField(internalData); +} + + +Foam::tmp<Foam::labelField> Foam::regionCoupledWallFvPatch:: +internalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& iF +) const +{ + if (neighbFvPatch().sameRegion()) + { + return neighbFvPatch().patchInternalField(iF); + } + else + { + return tmp<labelField>(new labelField(iF.size(), 0)); + + } + return tmp<labelField>(NULL); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..486c5c693d2c33752422b096971cacb14fe93d5f --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/derived/regionCoupled/regionCoupledWallFvPatch.H @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledWallFvPatch + +Description + Foam::regionCoupledWallFvPatch + +SourceFiles + regionCoupledWallFvPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledWallFvPatch_H +#define regionCoupledWallFvPatch_H + +#include "wallFvPatch.H" +#include "fvMesh.H" +#include "Time.H" +#include "regionCoupledWallPolyPatch.H" +#include "regionCoupledBaseFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledWallFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledWallFvPatch +: + public lduInterface, + public wallFvPatch, + public regionCoupledBaseFvPatch +{ + + // Private data + + //- Const reference to regionCoupledWallPolyPatch + const regionCoupledWallPolyPatch& regionCoupledPolyPatch_; + + + // Private members + + //- Return regionCoupledBaseFvPatch nbr + const regionCoupledWallFvPatch& neighbFvPatch() const + { + return refCast<const regionCoupledWallFvPatch> + ( + nbrFvMesh().boundary()[neighbPatchID()] + ); + } + + +public: + + //- Runtime type information + TypeName(regionCoupledWallPolyPatch::typeName_()); + + + // Constructors + + //- Construct from components + regionCoupledWallFvPatch + ( + const polyPatch& patch, + const fvBoundaryMesh& bm + ) + : + wallFvPatch(patch, bm), + regionCoupledBaseFvPatch + ( + patch, + *this + ), + regionCoupledPolyPatch_ + ( + refCast<const regionCoupledWallPolyPatch>(patch) + ) + {} + + + //- Destructor + ~regionCoupledWallFvPatch() + {} + + + // Member Functions + + + // Access + + //- Return faceCell addressing + virtual const labelUList& faceCells() const + { + return fvPatch::faceCells(); + } + + //- Return true because this patch is coupled + virtual bool coupled() const + { + return regionCoupledPolyPatch_.coupled(); + } + + + + // Interface transfer functions + + //- Return the values of the given internal data adjacent to + // the interface as a field + virtual tmp<labelField> interfaceInternalField + ( + const labelUList& internalData + ) const; + + //- Initialise neighbour field transfer + virtual void initInternalFieldTransfer + ( + const Pstream::commsTypes commsType, + labelUList& iF + ) const + {} + + //- Return neighbour field + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchNew.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchNew.C index 467100fb371ee7d443d705eff7fe3c7fc19d3b4a..cb8973ebc9e90bf91015067c06367eed467f3763 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchNew.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchNew.C @@ -25,6 +25,7 @@ License #include "fvPatch.H" #include "HashTable.H" +#include "cyclicAMIPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C index 6fa4f1a41a5821cee1bc0ca52346e7bd746f1d17..cdc08e00a7a116191f38376bf7654becf962f1f1 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C @@ -50,7 +50,8 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ) : GAMGInterface diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H index f498fe7701a47687a0561f833fa53a1bfb778b93..5b01f7a945797e750a9ba4db083186c7183bc4cb 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.H @@ -87,7 +87,8 @@ public: const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& restrictAddressing, - const labelField& neighbourRestrictAddressing + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex ); diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 2621adbc235f55c1d4ae65bd5ae9e937abf05afb..d341053951523d8d84989ce91de0726d94e1c767 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -187,4 +187,17 @@ mappedPatches/mappedPointPatch/mappedPointPatch.C mappedPatches/mappedPointPatch/mappedWallPointPatch.C +regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C +regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.C +regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.C +regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.C +regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.C +regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.C + +regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.C +regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.C +regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.C +regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.C +regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.C + LIB = $(FOAM_LIBBIN)/libmeshTools diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.C b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.C new file mode 100644 index 0000000000000000000000000000000000000000..30c00fca9b9ef4f23edbf85b83808876e93e4d13 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledGAMGInterfaceField.H" +#include "addToRunTimeSelectionTable.H" +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledGAMGInterfaceField, 0); + addToRunTimeSelectionTable + ( + GAMGInterfaceField, + regionCoupledGAMGInterfaceField, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupledGAMGInterfaceField::regionCoupledGAMGInterfaceField +( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterface +) +: + GAMGInterfaceField(GAMGCp, fineInterface), + regionCoupledGAMGInterface_ + ( + refCast<const regionCoupledGAMGInterface>(GAMGCp) + ) +{} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledGAMGInterfaceField::~regionCoupledGAMGInterfaceField() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H new file mode 100644 index 0000000000000000000000000000000000000000..b52b4c1321a021fb0b8751ea60a0f99f075d609b --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledGAMGInterfaceField + +Description + GAMG agglomerated region coupled interface field. + +SourceFiles + regionCoupledGAMGInterfaceField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledGAMGInterfaceField_H +#define regionCoupledGAMGInterfaceField_H + +#include "GAMGInterfaceField.H" +#include "regionCoupledGAMGInterface.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledGAMGInterfaceField Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledGAMGInterfaceField +: + public GAMGInterfaceField +{ + // Private data + + //- Local reference cast into the cyclic interface + const regionCoupledGAMGInterface& regionCoupledGAMGInterface_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + regionCoupledGAMGInterfaceField + ( + const regionCoupledGAMGInterfaceField& + ); + + //- Disallow default bitwise assignment + void operator=(const regionCoupledGAMGInterfaceField&); + + +public: + + //- Runtime type information + TypeName("regionCoupled"); + + + // Constructors + + //- Construct from GAMG interface and fine level interface field + regionCoupledGAMGInterfaceField + ( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterfaceField + ); + + + //- Destructor + virtual ~regionCoupledGAMGInterfaceField(); + + + // Member Functions + + // Access + + //- Return size + label size() const + { + return regionCoupledGAMGInterface_.size(); + } + + + //- Interface matrix update + virtual void updateInterfaceMatrix + ( + scalarField&, + const scalarField&, + const scalarField&, + const direction, + const Pstream::commsTypes commsType + ) const + {} + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.C b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.C new file mode 100644 index 0000000000000000000000000000000000000000..4a96c32283965f453725ad2345c7d90cb5314c85 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledWallGAMGInterfaceField.H" +#include "addToRunTimeSelectionTable.H" +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledWallGAMGInterfaceField, 0); + addToRunTimeSelectionTable + ( + GAMGInterfaceField, + regionCoupledWallGAMGInterfaceField, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupledWallGAMGInterfaceField::regionCoupledWallGAMGInterfaceField +( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterface +) +: + GAMGInterfaceField(GAMGCp, fineInterface), + regionCoupledGAMGInterface_ + ( + refCast<const regionCoupledWallGAMGInterface>(GAMGCp) + ) +{} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledWallGAMGInterfaceField::~regionCoupledWallGAMGInterfaceField() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H new file mode 100644 index 0000000000000000000000000000000000000000..31aaf932617a24490b140849e5dcfdab8099c6a9 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledWallGAMGInterfaceField + +Description + GAMG agglomerated region coupled interface field. + +SourceFiles + regionCoupledWallGAMGInterfaceField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledWallGAMGInterfaceField_H +#define regionCoupledWallGAMGInterfaceField_H + +#include "GAMGInterfaceField.H" +#include "regionCoupledWallGAMGInterface.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledWallGAMGInterfaceField Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledWallGAMGInterfaceField +: + public GAMGInterfaceField +{ + // Private data + + //- Local reference cast into the region coupled interface + const regionCoupledWallGAMGInterface& regionCoupledGAMGInterface_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + regionCoupledWallGAMGInterfaceField + ( + const regionCoupledWallGAMGInterfaceField& + ); + + //- Disallow default bitwise assignment + void operator=(const regionCoupledWallGAMGInterfaceField&); + + +public: + + //- Runtime type information + TypeName("regionCoupledWall"); + + + // Constructors + + //- Construct from GAMG interface and fine level interface field + regionCoupledWallGAMGInterfaceField + ( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterfaceField + ); + + + //- Destructor + virtual ~regionCoupledWallGAMGInterfaceField(); + + + // Member Functions + + // Access + + //- Return size + label size() const + { + return regionCoupledGAMGInterface_.size(); + } + + + //- Interface matrix update + virtual void updateInterfaceMatrix + ( + scalarField&, + const scalarField&, + const scalarField&, + const direction, + const Pstream::commsTypes commsType + ) const + {} + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.C b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..b2df899a5640a86d49c024a005a2042c39ea1f6a --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.C @@ -0,0 +1,261 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "AMIInterpolation.H" +#include "regionCoupledBaseGAMGInterface.H" +#include "addToRunTimeSelectionTable.H" +#include "Map.H" +#include "polyMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface +( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex +) +: + GAMGInterface + ( + index, + coarseInterfaces, + fineInterface, + localRestrictAddressing, + neighbourRestrictAddressing, + fineLevelIndex + ), + fineRegionCoupledLduInterface_ + ( + refCast<const regionCoupledLduInterface>(fineInterface) + ) +{ + /* + // Construct face agglomeration from cell agglomeration + { + // From coarse face to cell + DynamicList<label> dynFaceCells(localRestrictAddressing.size()); + + // From face to coarse face + DynamicList<label> dynFaceRestrictAddressing + ( + localRestrictAddressing.size() + ); + + Map<label> masterToCoarseFace(localRestrictAddressing.size()); + + forAll(localRestrictAddressing, ffi) + { + label curMaster = localRestrictAddressing[ffi]; + + Map<label>::const_iterator fnd = masterToCoarseFace.find + ( + curMaster + ); + + if (fnd == masterToCoarseFace.end()) + { + // New coarse face + label coarseI = dynFaceCells.size(); + dynFaceRestrictAddressing.append(coarseI); + dynFaceCells.append(curMaster); + masterToCoarseFace.insert(curMaster, coarseI); + } + else + { + // Already have coarse face + dynFaceRestrictAddressing.append(fnd()); + } + } + + faceCells_.transfer(dynFaceCells); + faceRestrictAddressing_.transfer(dynFaceRestrictAddressing); + } + + // On the owner side construct the AMI + if (fineRegionCoupledLduInterface_.owner()) + { + const polyMesh& nbrMesh = + fineRegionCoupledLduInterface_.nbrMesh(); + + if + ( + nbrMesh.foundObject<GAMGAgglomeration>(GAMGAgglomeration::typeName) + ) + { + const GAMGAgglomeration& nbrAgg = nbrMesh.thisDb().lookupObject + < + GAMGAgglomeration + > + ( + GAMGAgglomeration::typeName + ); + + label nbrLevel(-1); + if (nbrAgg.size() > fineLevelIndex) + { + nbrLevel = fineLevelIndex; + } + else + { + nbrLevel = nbrAgg.size() - 1; + } + + const labelField& nbrRestrictMap = + nbrAgg.restrictAddressing(nbrLevel); + + const labelUList& nbrFaceCells = + nbrLduInterface + ( + nbrLevel, + neighbPatchID() + ).faceCells(); + + + const IndirectList<label> nbrPatchRestrictMap + ( + nbrRestrictMap, + nbrFaceCells + ); + + labelList nbrFaceRestrictAddressing; + { + // From face to coarse face + DynamicList<label> dynNbrFaceRestrictAddressing + ( + nbrPatchRestrictMap.size() + ); + + Map<label> masterToCoarseFace(nbrPatchRestrictMap.size()); + + forAll(nbrPatchRestrictMap, ffi) + { + label curMaster = nbrPatchRestrictMap[ffi]; + + Map<label>::const_iterator fnd = masterToCoarseFace.find + ( + curMaster + ); + + if (fnd == masterToCoarseFace.end()) + { + // New coarse face + label coarseI = masterToCoarseFace.size(); + dynNbrFaceRestrictAddressing.append(coarseI); + masterToCoarseFace.insert(curMaster, coarseI); + } + else + { + // Already have coarse face + dynNbrFaceRestrictAddressing.append(fnd()); + } + } + + nbrFaceRestrictAddressing.transfer + ( + dynNbrFaceRestrictAddressing + ); + } + + amiPtr_.reset + ( + new AMIPatchToPatchInterpolation + ( + fineRegionCoupledLduInterface_.AMI(), + faceRestrictAddressing_, + nbrFaceRestrictAddressing + ) + ); + } + else + { + FatalErrorIn + ( + "regionCoupledBaseGAMGInterface::" + "regionCoupledBaseGAMGInterface" + "(" + "const label index," + "const lduInterfacePtrsList& coarseInterfaces," + "const lduInterface& fineInterface," + "const labelField& localRestrictAddressing," + "const labelField& neighbourRestrictAddressing," + "const label fineLevelIndex" + ")" + ) << " GAMGAgglomeration was not found in the nbr mesh. " + << " Check on the cacheAgglomeration flag in fvSolution" + << exit(FatalError); + } + } + */ + +} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledBaseGAMGInterface::~regionCoupledBaseGAMGInterface() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> Foam::regionCoupledBaseGAMGInterface:: +internalFieldTransfer +( + const Pstream::commsTypes, + const labelUList& iF +) const +{ + /* + WarningIn + ( + "regionCoupledBaseGAMGInterface::internalFieldTransfer" + "( const Pstream::commsTypes, const labelUList&)" + " the internal field can not be transfered " + " as the neighbFvPatch are in different meshes " + ); + + //const labelUList& nbrFaceCells = neighbPatch().faceCells(); + + const labelUList& nbrFaceCells = nbrLduInterface().faceCells(); + + tmp<labelField> tpnf(new labelField(nbrFaceCells.size())); + labelField& pnf = tpnf(); + + forAll(pnf, facei) + { + pnf[facei] = iF[nbrFaceCells[facei]]; + } + */ + tmp<labelField> tpnf(new labelField(iF)); + + return tpnf; +} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..4afefef87946b9535260fda02f76d53315ad2402 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledBaseGAMGInterface.H @@ -0,0 +1,169 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledBaseGAMGInterface + +Description + Base class for GAMG agglomerated coupled region interface. + +SourceFiles + regionCoupledBaseGAMGInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledBaseGAMGInterface_H +#define regionCoupledBaseGAMGInterface_H + +#include "GAMGInterface.H" +#include "regionCoupledLduInterface.H" +#include "GAMGAgglomeration.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledBaseGAMGInterface Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledBaseGAMGInterface +: + public GAMGInterface, + virtual public regionCoupledLduInterface +{ + // Private data + + //- Reference for the regionCoupledBaseFvPatch from which this is + // agglomerated + const regionCoupledLduInterface& fineRegionCoupledLduInterface_; + + //- AMI interface + //autoPtr<AMIPatchToPatchInterpolation> amiPtr_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + regionCoupledBaseGAMGInterface(const regionCoupledBaseGAMGInterface&); + + //- Disallow default bitwise assignment + void operator=(const regionCoupledBaseGAMGInterface&); + + +public: + + + // Constructors + + //- Construct from fine level interface, + // local and neighbour restrict addressing + regionCoupledBaseGAMGInterface + ( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& restrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex + ); + + + //- Destructor + virtual ~regionCoupledBaseGAMGInterface(); + + + // Member Functions + + // Interface transfer functions + + //- Transfer and return internal field adjacent to the interface + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; + + + //- Cyclic interface functions + + //- Return neigbour processor number + virtual label neighbPatchID() const + { + return fineRegionCoupledLduInterface_.neighbPatchID(); + } + + virtual bool owner() const + { + return fineRegionCoupledLduInterface_.owner(); + } + + virtual const regionCoupledBaseGAMGInterface& neighbPatch() const + { + return dynamic_cast<const regionCoupledBaseGAMGInterface&> + ( + fineRegionCoupledLduInterface_.neighbPatch() + ); + } + + //virtual const AMIPatchToPatchInterpolation& AMI() const + //{ + // return amiPtr_(); + //} + + virtual const polyMesh& nbrMesh() const + { + return fineRegionCoupledLduInterface_.nbrMesh(); + } + + const lduInterface& nbrLduInterface + ( + const label fineLevelIndex, + const label index + ) const + { + const GAMGAgglomeration& agg = nbrMesh().thisDb().lookupObject + < + GAMGAgglomeration + > + ( + GAMGAgglomeration::typeName + ); + + const lduMesh& mesh = agg.meshLevel(fineLevelIndex); + return mesh.interfaces()[index]; + } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.C b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..bcac280bfa8308bf536fb95b39e8ba7c091193cd --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledGAMGInterface.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledGAMGInterface, 0); + addToRunTimeSelectionTable + ( + GAMGInterface, + regionCoupledGAMGInterface, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupledGAMGInterface::regionCoupledGAMGInterface +( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex +) +: + regionCoupledBaseGAMGInterface + ( + index, + coarseInterfaces, + fineInterface, + localRestrictAddressing, + neighbourRestrictAddressing, + fineLevelIndex + ) +{} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledGAMGInterface::~regionCoupledGAMGInterface() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.H b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..03c1b31b8e96d30745037e62b3f4c051ed58d89f --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledGAMGInterface.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledGAMGInterface + +Description + GAMG agglomerated coupled region interface. + +SourceFiles + regionCoupledGAMGInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledGAMGInterface_H +#define regionCoupledGAMGInterface_H + +#include "regionCoupledBaseGAMGInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledGAMGInterface Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledGAMGInterface +: + public regionCoupledBaseGAMGInterface +{ + + // Private Member Functions + + //- Disallow default bitwise copy construct + regionCoupledGAMGInterface(const regionCoupledGAMGInterface&); + + //- Disallow default bitwise assignment + void operator=(const regionCoupledGAMGInterface&); + + +public: + + //- Runtime type information + TypeName("regionCoupled"); + + // Constructors + + //- Construct from fine level interface, + // local and neighbour restrict addressing + regionCoupledGAMGInterface + ( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& restrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex + ); + + + //- Destructor + virtual ~regionCoupledGAMGInterface(); + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.C b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..c3f2e396458558acf15b721bd705646247c2cd08 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledWallGAMGInterface.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledWallGAMGInterface, 0); + addToRunTimeSelectionTable + ( + GAMGInterface, + regionCoupledWallGAMGInterface, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionCoupledWallGAMGInterface::regionCoupledWallGAMGInterface +( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex +) +: + regionCoupledBaseGAMGInterface + ( + index, + coarseInterfaces, + fineInterface, + localRestrictAddressing, + neighbourRestrictAddressing, + fineLevelIndex + ) +{} + + +// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledWallGAMGInterface::~regionCoupledWallGAMGInterface() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.H b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..dd3c96c843b787280937dae56ca3c6fcd76dbb80 --- /dev/null +++ b/src/meshTools/regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGInterface.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledWallGAMGInterface + +Description + GAMG agglomerated coupled region interface. + +SourceFiles + regionCoupledWallGAMGInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledWallGAMGInterface_H +#define regionCoupledWallGAMGInterface_H + +#include "regionCoupledBaseGAMGInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledWallGAMGInterface Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledWallGAMGInterface +: + public regionCoupledBaseGAMGInterface +{ + + + // Private Member Functions + + //- Disallow default bitwise copy construct + regionCoupledWallGAMGInterface(const regionCoupledWallGAMGInterface&); + + //- Disallow default bitwise assignment + void operator=(const regionCoupledWallGAMGInterface&); + + +public: + + //- Runtime type information + TypeName("regionCoupledWall"); + + + // Constructors + + //- Construct from fine level interface, + // local and neighbour restrict addressing + regionCoupledWallGAMGInterface + ( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& restrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex + ); + + + //- Destructor + virtual ~regionCoupledWallGAMGInterface(); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.C b/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..f8cb75729a765a24c396f2daf0129abb38b7d24a --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.C @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledLduInterface.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::regionCoupledLduInterface, 0); + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledLduInterface::~regionCoupledLduInterface() +{} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.H b/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..8b8e81a793c42175620c73a9aa0a180c1fb78ce2 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledLduInterface/regionCoupledLduInterface.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledLduInterface + +Description + An abstract base class for region coupled interfaces + +SourceFiles + regionCoupledLduInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledLduInterface_H +#define regionCoupledLduInterface_H + +#include "primitiveFieldsFwd.H" +#include "AMIPatchToPatchInterpolation.H" +#include "polyMesh.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledLduInterface Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledLduInterface +{ + +public: + + //- Runtime type information + TypeName("regionCoupledLduInterface"); + + + // Constructors + + //- Construct null + regionCoupledLduInterface() + {} + + + //- Destructor + virtual ~regionCoupledLduInterface(); + + + // Member Functions + + // Access + + //- Return neighbour + virtual label neighbPatchID() const = 0; + + //- Is it owner? + virtual bool owner() const = 0; + + //- Return neighb regionCoupledLduInterface + virtual const regionCoupledLduInterface& neighbPatch() const = 0; + + //- Return AMI + //virtual const AMIPatchToPatchInterpolation& AMI() const = 0; + + //- Return nbrMesh + virtual const polyMesh& nbrMesh() const = 0; + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.C b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..034f58d0496511fd21c9050119b4fd090faa3646 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledPointPatch.H" +#include "addToRunTimeSelectionTable.H" + + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + defineTypeNameAndDebug(regionCoupledPointPatch, 0); + addToRunTimeSelectionTable + ( + facePointPatch, + regionCoupledPointPatch, + polyPatch + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.H b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..3194272c5d19c49a94ed451aa0d5cd0fbf436b5e --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledPointPatch.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledPointPatch + +Description + Cyclic AMI point patch - place holder only + +SourceFiles + regionCoupledPointPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledPointPatch_H +#define regionCoupledPointPatch_H + +#include "facePointPatch.H" +#include "regionCoupledPolyPatch.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledPointPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledPointPatch +: + public facePointPatch +{ +public: + + //- Runtime type information + TypeName(regionCoupledPolyPatch::typeName_()); + + + // Constructors + + //- Construct from components + regionCoupledPointPatch + ( + const polyPatch& patch, + const pointBoundaryMesh& bm + ): + facePointPatch(patch, bm) + {} + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.C b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..590f71d8385e9aac68753f14285499d04c03622d --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledWallPointPatch.H" +#include "addToRunTimeSelectionTable.H" + + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + defineTypeNameAndDebug(regionCoupledWallPointPatch, 0); + addToRunTimeSelectionTable + ( + facePointPatch, + regionCoupledWallPointPatch, + polyPatch + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.H b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..5dc4b6953d6f9731e533a249eb98eb49d1813c24 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPointPatch/regionCoupledWallPointPatch.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledWallPointPatch + +Description + Cyclic AMI point patch - place holder only + +SourceFiles + regionCoupledWallPointPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledWallPointPatch_H +#define regionCoupledWallPointPatch_H + +#include "facePointPatch.H" +#include "regionCoupledWallPolyPatch.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledWallPointPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledWallPointPatch +: + public facePointPatch +{ +public: + + //- Runtime type information + TypeName(regionCoupledWallPolyPatch::typeName_()); + + + // Constructors + + //- Construct from components + regionCoupledWallPointPatch + ( + const polyPatch& patch, + const pointBoundaryMesh& bm + ): + facePointPatch(patch, bm) + {} + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C new file mode 100644 index 0000000000000000000000000000000000000000..de7215e3da639686cda4088b2a538f12e00d58a7 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C @@ -0,0 +1,369 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledBase.H" +#include "SubField.H" +#include "polyMesh.H" +#include "Time.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledBase, 0); +} + + +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + +void Foam::regionCoupledBase::resetAMI() const +{ + if (owner()) + { + AMIPtr_.clear(); + + const polyPatch& nbr = refCast<const polyPatch>(neighbPatch()); + pointField nbrPoints = nbr.localPoints(); + + if (debug) + { + const Time& t = patch_.boundaryMesh().mesh().time(); + OFstream os(t.path()/patch_.name() + "_neighbourPatch-org.obj"); + meshTools::writeOBJ(os, nbr.localFaces(), nbrPoints); + } + + // transform neighbour patch to local system + //transformPosition(nbrPoints); + primitivePatch nbrPatch0 + ( + SubList<face> + ( + nbr.localFaces(), + nbr.size() + ), + nbrPoints + ); + + if (debug) + { + const Time& t = patch_.boundaryMesh().mesh().time(); + OFstream osN(t.path()/patch_.name() + "_neighbourPatch-trans.obj"); + meshTools::writeOBJ(osN, nbrPatch0.localFaces(), nbrPoints); + + OFstream osO(t.path()/patch_.name() + "_ownerPatch.obj"); + meshTools::writeOBJ + ( + osO, + patch_.localFaces(), + patch_.localPoints() + ); + } + + // Construct/apply AMI interpolation to determine addressing and weights + AMIPtr_.reset + ( + new AMIPatchToPatchInterpolation + ( + patch_, + nbrPatch0, + surfPtr(), + faceAreaIntersect::tmMesh, + AMIReverse_ + ) + ); + + if (debug) + { + Pout<< "regionCoupledBase : " << patch_.name() + << " constructed AMI with " << nl + << " " << ":srcAddress:" << AMIPtr_().srcAddress().size() + << nl + << " " << " tgAddress :" << AMIPtr_().tgtAddress().size() + << nl << endl; + } + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::regionCoupledBase::clearGeom() +{ + AMIPtr_.clear(); + surfPtr_.clear(); +} + + +// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // + +Foam::regionCoupledBase::regionCoupledBase +( + const polyPatch& pp +) +: + patch_(pp), + nbrPatchName_(word::null), + nbrPatchID_(-1), + nbrRegionName_(word::null), + sameRegion_(false), + AMIPtr_(NULL), + AMIReverse_(false), + surfPtr_(NULL), + surfDict_(fileName("surface")) +{} + + +Foam::regionCoupledBase::regionCoupledBase +( + const polyPatch& pp, + const dictionary& dict +) +: + patch_(pp), + nbrPatchName_(dict.lookup("neighbourPatch")), + nbrPatchID_(-1), + nbrRegionName_(dict.lookup("neighbourRegion")), + sameRegion_(nbrRegionName_ == patch_.boundaryMesh().mesh().name()), + AMIPtr_(NULL), + AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)), + surfPtr_(NULL), + surfDict_(dict.subOrEmptyDict("surface")) +{ + if (nbrPatchName_ == patch_.name()) + { + FatalIOErrorIn + ( + "regionCoupledBase::regionCoupledBase" + "(" + "const polyPatch&, " + "const dictionary& " + ")", + dict + ) << "Neighbour patch name " << nbrPatchName_ + << " cannot be the same as this patch " << patch_.name() + << exit(FatalIOError); + } +} + + +Foam::regionCoupledBase::regionCoupledBase +( + const polyPatch& pp, + const regionCoupledBase& mpb +) +: + patch_(pp), + nbrPatchName_(mpb.nbrPatchName_), + nbrPatchID_(mpb.nbrPatchID_), + nbrRegionName_(mpb.nbrRegionName_), + sameRegion_(mpb.sameRegion_), + AMIPtr_(NULL), + AMIReverse_(mpb.AMIReverse_), + surfPtr_(mpb.surfPtr_), + surfDict_(mpb.surfDict_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledBase::~regionCoupledBase() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::label Foam::regionCoupledBase::neighbPatchID() const +{ + if (nbrPatchID_ == -1) + { + if + ( + patch_.boundaryMesh().mesh().time().foundObject<polyMesh> + ( + nbrRegionName_ + ) + ) + { + const polyMesh& mesh = + patch_.boundaryMesh().mesh().time().lookupObject<polyMesh> + ( + nbrRegionName_ + ); + + nbrPatchID_ = mesh.boundaryMesh().findPatchID(nbrPatchName_); + + if (nbrPatchID_ == -1) + { + FatalErrorIn("cyclicPolyAMIPatch::neighbPatchID() const") + << "Illegal neighbourPatch name " << nbrPatchName_ + << nl << "Valid patch names are " + << mesh.boundaryMesh().names() + << exit(FatalError); + } + + // Check that it is a cyclic AMI patch + const regionCoupledBase& nbrPatch = + refCast<const regionCoupledBase> + ( + mesh.boundaryMesh()[nbrPatchID_] + ); + + if (nbrPatch.nbrPatchName() != patch_.name()) + { + WarningIn("regionCoupledBase::neighbPatchID() const") + << "Patch " << patch_.name() + << " specifies neighbour patch " << nbrPatchName() + << nl << " but that in return specifies " + << nbrPatch.nbrPatchName() << endl; + } + } + } + + return nbrPatchID_; +} + + +bool Foam::regionCoupledBase::owner() const +{ + if (nbrRegionName_ == patch_.boundaryMesh().mesh().name()) + { + return patch_.index() < neighbPatchID(); + } + else + { + return patch_.boundaryMesh().mesh().name() < nbrRegionName_; + } +} + + +const Foam::autoPtr<Foam::searchableSurface>&Foam::regionCoupledBase:: +surfPtr() const +{ + const word surfType(surfDict_.lookupOrDefault<word>("type", "none")); + + if (!surfPtr_.valid() && owner() && surfType != "none") + { + word surfName(surfDict_.lookupOrDefault("name", patch_.name())); + + const polyMesh& mesh = patch_.boundaryMesh().mesh(); + + surfPtr_ = + searchableSurface::New + ( + surfType, + IOobject + ( + surfName, + mesh.time().constant(), + "triSurface", + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + surfDict_ + ); + } + + return surfPtr_; +} + + +const Foam::AMIPatchToPatchInterpolation& Foam::regionCoupledBase::AMI() const +{ + if (!owner()) + { + FatalErrorIn + ( + "const AMIPatchToPatchInterpolation& regionCoupledBase::AMI()" + ) + << "AMI interpolator only available to owner patch" + << abort(FatalError); + } + + if (!AMIPtr_.valid()) + { + resetAMI(); + } + + return AMIPtr_(); +} + + +const Foam::regionCoupledBase& +Foam::regionCoupledBase::neighbPatch() const +{ + const polyMesh& mesh = + patch_.boundaryMesh().mesh().time().lookupObject<polyMesh> + ( + nbrRegionName_ + ); + + const polyPatch& pp = mesh.boundaryMesh()[neighbPatchID()]; + return refCast<const regionCoupledBase>(pp); +} + + +bool Foam::regionCoupledBase::order +( + PstreamBuffers& pBufs, + const primitivePatch& pp, + labelList& faceMap, + labelList& rotation +) const +{ + faceMap.setSize(pp.size()); + faceMap = -1; + + rotation.setSize(pp.size()); + rotation = 0; + + // do nothing + return false; +} + + +void Foam::regionCoupledBase::write(Ostream& os) const +{ + os.writeKeyword("neighbourPatch") << nbrPatchName_ + << token::END_STATEMENT << nl; + os.writeKeyword("nbrRegionName") << nbrRegionName_ + << token::END_STATEMENT << nl; + + if (AMIReverse_) + { + os.writeKeyword("flipNormals") << AMIReverse_ + << token::END_STATEMENT << nl; + } + + if (!surfDict_.empty()) + { + os.writeKeyword(surfDict_.dictName()); + os << surfDict_; + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.H b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.H new file mode 100644 index 0000000000000000000000000000000000000000..b28d4351a06eca09feff2e6d524b02fe4c068d0f --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.H @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledBase + +Description + Base class with common functinality for regionCoupled polyPatch. + It includes AMI. + + +SourceFiles + regionCoupledBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledBase_H +#define regionCoupledBase_H + +#include "AMIPatchToPatchInterpolation.H" +#include "polyBoundaryMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledBase Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledBase +{ +private: + + // Private data + + //- Patch to sample + const polyPatch& patch_; + + //- Name of other half + const word nbrPatchName_; + + //- Index of other half + mutable label nbrPatchID_; + + //- Name of other region + const word nbrRegionName_; + + //- Same region + const bool sameRegion_; + + //- AMI interpolation class + mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_; + + //- Flag to indicate that slave patch should be reversed for AMI + const bool AMIReverse_; + + //- Projection surface + mutable autoPtr<searchableSurface> surfPtr_; + + //- Dictionary used during projection surface construction + const dictionary surfDict_; + + + // Private Member Functions + + //- Reset the AMI interpolator + void resetAMI() const; + + +protected: + + + //- Clear geometry + virtual void clearGeom(); + + +public: + + //- Runtime type information + TypeName("regionCoupledBase"); + + + // Constructors + + //- Construct from patch + regionCoupledBase(const polyPatch&); + + //- Construct from dictionary + regionCoupledBase(const polyPatch&, const dictionary&); + + //- Construct as copy, resetting patch + regionCoupledBase(const polyPatch&, const regionCoupledBase&); + + + //- Destructor + virtual ~regionCoupledBase(); + + + // Member Functions + + + // Access + + //- Neighbour patch name + const word& nbrPatchName() const + { + return nbrPatchName_; + } + + //- Neighbour region name + const word& nbrRegionName() const + { + return nbrRegionName_; + } + + //- Cached sampleRegion != mesh.name() + bool sameRegion() const + { + return sameRegion_; + } + + //- Neighbour patch ID + label neighbPatchID() const; + + //- Does this side own the patch? + bool owner() const; + + //- Return a reference to the neighbour patch + const regionCoupledBase& neighbPatch() const; + + //- Return a reference to the projection surface + const autoPtr<searchableSurface>& surfPtr() const; + + //- Return a reference to the AMI interpolator + const AMIPatchToPatchInterpolation& AMI() const; + + + // Interpolations + + //- Interpolate field + template<class Type> + tmp<Field<Type> > interpolate(const Field<Type>& fld) const; + + //- Interpolate tmp field + template<class Type> + tmp<Field<Type> > interpolate + ( + const tmp<Field<Type> >& tFld + ) const; + + //- Low-level interpolate List + template<class Type, class BinaryOp> + void interpolate + ( + const UList<Type>& fld, + const BinaryOp& bop, + List<Type>& result + ) const; + + + //- Return new ordering for primitivePatch. + // Ordering is -faceMap: for every face + // index of the new face -rotation:for every new face the clockwise + // shift of the original face. Return false if nothing changes + // (faceMap is identity, rotation is 0), true otherwise. + virtual bool order + ( + PstreamBuffers&, + const primitivePatch&, + labelList& faceMap, + labelList& rotation + ) const; + + + //- Return the type + virtual const word& regionCoupleType() const = 0; + + //- Write the polyPatch data as a dictionary + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "regionCoupledBaseTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBaseTemplates.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBaseTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..125af8d35b22ccb84d60c1a3c7e4a965e6add1fc --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBaseTemplates.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::regionCoupledBase::interpolate +( + const Field<Type>& fld +) const +{ + if (owner()) + { + return AMI().interpolateToSource(fld); + } + else + { + return neighbPatch().AMI().interpolateToTarget(fld); + } +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::regionCoupledBase::interpolate +( + const tmp<Field<Type> >& tFld +) const +{ + if (owner()) + { + return AMI().interpolateToSource(tFld); + } + else + { + return neighbPatch().AMI().interpolateToTarget(tFld); + } +} + + +template<class Type, class BinaryOp> +void Foam::regionCoupledBase::interpolate +( + const UList<Type>& fld, + const BinaryOp& bop, + List<Type>& result +) const +{ + if (owner()) + { + AMI().interpolateToSource(fld, bop, result); + } + else + { + neighbPatch().AMI().interpolateToTarget(fld, bop, result); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..e88e32b7dea15397a51de512a29e9135fe39b865 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.C @@ -0,0 +1,170 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledPolyPatch.H" +#include "polyMesh.H" +#include "Time.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledPolyPatch, 0); + + addToRunTimeSelectionTable(polyPatch, regionCoupledPolyPatch, word); + addToRunTimeSelectionTable(polyPatch, regionCoupledPolyPatch, dictionary); +} + + +// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // + +Foam::regionCoupledPolyPatch::regionCoupledPolyPatch +( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + polyPatch(name, size, start, index, bm, patchType), + regionCoupledBase(static_cast<const polyPatch&>(*this)) +{} + + +Foam::regionCoupledPolyPatch::regionCoupledPolyPatch +( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + polyPatch(name, dict, index, bm, patchType), + regionCoupledBase(*this, dict) +{} + + +Foam::regionCoupledPolyPatch::regionCoupledPolyPatch +( + const regionCoupledPolyPatch& pp, + const polyBoundaryMesh& bm +) +: + polyPatch(pp, bm), + regionCoupledBase(*this, pp) +{} + + +Foam::regionCoupledPolyPatch::regionCoupledPolyPatch +( + const regionCoupledPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart +) +: + polyPatch(pp, bm, index, newSize, newStart), + regionCoupledBase(*this, pp) +{} + + +Foam::regionCoupledPolyPatch::regionCoupledPolyPatch +( + const regionCoupledPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart +) +: + polyPatch(pp, bm, index, mapAddressing, newStart), + regionCoupledBase(*this, pp) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledPolyPatch::~regionCoupledPolyPatch() +{ + regionCoupledBase::clearGeom(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionCoupledPolyPatch::initGeometry(PstreamBuffers& pBufs) +{ + polyPatch::initGeometry(pBufs); +} + + +void Foam::regionCoupledPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) +{ + polyPatch::initMovePoints(pBufs, p); +} + + +void Foam::regionCoupledPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& p +) +{ + polyPatch::movePoints(pBufs, p); + regionCoupledBase::clearGeom(); +} + + +void Foam::regionCoupledPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) +{ + polyPatch::initUpdateMesh(pBufs); +} + + +void Foam::regionCoupledPolyPatch::updateMesh(PstreamBuffers& pBufs) +{ + polyPatch::updateMesh(pBufs); + regionCoupledBase::clearGeom(); +} + + +void Foam::regionCoupledPolyPatch::write(Ostream& os) const +{ + polyPatch::write(os); + regionCoupledBase::write(os); +} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.H b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..82b3bf54fa1b8ce32a8fadedc4285dc6754154b7 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.H @@ -0,0 +1,223 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledPolyPatch + +Description + Region coupled polyPatch + +SourceFiles + regionCoupledPolyPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledPolyPatch_H +#define regionCoupledPolyPatch_H + +#include "regionCoupledBase.H" +#include "polyBoundaryMesh.H" +#include "polyPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCoupledPolyPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledPolyPatch +: + public polyPatch, + public regionCoupledBase +{ + +protected: + + // Protected Member Functions + + //- Initialise the calculation of the patch geometry + virtual void initGeometry(PstreamBuffers&); + + //- Initialise the patches for moving points + virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&); + + //- Correct patches after moving points + virtual void movePoints(PstreamBuffers& pBufs, const pointField&); + + //- Initialise the update of the patch topology + virtual void initUpdateMesh(PstreamBuffers&); + + //- Update of the patch topology + virtual void updateMesh(PstreamBuffers&); + + +public: + + //- Runtime type information + TypeName("regionCoupled"); + + + // Constructors + + //- Construct from (base couped patch) components + regionCoupledPolyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + //- Construct from dictionary + regionCoupledPolyPatch + ( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + //- Construct as copy, resetting the boundary mesh + regionCoupledPolyPatch + ( + const regionCoupledPolyPatch&, + const polyBoundaryMesh& + ); + + //- Construct given the original patch and resetting the + // face list and boundary mesh information + regionCoupledPolyPatch + ( + const regionCoupledPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ); + + //- Construct given the original patch and a map + regionCoupledPolyPatch + ( + const regionCoupledPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ); + + + //- Construct and return a clone, resetting the boundary mesh + virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const + { + return autoPtr<polyPatch>(new regionCoupledPolyPatch(*this, bm)); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ) const + { + return autoPtr<polyPatch> + ( + new regionCoupledPolyPatch + ( + *this, + bm, + index, + newSize, + newStart + ) + ); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ) const + { + return autoPtr<polyPatch> + ( + new regionCoupledPolyPatch + ( + *this, + bm, + index, + mapAddressing, + newStart + ) + ); + } + + + //- Destructor + virtual ~regionCoupledPolyPatch(); + + + // Member functions + + // Access + + //- Is it coupled? + virtual bool coupled() const + { + return false; + } + + + //- Return the type + virtual const word& regionCoupleType() const + { + return type(); + } + + + //- Write the polyPatch data as a dictionary + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.C b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..ef996b59744f89c8d11bcb19093f07b7798998d7 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.C @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionCoupledWallPolyPatch.H" +#include "addToRunTimeSelectionTable.H" +#include "polyPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(regionCoupledWallPolyPatch, 0); + + addToRunTimeSelectionTable(polyPatch, regionCoupledWallPolyPatch, word); + addToRunTimeSelectionTable + ( + polyPatch, + regionCoupledWallPolyPatch, + dictionary + ); +} + + +// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // + +Foam::regionCoupledWallPolyPatch::regionCoupledWallPolyPatch +( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + wallPolyPatch(name, size, start, index, bm, patchType), + regionCoupledBase(static_cast<const polyPatch&>(*this)) +{} + + +Foam::regionCoupledWallPolyPatch::regionCoupledWallPolyPatch +( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + wallPolyPatch(name, dict, index, bm, patchType), + regionCoupledBase(static_cast<const polyPatch&>(*this), dict) +{} + + +Foam::regionCoupledWallPolyPatch::regionCoupledWallPolyPatch +( + const regionCoupledWallPolyPatch& pp, + const polyBoundaryMesh& bm +) +: + wallPolyPatch(pp, bm), + regionCoupledBase(*this, pp) +{} + + +Foam::regionCoupledWallPolyPatch::regionCoupledWallPolyPatch +( + const regionCoupledWallPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart +) +: + wallPolyPatch(pp, bm, index, newSize, newStart), + regionCoupledBase(*this, pp) +{} + + +Foam::regionCoupledWallPolyPatch::regionCoupledWallPolyPatch +( + const regionCoupledWallPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart +) +: + wallPolyPatch(pp, bm, index, mapAddressing, newStart), + regionCoupledBase(*this, pp) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionCoupledWallPolyPatch::~regionCoupledWallPolyPatch() +{ + regionCoupledBase::clearGeom(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionCoupledWallPolyPatch::initGeometry(PstreamBuffers& pBufs) +{ + wallPolyPatch::initGeometry(pBufs); +} + + +void Foam::regionCoupledWallPolyPatch::calcGeometry(PstreamBuffers& pBufs) +{ + wallPolyPatch::calcGeometry(pBufs); + regionCoupledBase::clearGeom(); +} + + +void Foam::regionCoupledWallPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) +{ + wallPolyPatch::initMovePoints(pBufs, p); +} + + +void Foam::regionCoupledWallPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& p +) +{ + wallPolyPatch::movePoints(pBufs, p); + regionCoupledBase::clearGeom(); +} + + +void Foam::regionCoupledWallPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) +{ + wallPolyPatch::initUpdateMesh(pBufs); +} + + +void Foam::regionCoupledWallPolyPatch::updateMesh(PstreamBuffers& pBufs) +{ + wallPolyPatch::updateMesh(pBufs); + regionCoupledBase::clearGeom(); +} + + +void Foam::regionCoupledWallPolyPatch::write(Ostream& os) const +{ + wallPolyPatch::write(os); + regionCoupledBase::write(os); +} + + +// ************************************************************************* // diff --git a/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.H b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..7e00221a906c937d207e80923fd31e727ea8d941 --- /dev/null +++ b/src/meshTools/regionCoupled/patches/regionCoupledPolyPatch/regionCoupledWallPolyPatch.H @@ -0,0 +1,222 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::regionCoupledWallPolyPatch + +Description + regionCoupledWall + +SourceFiles + regionCoupledWallPolyPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCoupledWallPolyPatch_H +#define regionCoupledWallPolyPatch_H + +#include "wallPolyPatch.H" +#include "regionCoupledBase.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class polyMesh; + +/*---------------------------------------------------------------------------*\ + Class regionCoupledWallPolyPatch Declaration +\*---------------------------------------------------------------------------*/ + +class regionCoupledWallPolyPatch +: + public wallPolyPatch, + public regionCoupledBase +{ + +protected: + + //- Initialise the calculation of the patch geometry + virtual void initGeometry(PstreamBuffers&); + + //- Calculate the patch geometry + virtual void calcGeometry(PstreamBuffers&); + + //- Initialise the patches for moving points + virtual void initMovePoints(PstreamBuffers&, const pointField&); + + //- Correct patches after moving points + virtual void movePoints(PstreamBuffers&, const pointField&); + + //- Initialise the update of the patch topology + virtual void initUpdateMesh(PstreamBuffers&); + + //- Update of the patch topology + virtual void updateMesh(PstreamBuffers&); + + +public: + + //- Runtime type information + TypeName("regionCoupledWall"); + + + // Constructors + + //- Construct from components + regionCoupledWallPolyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + + //- Construct from dictionary + regionCoupledWallPolyPatch + ( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + //- Construct as copy, resetting the boundary mesh + regionCoupledWallPolyPatch + ( + const regionCoupledWallPolyPatch&, + const polyBoundaryMesh& + ); + + //- Construct given the original patch and resetting the + // face list and boundary mesh information + regionCoupledWallPolyPatch + ( + const regionCoupledWallPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ); + + //- Construct given the original patch and a map + regionCoupledWallPolyPatch + ( + const regionCoupledWallPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ); + + //- Construct and return a clone, resetting the boundary mesh + virtual autoPtr<wallPolyPatch::polyPatch> clone + ( + const polyBoundaryMesh& bm + ) const + { + return autoPtr<wallPolyPatch::polyPatch> + ( + new regionCoupledWallPolyPatch(*this, bm) + ); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<wallPolyPatch::polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ) const + { + return autoPtr<wallPolyPatch::polyPatch> + ( + new regionCoupledWallPolyPatch + ( + *this, + bm, + index, + newSize, + newStart + ) + ); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ) const + { + return autoPtr<polyPatch> + ( + new regionCoupledWallPolyPatch + ( + *this, + bm, + index, + mapAddressing, + newStart + ) + ); + } + + + //- Destructor + virtual ~regionCoupledWallPolyPatch(); + + + // Member functions + + //- Return the type + virtual const word& regionCoupleType() const + { + return type(); + } + + //- Write the polyPatch data as a dictionary + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionCoupled/Make/files b/src/regionCoupled/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..4ca712952410586a7637dc74cb2ed732a1ba5013 --- /dev/null +++ b/src/regionCoupled/Make/files @@ -0,0 +1,3 @@ +derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C + +LIB = $(FOAM_LIBBIN)/libregionCoupled diff --git a/src/regionCoupled/Make/options b/src/regionCoupled/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..ea55cd87d2330db73e974c58ab311bac38e1dcae --- /dev/null +++ b/src/regionCoupled/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + +LIB_LIBS = \ + -lfluidThermophysicalModels \ + -lfiniteVolume \ + -lmeshTools \ + -lcompressibleTurbulenceModel diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..820596e022eed4920a65032ba4beb1724bf56112 --- /dev/null +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -0,0 +1,559 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "addToRunTimeSelectionTable.H" +#include "energyRegionCoupledFvPatchScalarField.H" +#include "Time.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* Foam::NamedEnum + < + Foam::energyRegionCoupledFvPatchScalarField::kappaMethodType, + 3 + >::names[] = + { + "solid", + "fluid", + "undefined" + }; +} + + +const Foam::NamedEnum +< + Foam::energyRegionCoupledFvPatchScalarField::kappaMethodType, + 3 +> Foam::energyRegionCoupledFvPatchScalarField::methodTypeNames_; + + +// * * * * * * * * * * * * * * * * Private members * * * * * * * * * * * * *// + +void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const +{ + if (method_ == UNDEFINED) + { + if ( + this->db().foundObject<compressible::turbulenceModel> + ( + "turbulenceModel" + ) + ) + { + method_ = FLUID; + } + else + { + method_ = SOLID; + } + } + + if (!nbrThermoPtr_) + { + nbrThermoPtr_ = + ( + ®ionCoupledPatch_.nbrMesh().lookupObject<basicThermo> + ( + "thermophysicalProperties" + ) + ); + } + + if (!thermoPtr_) + { + thermoPtr_ = + ( + &this->db().lookupObject<basicThermo> + ( + "thermophysicalProperties" + ) + ); + } +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +kappa() const +{ + switch (method_) + { + case FLUID: + { + const compressible::turbulenceModel& model = + this->db().lookupObject<compressible::turbulenceModel> + ( + "turbulenceModel" + ); + + return model.kappaEff(patch().index()); + } + break; + + case SOLID: + { + const basicThermo& thermo = + this->db().lookupObject<basicThermo> + ( + "thermophysicalProperties" + ); + + return thermo.kappa(patch().index()); + } + break; + + case UNDEFINED: + { + FatalErrorIn("energyRegionCoupledFvPatchScalarField::kappa() const") + << " on mesh " << this->db().name() << " patch " + << patch().name() + << " could not find a method in. Methods are: " + << methodTypeNames_.toc() + << " Not turbulenceModel or thermophysicalProperties" + << " were found" + << exit(FatalError); + } + break; + } + return scalarField(0); +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +weights() const +{ + const fvPatch& patch = regionCoupledPatch_.patch(); + + const scalarField deltas + ( + patch.nf() & patch.delta() + ); + + const scalarField alphaDelta(kappa()/deltas); + + const fvPatch& nbrPatch = regionCoupledPatch_.neighbFvPatch(); + + const energyRegionCoupledFvPatchScalarField& nbrField = + refCast + < + const energyRegionCoupledFvPatchScalarField + > + ( + nbrPatch.lookupPatchField<volScalarField, scalar>("T") + ); + + // Needed in the first calculation of weights + nbrField.setMethod(); + + const scalarField nbrAlpha + ( + regionCoupledPatch_.regionCoupledPatch().interpolate + ( + nbrField.kappa() + ) + ); + + const scalarField nbrDeltas + ( + regionCoupledPatch_.regionCoupledPatch().interpolate + ( + nbrPatch.nf() & nbrPatch.delta() + ) + ); + + const scalarField nbrAlphaDelta(nbrAlpha/nbrDeltas); + + tmp<scalarField> tw(new scalarField(deltas.size())); + scalarField& w = tw(); + + forAll(alphaDelta, faceI) + { + scalar di = alphaDelta[faceI]; + scalar dni = nbrAlphaDelta[faceI]; + + w[faceI] = di/(di + dni); + } + + return tw; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::energyRegionCoupledFvPatchScalarField:: +energyRegionCoupledFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + LduInterfaceField<scalar>(refCast<const lduInterface>(p)), + fvPatchScalarField(p, iF), + regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), + method_(UNDEFINED), + nbrThermoPtr_(NULL), + thermoPtr_(NULL) +{} + + +Foam::energyRegionCoupledFvPatchScalarField:: +energyRegionCoupledFvPatchScalarField +( + const energyRegionCoupledFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + LduInterfaceField<scalar>(refCast<const lduInterface>(p)), + fvPatchScalarField(ptf, p, iF, mapper), + regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), + method_(ptf.method_), + nbrThermoPtr_(NULL), + thermoPtr_(NULL) +{} + + +Foam::energyRegionCoupledFvPatchScalarField:: +energyRegionCoupledFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + LduInterfaceField<scalar>(refCast<const lduInterface>(p)), + fvPatchScalarField(p, iF, dict), + regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), + method_(UNDEFINED), + nbrThermoPtr_(NULL), + thermoPtr_(NULL) +{ + + if (!isA<regionCoupledBase>(this->patch().patch())) + { + FatalErrorIn + ( + "energyRegionCoupledFvPatchScalarField::" + "energyRegionCoupledFvPatchScalarField\n" + "(\n" + " const fvPatch& p,\n" + " const DimensionedField<scalar, volMesh>& iF,\n" + " const dictionary& dict\n" + ")\n" + ) << "\n patch type '" << p.type() + << "' not type '" << regionCoupledBase::typeName << "'" + << "\n for patch " << p.name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalError); + } + + if (dict.found("value")) + { + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + } +} + + +Foam::energyRegionCoupledFvPatchScalarField:: +energyRegionCoupledFvPatchScalarField +( + const energyRegionCoupledFvPatchScalarField& ptf +) +: + LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), + fvPatchScalarField(ptf), + regionCoupledPatch_(ptf.regionCoupledPatch_), + method_(ptf.method_), + nbrThermoPtr_(NULL), + thermoPtr_(NULL) +{} + + +Foam::energyRegionCoupledFvPatchScalarField:: +energyRegionCoupledFvPatchScalarField +( + const energyRegionCoupledFvPatchScalarField& ptf, + const DimensionedField<scalar, volMesh>& iF +) +: + LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), + fvPatchScalarField(ptf, iF), + regionCoupledPatch_(ptf.regionCoupledPatch_), + method_(ptf.method_), + nbrThermoPtr_(NULL), + thermoPtr_(NULL) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +snGrad() const +{ + return + (*this - patchInternalField())*regionCoupledPatch_.patch().deltaCoeffs(); +} + + +void Foam::energyRegionCoupledFvPatchScalarField::initEvaluate +( + const Pstream::commsTypes +) +{ + if (!updated()) + { + updateCoeffs(); + } +} + + +void Foam::energyRegionCoupledFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + if (!updated()) + { + updateCoeffs(); + } + + label patchi = patch().index(); + const scalarField& pp = thermoPtr_->p().boundaryField()[patchi]; + + const scalarField lWeights = weights(); + + scalarField::operator= + ( + thermoPtr_->he + ( + pp, + lWeights*patchInternalTemperatureField() + + (1.0 - lWeights)*patchNeighbourTemperatureField(), + patchi + ) + ); + + fvPatchScalarField::evaluate(); +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +valueInternalCoeffs +( + const tmp<scalarField>& w +) const +{ + return scalar(pTraits<scalar>::one)*w; +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +valueBoundaryCoeffs +( + const tmp<scalarField>& w +) const +{ + return scalar(pTraits<scalar>::one)*(1.0 - w); +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +gradientInternalCoeffs() const +{ + return + -scalar(pTraits<scalar>::one) + *regionCoupledPatch_.patch().deltaCoeffs(); +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +gradientBoundaryCoeffs() const +{ + return -this->gradientInternalCoeffs(); +} + + +Foam::tmp<Foam::Field<Foam::scalar> > +Foam::energyRegionCoupledFvPatchScalarField:: +patchNeighbourField() const +{ + const fvPatch& nbrPatch = regionCoupledPatch_.neighbFvPatch(); + + const labelUList& nbrFaceCells = nbrPatch.faceCells(); + + setMethod(); + + const scalarField nbrIntT + ( + nbrThermoPtr_->T().internalField(), nbrFaceCells + ); + + scalarField intNbrT = + regionCoupledPatch_.regionCoupledPatch().interpolate(nbrIntT); + + label patchi = patch().index(); + const scalarField& pp = thermoPtr_->p().boundaryField()[patchi]; + tmp<scalarField> tmyHE = thermoPtr_->he(pp, intNbrT, patchi); + + return tmyHE; +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +patchNeighbourTemperatureField() const +{ + const fvPatch& nbrPatch = regionCoupledPatch_.neighbFvPatch(); + + const labelUList& nbrFaceCells = nbrPatch.faceCells(); + + const scalarField nbrIntT + ( + nbrThermoPtr_->T().internalField(), nbrFaceCells + ); + + tmp<scalarField> tintNbrT = + regionCoupledPatch_.regionCoupledPatch().interpolate(nbrIntT); + + return tintNbrT; +} + + +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +patchInternalTemperatureField() const +{ + const labelUList& faceCells = regionCoupledPatch_.faceCells(); + + tmp<scalarField> tintT + ( + new scalarField(thermoPtr_->T().internalField(), faceCells) + ); + + return tintT; +} + + +void Foam::energyRegionCoupledFvPatchScalarField::updateInterfaceMatrix +( + Field<scalar>& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes +) const +{ + setMethod(); + + scalarField myHE(this->size()); + + if (&psiInternal == &internalField()) + { + + label patchi = this->patch().index(); + const scalarField& pp = thermoPtr_->p().boundaryField()[patchi]; + const scalarField& Tp = thermoPtr_->T().boundaryField()[patchi]; + + myHE = thermoPtr_->he(pp, Tp, patchi); + } + else + { + forAll(*this, facei) + { + myHE[facei] = psiInternal[regionCoupledPatch_.faceCells()[facei]]; + } + } + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = regionCoupledPatch_.faceCells(); + + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*myHE[elemI]; + } +} + + +void Foam::energyRegionCoupledFvPatchScalarField::updateInterfaceMatrix +( + Field<scalar>& result, + const Field<scalar>& psiInternal, + const scalarField& coeffs, + const Pstream::commsTypes +) const +{ + setMethod(); + + scalarField myHE(this->size()); + + if (&psiInternal == &internalField()) + { + label patchi = this->patch().index(); + const scalarField& pp = thermoPtr_->p().boundaryField()[patchi]; + const scalarField& Tp = thermoPtr_->T().boundaryField()[patchi]; + + myHE = thermoPtr_->he(pp, Tp, patchi); + } + else + { + forAll(*this, facei) + { + myHE[facei] = psiInternal[regionCoupledPatch_.faceCells()[facei]]; + } + } + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = regionCoupledPatch_.faceCells(); + + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*myHE[elemI]; + } +} + + +void Foam::energyRegionCoupledFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField<scalar>::write(os); + this->writeEntry("value", os); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + energyRegionCoupledFvPatchScalarField + ); +}; + + +// ************************************************************************* // diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..7b0b7df39c39cc18c7285241510d363bb7fbedce --- /dev/null +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H @@ -0,0 +1,287 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +Class + Foam::energyRegionCoupledFvPatchScalarField + +Description + Energy region coupled implicit boundary condition. + The fvPatch is treated as uncoupled from the delta point of view. + In the mesh the fvPatch is an interface and is incorporated + into the matrix implicitly. + +SourceFiles + energyRegionCoupledFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef energyRegionCoupledFvPatchScalarField_H +#define energyRegionCoupledFvPatchScalarField_H + +#include "regionCoupledBaseFvPatch.H" +#include "LduInterfaceField.H" +#include "fvPatchField.H" +#include "NamedEnum.H" +#include "basicThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class energyRegionCoupledFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class energyRegionCoupledFvPatchScalarField +: + public LduInterfaceField<scalar>, + public fvPatchScalarField +{ +public: + + enum kappaMethodType + { + SOLID, + FLUID, + UNDEFINED + }; + + +private: + + // Private data + + //- Local reference to region couple patch + const regionCoupledBaseFvPatch& regionCoupledPatch_; + + //- Methof to extract kappa + static const NamedEnum<kappaMethodType, 3> methodTypeNames_; + + //- How to get K + mutable kappaMethodType method_; + + //- AutoPtr to nbr thermo + mutable const basicThermo* nbrThermoPtr_; + + //- AutoPtr to my thermo + mutable const basicThermo* thermoPtr_; + + + // Private functions + + //- Local weight for this coupled field + tmp<scalarField> weights() const; + + //- Return nbr temperature internal field + tmp<scalarField> patchNeighbourTemperatureField() const; + + //- Return local temperature internal field + tmp<scalarField> patchInternalTemperatureField() const; + + //- Return kappa + tmp<scalarField> kappa() const; + + //- Set method + void setMethod() const; + + +public: + + //- Runtime type information + TypeName("compressible::energyRegionCoupled"); + + + // Constructors + + //- Construct from patch and internal field + energyRegionCoupledFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + energyRegionCoupledFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given energyRegionCoupledFvPatchScalarField + // onto a new patch + energyRegionCoupledFvPatchScalarField + ( + const energyRegionCoupledFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + energyRegionCoupledFvPatchScalarField + ( + const energyRegionCoupledFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<scalar> > clone() const + { + return tmp<fvPatchField<scalar> > + ( + new energyRegionCoupledFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + energyRegionCoupledFvPatchScalarField + ( + const energyRegionCoupledFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + + //- Destructor + virtual ~energyRegionCoupledFvPatchScalarField() + {} + + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<scalar> > clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchField<scalar> > + ( + new energyRegionCoupledFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + + // Access + + //- Return true if this patch field is coupled + virtual bool coupled() const + { + return true; + } + + //- Method to obtain K + word kappaMethod() const + { + return methodTypeNames_[method_]; + } + + + // Evaluation functions + + //- Return neighbour coupled internal cell data + virtual tmp<scalarField> patchNeighbourField() const; + + //- Return patch-normal gradient + virtual tmp<scalarField> snGrad() const; + + //- Initialise the evaluation of the patch field + virtual void initEvaluate + ( + const Pstream::commsTypes commsType + ); + + //- Evaluate the patch field + virtual void evaluate + ( + const Pstream::commsTypes commsType + ); + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp<scalarField> valueInternalCoeffs + ( + const tmp<scalarField>& + ) const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp<scalarField> valueBoundaryCoeffs + ( + const tmp<scalarField>& + ) const; + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp<scalarField> gradientInternalCoeffs() const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp<scalarField> gradientBoundaryCoeffs() const; + + + // Coupled interface functionality + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + Field<scalar>& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + Field<scalar>&, + const Field<scalar>&, + const scalarField&, + const Pstream::commsTypes commsType + ) const; + + //- Return the interface type + virtual const word& interfaceFieldType() const + { + return regionCoupledPatch_.regionCoupleType(); + } + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index f3902a033db0ca797deadbd4463561938f028dda..1457ce6d02edada767008bf1a8a54efb283878f1 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -32,6 +32,7 @@ License #include "fixedJumpAMIFvPatchFields.H" #include "energyJumpFvPatchScalarField.H" #include "energyJumpAMIFvPatchScalarField.H" +#include "energyRegionCoupledFvPatchScalarField.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -69,6 +70,10 @@ Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes() { hbt[patchi] = energyJumpAMIFvPatchScalarField::typeName; } + else if (isA<energyRegionCoupledFvPatchScalarField>(tbf[patchi])) + { + hbt[patchi] = energyRegionCoupledFvPatchScalarField::typeName; + } } return hbt; diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/files b/src/turbulenceModels/compressible/turbulenceModel/Make/files index 3544505a7289f81a4d689d75858d3340ee3c1a59..8098341f4b13880b297c2468cd61ce438ce1d059 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/Make/files +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/files @@ -9,4 +9,5 @@ derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffu derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel