cyclicFaPatchField.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) 2016-2017 Wikki Ltd
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::cyclicFaPatchField
29
30Description
31 Foam::cyclicFaPatchField
32
33Author
34 Zeljko Tukovic, FMENA
35 Hrvoje Jasak, Wikki Ltd.
36
37SourceFiles
38 cyclicFaPatchField.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef cyclicFaPatchField_H
43#define cyclicFaPatchField_H
44
45#include "coupledFaPatchField.H"
47#include "cyclicFaPatch.H"
48#include "areaFaMesh.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class cyclicFaPatchField Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class Type>
61:
62 virtual public cyclicLduInterfaceField,
63 public coupledFaPatchField<Type>
64{
65 // Private data
66
67 //- Local reference cast into the cyclic patch
68 const cyclicFaPatch& cyclicPatch_;
69
70
71 // Private member functions
72
73 //- Return neighbour side field given internal fields
74 template<class Type2>
75 tmp<Field<Type2>> neighbourSideField
76 (
77 const Field<Type2>&
78 ) const;
79
80
81public:
82
83 //- Runtime type information
84 TypeName(cyclicFaPatch::typeName_());
85
86
87 // Constructors
88
89 //- Construct from patch and internal field
91 (
92 const faPatch&,
94 );
95
96 //- Construct from patch, internal field and dictionary
98 (
99 const faPatch&,
101 const dictionary&
102 );
103
104 //- Construct by mapping given cyclicFaPatchField onto a new patch
106 (
108 const faPatch&,
110 const faPatchFieldMapper&
111 );
112
113 //- Construct as copy
115 (
117 );
118
119 //- Construct and return a clone
120 virtual tmp<faPatchField<Type>> clone() const
121 {
123 (
124 new cyclicFaPatchField<Type>(*this)
125 );
126 }
127
128 //- Construct as copy setting internal field reference
130 (
133 );
134
135 //- Construct and return a clone setting internal field reference
137 (
139 ) const
140 {
142 (
143 new cyclicFaPatchField<Type>(*this, iF)
144 );
145 }
146
147
148 // Member functions
149
150 // Access
151
152 //- Return local reference cast into the cyclic patch
153 const cyclicFaPatch& cyclicPatch() const
154 {
155 return cyclicPatch_;
156 }
157
158
159 // Evaluation functions
160
161 //- Return neighbour coupled given internal cell data
162 virtual tmp<Field<Type>> patchNeighbourField() const;
163
164
165 // Coupled interface functionality
166
167 //- Transform neighbour field
168 virtual void transformCoupleField
169 (
171 const direction cmpt
172 ) const
173 {
175 }
176
177 //- Update result field based on interface functionality
178 virtual void updateInterfaceMatrix
179 (
180 solveScalarField& result,
181 const bool add,
182 const lduAddressing& lduAddr,
183 const label patchId,
184 const solveScalarField& psiInternal,
185 const scalarField& coeffs,
186 const direction cmpt,
187 const Pstream::commsTypes commsType
188 ) const;
189
190 //- Update result field based on interface functionality
191 virtual void updateInterfaceMatrix
192 (
193 Field<Type>& result,
194 const bool add,
195 const lduAddressing& lduAddr,
196 const label patchId,
197 const Field<Type>&,
198 const scalarField& coeffs,
199 const Pstream::commsTypes commsType
200 ) const;
201
202
203 //- Cyclic coupled interface functions
204
205 //- Does the patch field perform the transformation
206 virtual bool doTransform() const
207 {
208 return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
209 }
210
211 //- Return face transformation tensor
212 virtual const tensorField& forwardT() const
213 {
214 return cyclicPatch_.forwardT();
215 }
216
217 //- Return neighbour-cell transformation tensor
218 virtual const tensorField& reverseT() const
219 {
220 return cyclicPatch_.reverseT();
221 }
222
223 //- Return rank of component for transform
224 virtual int rank() const
225 {
226 return pTraits<Type>::rank;
227 }
228};
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233} // End namespace Foam
234
235// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236
237#ifdef NoRepository
238 #include "cyclicFaPatchField.C"
239#endif
240
241// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242
243#endif
244
245// ************************************************************************* //
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
commsTypes
Types of communications.
Definition: UPstream.H:67
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
bool parallel() const
Are the cyclic planes parallel.
Foam::cyclicFaPatchField.
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
virtual bool doTransform() const
Cyclic coupled interface functions.
virtual int rank() const
Return rank of component for transform.
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 cyclicFaPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
virtual void transformCoupleField(solveScalarField &f, const direction cmpt) const
Transform neighbour field.
TypeName(cyclicFaPatch::typeName_())
Runtime type information.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Cyclic-plane patch.
Definition: cyclicFaPatch.H:61
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Abstract base class for cyclic coupled interfaces.
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
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
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
labelList f(nPoints)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73