GGI SAMG interface field
This commit is contained in:
parent
5ac0d32666
commit
b92474c8d4
3 changed files with 322 additions and 0 deletions
|
@ -330,6 +330,7 @@ SAMGInterfaceFields = $(AMG)/interfaceFields/SAMGInterfaceFields
|
||||||
$(SAMGInterfaceFields)/SAMGInterfaceField/SAMGInterfaceField.C
|
$(SAMGInterfaceFields)/SAMGInterfaceField/SAMGInterfaceField.C
|
||||||
$(SAMGInterfaceFields)/SAMGInterfaceField/newSAMGInterfaceField.C
|
$(SAMGInterfaceFields)/SAMGInterfaceField/newSAMGInterfaceField.C
|
||||||
$(SAMGInterfaceFields)/processorSAMGInterfaceField/processorSAMGInterfaceField.C
|
$(SAMGInterfaceFields)/processorSAMGInterfaceField/processorSAMGInterfaceField.C
|
||||||
|
$(SAMGInterfaceFields)/ggiSAMGInterfaceField/ggiSAMGInterfaceField.C
|
||||||
|
|
||||||
AMGAgglomerations = $(AMG)/AMGAgglomerations
|
AMGAgglomerations = $(AMG)/AMGAgglomerations
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ggiSAMGInterfaceField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "lduMatrix.H"
|
||||||
|
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(ggiSAMGInterfaceField, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
SAMGInterfaceField,
|
||||||
|
ggiSAMGInterfaceField,
|
||||||
|
lduInterface
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ggiSAMGInterfaceField::ggiSAMGInterfaceField
|
||||||
|
(
|
||||||
|
const SAMGInterface& SAMGCp,
|
||||||
|
const lduInterfaceField& fineInterface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
SAMGInterfaceField(SAMGCp, fineInterface),
|
||||||
|
ggiInterface_(refCast<const ggiSAMGInterface>(SAMGCp)),
|
||||||
|
doTransform_(false),
|
||||||
|
rank_(0)
|
||||||
|
{
|
||||||
|
const ggiLduInterfaceField& p =
|
||||||
|
refCast<const ggiLduInterfaceField>(fineInterface);
|
||||||
|
|
||||||
|
doTransform_ = p.doTransform();
|
||||||
|
rank_ = p.rank();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ggiSAMGInterfaceField::~ggiSAMGInterfaceField()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::ggiSAMGInterfaceField::initInterfaceMatrixUpdate
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes commsType,
|
||||||
|
const bool switchToLhs
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// This must have a reduce in it. HJ, 15/May/2009
|
||||||
|
ggiInterface_.initInternalFieldTransfer(commsType, psiInternal);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ggiSAMGInterfaceField::updateInterfaceMatrix
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes commsType,
|
||||||
|
const bool switchToLhs
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Get expanded data to zone size. No global reduce allowed
|
||||||
|
// HJ, 15/May/2009
|
||||||
|
scalarField pnf =
|
||||||
|
ggiInterface_.internalFieldTransfer(commsType, psiInternal);
|
||||||
|
transformCoupleField(pnf, cmpt);
|
||||||
|
|
||||||
|
const unallocLabelList& faceCells = ggiInterface_.faceCells();
|
||||||
|
|
||||||
|
// New treatment. HJ, 26/Jun/2011
|
||||||
|
if (pnf.size() != faceCells.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn("ggiSAMGInterfaceField::updateInterfaceMatrix")
|
||||||
|
<< "Error in interface update: incorrect size of zone fields" << nl
|
||||||
|
<< "Field size = " << pnf.size()
|
||||||
|
<< " Zone size = " << faceCells.size()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switchToLhs)
|
||||||
|
{
|
||||||
|
forAll(faceCells, elemI)
|
||||||
|
{
|
||||||
|
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(faceCells, elemI)
|
||||||
|
{
|
||||||
|
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ggiSAMGInterfaceField
|
||||||
|
|
||||||
|
Description
|
||||||
|
AMG selected ggi interface field.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ggiSAMGInterfaceField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ggiSAMGInterfaceField_H
|
||||||
|
#define ggiSAMGInterfaceField_H
|
||||||
|
|
||||||
|
#include "SAMGInterfaceField.H"
|
||||||
|
#include "ggiSAMGInterface.H"
|
||||||
|
#include "ggiLduInterfaceField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ggiSAMGInterfaceField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ggiSAMGInterfaceField
|
||||||
|
:
|
||||||
|
public SAMGInterfaceField,
|
||||||
|
virtual public ggiLduInterfaceField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Local reference cast into the ggi interface
|
||||||
|
const ggiSAMGInterface& ggiInterface_;
|
||||||
|
|
||||||
|
//- Is the transform required
|
||||||
|
bool doTransform_;
|
||||||
|
|
||||||
|
//- Rank of component for transformation
|
||||||
|
int rank_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
ggiSAMGInterfaceField(const ggiSAMGInterfaceField&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ggiSAMGInterfaceField&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("ggi");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from AMG interface and fine level interface field
|
||||||
|
ggiSAMGInterfaceField
|
||||||
|
(
|
||||||
|
const SAMGInterface& SAMGCp,
|
||||||
|
const lduInterfaceField& fineInterfaceField
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ggiSAMGInterfaceField();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return size
|
||||||
|
label size() const
|
||||||
|
{
|
||||||
|
return ggiInterface_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Coupled interface matrix update
|
||||||
|
|
||||||
|
//- Transform neighbour field
|
||||||
|
virtual void transformCoupleField
|
||||||
|
(
|
||||||
|
scalarField& pnf,
|
||||||
|
const direction cmpt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ggiLduInterfaceField::transformCoupleField(pnf, cmpt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- 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 bool switchToLhs
|
||||||
|
) 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 bool switchToLhs
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Ggi interface functions
|
||||||
|
|
||||||
|
//- Does the interface field perform the transfromation
|
||||||
|
virtual bool doTransform() const
|
||||||
|
{
|
||||||
|
return doTransform_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return face transformation tensor
|
||||||
|
virtual const tensorField& forwardT() const
|
||||||
|
{
|
||||||
|
return ggiInterface_.forwardT();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return neighbour-cell transformation tensor
|
||||||
|
virtual const tensorField& reverseT() const
|
||||||
|
{
|
||||||
|
return ggiInterface_.reverseT();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return rank of component for transform
|
||||||
|
virtual int rank() const
|
||||||
|
{
|
||||||
|
return rank_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Reference in a new issue