cyclicAMIGAMGInterfaceField.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2013 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31#include "lduMatrix.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
39 (
43 );
45 (
49 );
50}
51
52
53// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54
56(
57 const GAMGInterface& GAMGCp,
58 const lduInterfaceField& fineInterface
59)
60:
61 GAMGInterfaceField(GAMGCp, fineInterface),
62 cyclicAMIInterface_(refCast<const cyclicAMIGAMGInterface>(GAMGCp)),
63 doTransform_(false),
64 rank_(0)
65{
67 refCast<const cyclicAMILduInterfaceField>(fineInterface);
68
69 doTransform_ = p.doTransform();
70 rank_ = p.rank();
71}
72
73
75(
76 const GAMGInterface& GAMGCp,
77 const bool doTransform,
78 const int rank
79)
80:
81 GAMGInterfaceField(GAMGCp, doTransform, rank),
82 cyclicAMIInterface_(refCast<const cyclicAMIGAMGInterface>(GAMGCp)),
83 doTransform_(doTransform),
84 rank_(rank)
85{}
86
87
88// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89
91{}
92
93
94// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95
97(
98 solveScalarField& result,
99 const bool add,
100 const lduAddressing& lduAddr,
101 const label patchId,
102 const solveScalarField& psiInternal,
103 const scalarField& coeffs,
104 const direction cmpt,
106) const
107{
108 // Get neighbouring field
109
110 const labelList& nbrFaceCells =
111 lduAddr.patchAddr
112 (
113 cyclicAMIInterface_.neighbPatchID()
114 );
115
116 solveScalarField pnf(psiInternal, nbrFaceCells);
117
118 // Transform according to the transformation tensors
119 transformCoupleField(pnf, cmpt);
120
121 if (cyclicAMIInterface_.owner())
122 {
123 pnf = cyclicAMIInterface_.AMI().interpolateToSource(pnf);
124 }
125 else
126 {
127 pnf = cyclicAMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
128 }
129
130 const labelUList& faceCells = lduAddr.patchAddr(patchId);
131
132 this->addToInternalField(result, !add, faceCells, coeffs, pnf);
133}
134
135
136// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Abstract base class for GAMG agglomerated interface fields.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:57
commsTypes
Types of communications.
Definition: UPstream.H:67
GAMG agglomerated cyclic interface field.
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
GAMG agglomerated cyclic AMI interface.
Abstract base class for cyclic AMI coupled interfaces.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
volScalarField & p
label patchId(-1)
Namespace for OpenFOAM.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
uint8_t direction
Definition: direction.H:56