Loading...
Searching...
No Matches
cyclicGAMGInterfaceField.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,2023 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 );
51 (
55 );
56
57 // Add under name cyclicSlip
59 (
63 cyclicSlip
64 );
66 (
70 cyclicSlip
71 );
73 (
76 Istream,
77 cyclicSlip
78 );
79}
80
81
82// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
83
84Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
85(
86 const GAMGInterface& GAMGCp,
87 const lduInterfaceField& fineInterface
88)
89:
90 GAMGInterfaceField(GAMGCp, fineInterface),
91 cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
92 doTransform_(false),
93 rank_(0)
94{
97
98 doTransform_ = p.doTransform();
99 rank_ = p.rank();
100}
101
102
103Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
104(
105 const GAMGInterface& GAMGCp,
106 const bool doTransform,
107 const int rank
108)
109:
110 GAMGInterfaceField(GAMGCp, doTransform, rank),
111 cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
112 doTransform_(doTransform),
113 rank_(rank)
114{}
115
116
117Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
118(
119 const GAMGInterface& GAMGCp,
120 Istream& is
121)
122:
123 GAMGInterfaceField(GAMGCp, is),
124 cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
125 doTransform_(readBool(is)),
126 rank_(readLabel(is))
127{}
128
129
130Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
131(
132 const GAMGInterface& GAMGCp,
134 const UPtrList<lduInterfaceField>& other
135)
136:
137 GAMGInterfaceField(GAMGCp, local),
138 cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
139 doTransform_(false),
140 rank_(0)
141{
143
144 doTransform_ = p.doTransform();
145 rank_ = p.rank();
146}
147
148
149// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
150
152(
153 solveScalarField& result,
154 const bool add,
155 const lduAddressing& lduAddr,
156 const label patchId,
157 const solveScalarField& psiInternal,
158 const scalarField& coeffs,
159 const direction cmpt,
161) const
162{
163 // Get neighbouring field
164
165 const auto& nbrFaceCells =
166 lduAddr.patchAddr
167 (
168 cyclicInterface_.neighbPatchID()
169 );
170
171 solveScalarField pnf(psiInternal, nbrFaceCells);
172
173 transformCoupleField(pnf, cmpt);
175 const auto& faceCells = lduAddr.patchAddr(patchId);
176
177 this->addToInternalField(result, !add, faceCells, coeffs, pnf);
178}
179
180
182{
183 //GAMGInterfaceField::write(os);
184 os << token::SPACE << doTransform()
185 << token::SPACE << rank();
186}
187
188
189// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#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.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
commsTypes
Communications types.
Definition UPstream.H:81
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
GAMG agglomerated cyclic interface field.
virtual bool doTransform() const
Cyclic interface functions.
virtual int rank() const
Return rank of component for transform.
virtual void write(Ostream &) const
Write to stream.
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 interface.
Abstract base class for cyclic coupled interfaces.
cyclicLduInterfaceField()=default
Construct null.
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
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...
void addToInternalField(Field< Type > &result, const bool add, const labelUList &faceCells, const scalarField &coeffs, const Field< Type > &vals) const
Add/subtract weighted contributions to internal field.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
@ SPACE
Space [isspace].
Definition token.H:144
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
volScalarField & p
bool local
Definition EEqn.H:20
OBJstream os(runTime.globalPath()/outputName)
label patchId(-1)
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition label.H:63
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
bool readBool(Istream &is)
Read bool from stream using Foam::Switch(Istream&).
Definition bool.C:72