Feature: regionCoupling with AMG solvers

This commit is contained in:
Hrvoje Jasak 2011-10-12 19:56:51 +01:00
parent 72c06f38bd
commit 3958f5bfa8
13 changed files with 499 additions and 28 deletions

View file

@ -276,6 +276,7 @@ $(GAMGInterfaces)/processorGAMGInterface/processorGAMGInterface.C
$(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C $(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C
$(GAMGInterfaces)/ggiGAMGInterface/ggiGAMGInterface.C $(GAMGInterfaces)/ggiGAMGInterface/ggiGAMGInterface.C
$(GAMGInterfaces)/cyclicGgiGAMGInterface/cyclicGgiGAMGInterface.C $(GAMGInterfaces)/cyclicGgiGAMGInterface/cyclicGgiGAMGInterface.C
$(GAMGInterfaces)/regionCoupleGAMGInterface/regionCoupleGAMGInterface.C
/*$(GAMGInterfaces)/mixingPlaneGAMGInterface/mixingPlaneGAMGInterface.C*/ /*$(GAMGInterfaces)/mixingPlaneGAMGInterface/mixingPlaneGAMGInterface.C*/
GAMGInterfaceFields = $(GAMG)/interfaceFields GAMGInterfaceFields = $(GAMG)/interfaceFields
@ -285,6 +286,7 @@ $(GAMGInterfaceFields)/processorGAMGInterfaceField/processorGAMGInterfaceField.C
$(GAMGInterfaceFields)/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C $(GAMGInterfaceFields)/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C
$(GAMGInterfaceFields)/ggiGAMGInterfaceField/ggiGAMGInterfaceField.C $(GAMGInterfaceFields)/ggiGAMGInterfaceField/ggiGAMGInterfaceField.C
$(GAMGInterfaceFields)/cyclicGgiGAMGInterfaceField/cyclicGgiGAMGInterfaceField.C $(GAMGInterfaceFields)/cyclicGgiGAMGInterfaceField/cyclicGgiGAMGInterfaceField.C
$(GAMGInterfaceFields)/regionCoupleGAMGInterfaceField/regionCoupleGAMGInterfaceField.C
/*$(GAMGInterfaceFields)/mixingPlaneGAMGInterfaceField/mixingPlaneGAMGInterfaceField.C*/ /*$(GAMGInterfaceFields)/mixingPlaneGAMGInterfaceField/mixingPlaneGAMGInterfaceField.C*/
GAMGAgglomerations = $(GAMG)/GAMGAgglomerations GAMGAgglomerations = $(GAMG)/GAMGAgglomerations

View file

@ -84,6 +84,9 @@ public:
// Access // Access
//- Return true if interface is coupled
virtual bool coupled() const = 0;
//- Return faceCell addressing //- Return faceCell addressing
virtual const unallocLabelList& faceCells() const = 0; virtual const unallocLabelList& faceCells() const = 0;

View file

@ -216,6 +216,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
forAll (fineInterfaces, inti) forAll (fineInterfaces, inti)
{ {
if (fineInterfaces.set(inti)) if (fineInterfaces.set(inti))
{
if (fineInterfaces[inti].coupled())
{ {
fineInterfaces[inti].initInternalFieldTransfer fineInterfaces[inti].initInternalFieldTransfer
( (
@ -224,6 +226,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
); );
} }
} }
}
// Store coefficients to avoid tangled communications // Store coefficients to avoid tangled communications
// HJ, 1/Apr/2009 // HJ, 1/Apr/2009
@ -232,6 +235,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
forAll (fineInterfaces, inti) forAll (fineInterfaces, inti)
{ {
if (fineInterfaces.set(inti)) if (fineInterfaces.set(inti))
{
if (fineInterfaces[inti].coupled())
{ {
fineInterfaceAddr.set fineInterfaceAddr.set
( (
@ -247,6 +252,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
); );
} }
} }
}
// Add the coarse level // Add the coarse level
@ -278,6 +284,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
forAll (fineInterfaces, inti) forAll (fineInterfaces, inti)
{ {
if (fineInterfaces.set(inti)) if (fineInterfaces.set(inti))
{
if (fineInterfaces[inti].coupled())
{ {
coarseInterfaces.set coarseInterfaces.set
( (
@ -286,7 +294,10 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
( (
meshLevels_[fineLevelIndex], meshLevels_[fineLevelIndex],
fineInterfaces[inti], fineInterfaces[inti],
fineInterfaces[inti].interfaceInternalField(restrictMap), fineInterfaces[inti].interfaceInternalField
(
restrictMap
),
fineInterfaceAddr[inti] fineInterfaceAddr[inti]
).ptr() ).ptr()
); );
@ -294,6 +305,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
coarseInterfaceAddr[inti] = coarseInterfaces[inti].faceCells(); coarseInterfaceAddr[inti] = coarseInterfaces[inti].faceCells();
} }
} }
}
meshLevels_[fineLevelIndex].addInterfaces meshLevels_[fineLevelIndex].addInterfaces
( (

View file

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "regionCoupleGAMGInterfaceField.H"
#include "addToRunTimeSelectionTable.H"
#include "lduMatrix.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(regionCoupleGAMGInterfaceField, 0);
addToRunTimeSelectionTable
(
GAMGInterfaceField,
regionCoupleGAMGInterfaceField,
lduInterface
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionCoupleGAMGInterfaceField::regionCoupleGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterface
)
:
ggiGAMGInterfaceField(GAMGCp, fineInterface),
regionCoupleInterface_(refCast<const regionCoupleGAMGInterface>(GAMGCp))
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
Foam::regionCoupleGAMGInterfaceField::~regionCoupleGAMGInterfaceField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionCoupleGAMGInterfaceField::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
// This must have a reduce in it. HJ, 15/May/2009
if (regionCoupleInterface_.coupled())
{
ggiGAMGInterfaceField::initInterfaceMatrixUpdate
(
psiInternal,
result,
m,
coeffs,
cmpt,
commsType
);
}
}
void Foam::regionCoupleGAMGInterfaceField::updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
// Get expanded data to zone size. No global reduce allowed
// HJ, 15/May/2009
if (regionCoupleInterface_.coupled())
{
ggiGAMGInterfaceField::updateInterfaceMatrix
(
psiInternal,
result,
m,
coeffs,
cmpt,
commsType
);
}
}
// ************************************************************************* //

View file

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::regionCoupleGAMGInterfaceField
Description
GAMG agglomerated regionCouple interface field.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
regionCoupleGAMGInterfaceField.C
\*---------------------------------------------------------------------------*/
#ifndef regionCoupleGAMGInterfaceField_H
#define regionCoupleGAMGInterfaceField_H
#include "regionCoupleGAMGInterface.H"
#include "ggiGAMGInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionCoupleGAMGInterfaceField Declaration
\*---------------------------------------------------------------------------*/
class regionCoupleGAMGInterfaceField
:
public ggiGAMGInterfaceField
{
// Private data
//- Local reference cast into the regionCouple interface
const regionCoupleGAMGInterface& regionCoupleInterface_;
public:
//- Runtime type information
TypeName("regionCouple");
// Constructors
//- Construct from GAMG interface and fine level interface field
regionCoupleGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterfaceField
);
// Destructor
virtual ~regionCoupleGAMGInterfaceField();
// Member Functions
// Interface matrix update
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -95,6 +95,15 @@ public:
// Member Functions // Member Functions
// Access
//- Return true if interface is coupled
virtual bool coupled() const
{
return true;
}
// Interface transfer functions // Interface transfer functions
//- Transfer and return neighbour field //- Transfer and return neighbour field

View file

@ -138,6 +138,15 @@ public:
// Member Functions // Member Functions
// Access
//- Return true if interface is coupled
virtual bool coupled() const
{
return true;
}
// Agglomeration // Agglomeration
//- Agglomerating the given fine-level coefficients and return //- Agglomerating the given fine-level coefficients and return

View file

@ -95,6 +95,15 @@ public:
// Member Functions // Member Functions
// Access
//- Return true if interface is coupled
virtual bool coupled() const
{
return true;
}
// Interface transfer functions // Interface transfer functions
//- Initialise interface data transfer //- Initialise interface data transfer

View file

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "regionCoupleGAMGInterface.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(regionCoupleGAMGInterface, 0);
addToRunTimeSelectionTable
(
GAMGInterface,
regionCoupleGAMGInterface,
lduInterface
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionCoupleGAMGInterface::regionCoupleGAMGInterface
(
const lduPrimitiveMesh& lduMesh,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
)
:
ggiGAMGInterface
(
lduMesh,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing
),
coupled_(fineInterface.coupled())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupleGAMGInterface::~regionCoupleGAMGInterface()
{}
// ************************************************************************* //

View file

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::regionCoupleGAMGInterface
Description
GAMG agglomerated regionCouple interface.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
regionCoupleGAMGInterface.C
\*---------------------------------------------------------------------------*/
#ifndef regionCoupleGAMGInterface_H
#define regionCoupleGAMGInterface_H
#include "ggiGAMGInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionCoupleGAMGInterface Declaration
\*---------------------------------------------------------------------------*/
class regionCoupleGAMGInterface
:
public ggiGAMGInterface
{
// Private data
//- Is the interface coupled?
const bool coupled_;
public:
//- Runtime type information
TypeName("regionCouple");
// Constructors
//- Construct from fine level interface,
// local and neighbour restrict addressing
regionCoupleGAMGInterface
(
const lduPrimitiveMesh& lduMesh,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
);
// Destructor
virtual ~regionCoupleGAMGInterface();
// Member Functions
// Access
//- Return true if interface is coupled
virtual bool coupled() const
{Info<< "BANANA" << endl;
return coupled_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -156,7 +156,7 @@ public:
// Access // Access
//- Return true because this patch is coupled //- Return true if patch is coupled
virtual bool coupled() const virtual bool coupled() const
{ {
return true; return true;

View file

@ -85,8 +85,12 @@ void Foam::ggiPolyPatch::calcZoneAddressing() const
// Check zone addressing // Check zone addressing
if (zAddr.size() > 0 && min(zAddr) < 0) if (zAddr.size() > 0 && min(zAddr) < 0)
{ {
Info<< "myZone: " << myZone << nl
<< "my start and size: " << start() << " and " << size() << nl
<< "zAddr: " << zAddr << endl;
FatalErrorIn("void ggiPolyPatch::calcZoneAddressing() const") FatalErrorIn("void ggiPolyPatch::calcZoneAddressing() const")
<< "Problem with patch-to zone addressing: some patch faces " << "Problem with patch-to-zone addressing: some patch faces "
<< "not found in interpolation zone" << "not found in interpolation zone"
<< abort(FatalError); << abort(FatalError);
} }
@ -439,6 +443,9 @@ void Foam::ggiPolyPatch::clearOut()
{ {
clearGeom(); clearGeom();
shadowIndex_ = -1;
zoneIndex_ = -1;
deleteDemandDrivenData(zoneAddressingPtr_); deleteDemandDrivenData(zoneAddressingPtr_);
deleteDemandDrivenData(patchToPatchPtr_); deleteDemandDrivenData(patchToPatchPtr_);
deleteDemandDrivenData(localParallelPtr_); deleteDemandDrivenData(localParallelPtr_);

View file

@ -102,7 +102,7 @@ public:
// Access // Access
//- Return true because this patch is coupled //- Return true if patch is coupled
virtual bool coupled() const virtual bool coupled() const
{ {
return coupledPolyPatch_.coupled(); return coupledPolyPatch_.coupled();