cyclicAMIFvPatchField.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::cyclicAMIFvPatchField
29
30Group
31 grpCoupledBoundaryConditions
32
33Description
34 This boundary condition enforces a cyclic condition between a pair of
35 boundaries, whereby communication between the patches is performed using
36 an arbitrary mesh interface (AMI) interpolation.
37
38Usage
39 Example of the boundary condition specification:
40 \verbatim
41 <patchName>
42 {
43 type cyclicAMI;
44 }
45 \endverbatim
46
47Note
48 The outer boundary of the patch pairs must be similar, i.e. if the owner
49 patch is transformed to the neighbour patch, the outer perimiter of each
50 patch should be identical (or very similar).
51
52See also
53 Foam::AMIInterpolation
54
55SourceFiles
56 cyclicAMIFvPatchField.C
57
58\*---------------------------------------------------------------------------*/
59
60#ifndef cyclicAMIFvPatchField_H
61#define cyclicAMIFvPatchField_H
62
63
64#include "coupledFvPatchField.H"
66#include "cyclicAMIFvPatch.H"
67
68// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69
70namespace Foam
71{
72
73/*---------------------------------------------------------------------------*\
74 Class cyclicAMIFvPatchField Declaration
75\*---------------------------------------------------------------------------*/
76
77template<class Type>
79:
80 virtual public cyclicAMILduInterfaceField,
81 public coupledFvPatchField<Type>
82{
83 // Private data
84
85 //- Local reference cast into the cyclic patch
86 const cyclicAMIFvPatch& cyclicAMIPatch_;
87
88
89 // Private Member Functions
90
91 //- Return neighbour side field given internal fields
92 template<class Type2>
93 tmp<Field<Type2>> neighbourSideField
94 (
95 const Field<Type2>&
96 ) const;
97
98
99 //- Return new matrix coeffs
100 tmp<Field<scalar>> coeffs
101 (
102 fvMatrix<Type>& matrix,
103 const Field<scalar>&,
104 const label
105 ) const;
106
107
108 template<class Type2>
109 void collectStencilData
110 (
111 const refPtr<mapDistribute>& mapPtr,
112 const labelListList& stencil,
113 const Type2& data,
114 List<Type2>& expandedData
115 );
116
117
118public:
119
120 //- Runtime type information
121 TypeName(cyclicAMIFvPatch::typeName_());
122
123
124 // Constructors
125
126 //- Construct from patch and internal field
128 (
129 const fvPatch&,
131 );
132
133 //- Construct from patch, internal field and dictionary
135 (
136 const fvPatch&,
138 const dictionary&
139 );
140
141 //- Construct by mapping given cyclicAMIFvPatchField onto a new patch
143 (
145 const fvPatch&,
147 const fvPatchFieldMapper&
148 );
149
150 //- Construct as copy
152
153 //- Construct and return a clone
154 virtual tmp<fvPatchField<Type>> clone() const
155 {
157 (
159 );
160 }
161
162 //- Construct as copy setting internal field reference
164 (
167 );
168
169 //- Construct and return a clone setting internal field reference
171 (
173 ) const
174 {
176 (
177 new cyclicAMIFvPatchField<Type>(*this, iF)
178 );
179 }
180
181
182 // Member functions
183
184 // Access
185
186 //- Return local reference cast into the cyclic AMI patch
187 const cyclicAMIFvPatch& cyclicAMIPatch() const
188 {
189 return cyclicAMIPatch_;
190 }
191
192
193 // Evaluation functions
194
195 //- Return true if coupled. Note that the underlying patch
196 // is not coupled() - the points don't align.
197 virtual bool coupled() const;
198
199 //- Return neighbour coupled internal cell data
200 virtual tmp<Field<Type>> patchNeighbourField() const;
201
202 //- Return reference to neighbour patchField
204
205 //- Update result field based on interface functionality
206 virtual void updateInterfaceMatrix
207 (
208 solveScalarField& result,
209 const bool add,
210 const lduAddressing& lduAddr,
211 const label patchId,
212 const solveScalarField& psiInternal,
213 const scalarField& coeffs,
214 const direction cmpt,
215 const Pstream::commsTypes commsType
216 ) const;
217
218 //- Update result field based on interface functionality
219 virtual void updateInterfaceMatrix
220 (
222 const bool add,
223 const lduAddressing& lduAddr,
224 const label patchId,
225 const Field<Type>&,
226 const scalarField&,
227 const Pstream::commsTypes commsType
228 ) const;
229
230
231 //- Manipulate matrix
232 virtual void manipulateMatrix
233 (
235 const label iMatrix,
236 const direction cmpt
237 );
238
239
240 // Cyclic AMI coupled interface functions
241
242 //- Does the patch field perform the transformation
243 virtual bool doTransform() const
244 {
245 return
246 !(cyclicAMIPatch_.parallel() || pTraits<Type>::rank == 0);
247 }
248
249 //- Return face transformation tensor
250 virtual const tensorField& forwardT() const
251 {
252 return cyclicAMIPatch_.forwardT();
253 }
254
255 //- Return neighbour-cell transformation tensor
256 virtual const tensorField& reverseT() const
257 {
258 return cyclicAMIPatch_.reverseT();
259 }
260
261 //- Return rank of component for transform
262 virtual int rank() const
263 {
264 return pTraits<Type>::rank;
265 }
266
267
268 // I-O
269
270 //- Write
271 virtual void write(Ostream& os) const;
272};
273
274
275// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277} // End namespace Foam
278
279// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280
281#ifdef NoRepository
282 #include "cyclicAMIFvPatchField.C"
283#endif
284
285// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286
287#endif
288
289// ************************************************************************* //
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, whereby communicati...
virtual bool doTransform() const
Does the patch field perform the transformation.
const cyclicAMIFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
virtual int rank() const
Return rank of component for transform.
virtual void manipulateMatrix(fvMatrix< Type > &m, const label iMatrix, const direction cmpt)
Manipulate matrix.
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.
virtual bool coupled() const
Return true if coupled. Note that the underlying patch.
const cyclicAMIFvPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic AMI patch.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
TypeName(cyclicAMIFvPatch::typeName_())
Runtime type information.
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 patch for Arbitrary Mesh Interface (AMI)
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 AMI coupled interfaces.
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
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 references or pointers (no reference counting)
Definition: refPtr.H:58
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