cyclicFvPatchField.H
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-2016 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
27Class
28 Foam::cyclicFvPatchField
29
30Group
31 grpCoupledBoundaryConditions
32
33Description
34 This boundary condition enforces a cyclic condition between a pair of
35 boundaries.
36
37Usage
38 Example of the boundary condition specification:
39 \verbatim
40 <patchName>
41 {
42 type cyclic;
43 }
44 \endverbatim
45
46Note
47 The patches must be topologically similar, i.e. if the owner patch is
48 transformed to the neighbour patch, the patches should be identical (or
49 very similar).
50
51SourceFiles
52 cyclicFvPatchField.C
53
54\*---------------------------------------------------------------------------*/
55
56#ifndef cyclicFvPatchField_H
57#define cyclicFvPatchField_H
58
59#include "coupledFvPatchField.H"
61#include "cyclicFvPatch.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
67
68/*---------------------------------------------------------------------------*\
69 Class cyclicFvPatch Declaration
70\*---------------------------------------------------------------------------*/
71
72template<class Type>
74:
75 virtual public cyclicLduInterfaceField,
76 public coupledFvPatchField<Type>
77{
78 // Private data
79
80 //- Local reference cast into the cyclic patch
81 const cyclicFvPatch& cyclicPatch_;
82
83
84 // Private Member Functions
85
86 //- Return neighbour side field given internal fields
87 template<class Type2>
88 tmp<Field<Type2>> neighbourSideField
89 (
90 const Field<Type2>&
91 ) const;
92
93
94public:
95
96
97 //- Runtime type information
98 TypeName(cyclicFvPatch::typeName_());
99
100
101 // Constructors
102
103 //- Construct from patch and internal field
105 (
106 const fvPatch&,
108 );
109
110 //- Construct from patch, internal field and dictionary
112 (
113 const fvPatch&,
115 const dictionary&,
116 const bool valueRequired = true
117 );
118
119 //- Construct by mapping given cyclicFvPatchField onto a new patch
121 (
123 const fvPatch&,
125 const fvPatchFieldMapper&
126 );
127
128 //- Construct as copy
130 (
132 );
133
134 //- Construct and return a clone
135 virtual tmp<fvPatchField<Type>> clone() const
136 {
138 (
139 new cyclicFvPatchField<Type>(*this)
140 );
141 }
142
143 //- Construct as copy setting internal field reference
145 (
148 );
149
150 //- Construct and return a clone setting internal field reference
152 (
154 ) const
155 {
157 (
158 new cyclicFvPatchField<Type>(*this, iF)
159 );
160 }
161
162
163 // Member functions
164
165 // Access
166
167 //- Return local reference cast into the cyclic patch
168 const cyclicFvPatch& cyclicPatch() const
169 {
170 return cyclicPatch_;
171 }
172
173
174 // Evaluation functions
175
176 //- Return neighbour coupled internal cell data
178
179 //- Return reference to neighbour patchField
181
182 //- Update result field based on interface functionality
183 virtual void updateInterfaceMatrix
184 (
185 solveScalarField& result,
186 const bool add,
187 const lduAddressing& lduAddr,
188 const label patchId,
189 const solveScalarField& psiInternal,
190 const scalarField& coeffs,
191 const direction cmpt,
192 const Pstream::commsTypes commsType
193 ) const;
194
195 //- Update result field based on interface functionality
196 virtual void updateInterfaceMatrix
197 (
198 Field<Type>& result,
199 const bool add,
200 const lduAddressing& lduAddr,
201 const label patchId,
202 const Field<Type>& psiInternal,
203 const scalarField& coeffs,
204 const Pstream::commsTypes commsType
205 ) const;
206
207
208 //- Manipulate matrix
209 virtual void manipulateMatrix
210 (
212 const label iMatrix,
213 const direction cmp
214 );
215
216
217
218 // Cyclic coupled interface functions
219
220 //- Does the patch field perform the transformation
221 virtual bool doTransform() const
222 {
223 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
224 }
225
226 //- Return face transformation tensor
227 virtual const tensorField& forwardT() const
228 {
229 return cyclicPatch_.forwardT();
230 }
231
232 //- Return neighbour-cell transformation tensor
233 virtual const tensorField& reverseT() const
234 {
235 return cyclicPatch_.reverseT();
236 }
237
238 //- Return rank of component for transform
239 virtual int rank() const
240 {
241 return pTraits<Type>::rank;
242 }
243
244
245 // I-O
246
247 //- Write
248 virtual void write(Ostream& os) const;
249};
250
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253
254} // End namespace Foam
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258#ifdef NoRepository
259 #include "cyclicFvPatchField.C"
260#endif
261
262// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263
264#endif
265
266// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
commsTypes
Types of communications.
Definition: UPstream.H:67
Abstract base class for coupled patches.
This boundary condition enforces a cyclic condition between a pair of boundaries.
const cyclicFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
virtual bool doTransform() const
Does the patch field perform the transformation.
virtual int rank() const
Return rank of component for transform.
TypeName(cyclicFvPatch::typeName_())
Runtime type information.
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.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
virtual void manipulateMatrix(fvMatrix< Type > &m, const label iMatrix, const direction cmp)
Manipulate matrix.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Cyclic-plane patch.
Definition: cyclicFvPatch.H:58
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Abstract base class for cyclic coupled interfaces.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
A class for managing temporary objects.
Definition: tmp.H:65
OBJstream os(runTime.globalPath()/outputName)
label patchId(-1)
Namespace for OpenFOAM.
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
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73