All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cyclicFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cyclicFvPatchField
26 
27 Description
28  This boundary condition enforces a cyclic condition between a pair of
29  boundaries.
30 
31 Usage
32  Example of the boundary condition specification:
33  \verbatim
34  <patchName>
35  {
36  type cyclic;
37  }
38  \endverbatim
39 
40 Note
41  The patches must be topologically similar, i.e. if the owner patch is
42  transformed to the neighbour patch, the patches should be identical (or
43  very similar).
44 
45 SourceFiles
46  cyclicFvPatchField.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef cyclicFvPatchField_H
51 #define cyclicFvPatchField_H
52 
53 #include "coupledFvPatchField.H"
55 #include "cyclicFvPatch.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class cyclicFvPatch Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Type>
68 :
69  public coupledFvPatchField<Type>,
71 {
72  // Private Data
73 
74  //- Local reference cast into the cyclic patch
75  const cyclicFvPatch& cyclicPatch_;
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName(cyclicFvPatch::typeName_());
82 
83 
84  // Constructors
85 
86  //- Construct from patch and internal field
88  (
89  const fvPatch&,
91  );
92 
93  //- Construct from patch, internal field and dictionary
95  (
96  const fvPatch&,
98  const dictionary&
99  );
100 
101  //- Construct by mapping given cyclicFvPatchField onto a new patch
103  (
105  const fvPatch&,
107  const fvPatchFieldMapper&
108  );
109 
110  //- Copy constructor
112  (
114  );
115 
116  //- Construct and return a clone
117  virtual tmp<fvPatchField<Type>> clone() const
118  {
119  return tmp<fvPatchField<Type>>
120  (
121  new cyclicFvPatchField<Type>(*this)
122  );
123  }
124 
125  //- Copy constructor setting internal field reference
127  (
130  );
131 
132  //- Construct and return a clone setting internal field reference
134  (
136  ) const
137  {
138  return tmp<fvPatchField<Type>>
139  (
140  new cyclicFvPatchField<Type>(*this, iF)
141  );
142  }
143 
144 
145  // Member Functions
146 
147  // Access
148 
149  //- Return local reference cast into the cyclic patch
150  const cyclicFvPatch& cyclicPatch() const
151  {
152  return cyclicPatch_;
153  }
154 
155 
156  // Evaluation functions
157 
158  //- Return neighbour coupled internal cell data
160 
161  //- Return reference to neighbour patchField
163 
164  //- Update result field based on interface functionality
165  virtual void updateInterfaceMatrix
166  (
167  scalarField& result,
168  const scalarField& psiInternal,
169  const scalarField& coeffs,
170  const direction cmpt,
171  const Pstream::commsTypes commsType
172  ) const;
173 
174  //- Update result field based on interface functionality
175  virtual void updateInterfaceMatrix
176  (
177  Field<Type>& result,
178  const Field<Type>& psiInternal,
179  const scalarField& coeffs,
180  const Pstream::commsTypes commsType
181  ) const;
182 
183 
184  // Cyclic coupled interface functions
185 
186  //- Return transformation between the coupled patches
187  virtual const transformer& transform() const
188  {
189  return cyclicPatch_.transform();
190  }
191 
192  //- Return rank of component for transform
193  virtual int rank() const
194  {
195  return pTraits<Type>::rank;
196  }
197 
198 
199  // I-O
200 
201  //- Write
202  virtual void write(Ostream& os) const;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
213  #include "cyclicFvPatchField.C"
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Vector-tensor class used to perform translations and rotations in 3D space.
Definition: transformer.H:83
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
commsTypes
Types of communications.
Definition: UPstream.H:64
uint8_t direction
Definition: direction.H:45
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Traits class for primitives.
Definition: pTraits.H:50
virtual int rank() const
Return rank of component for transform.
virtual const transformer & transform() const
Return transformation between the coupled patches.
TypeName(cyclicFvPatch::typeName_())
Runtime type information.
const cyclicFvPatchField< Type > & nbrPatchField() const
Return reference to neighbour patchField.
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Foam::fvPatchFieldMapper.
Cyclic-plane patch.
Definition: cyclicFvPatch.H:51
Abstract base class for coupled patches.
This boundary condition enforces a cyclic condition between a pair of boundaries. ...
virtual const transformer & transform() const
Return transformation between the coupled patches.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void write(Ostream &os) const
Write.
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
A class for managing temporary objects.
Definition: PtrList.H:53
Abstract base class for cyclic coupled interfaces.
Namespace for OpenFOAM.
cyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.