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  //- Disallow copy without setting internal field reference
112 
113  //- Copy constructor setting internal field reference
115  (
118  );
119 
120  //- Construct and return a clone setting internal field reference
122  (
124  ) const
125  {
126  return tmp<fvPatchField<Type>>
127  (
128  new cyclicFvPatchField<Type>(*this, iF)
129  );
130  }
131 
132 
133  // Member Functions
134 
135  // Access
136 
137  //- Return local reference cast into the cyclic patch
138  const cyclicFvPatch& cyclicPatch() const
139  {
140  return cyclicPatch_;
141  }
142 
143 
144  // Evaluation functions
145 
146  //- Return neighbour coupled internal cell data
148 
149  //- Return reference to neighbour patchField
151 
152  //- Update result field based on interface functionality
153  virtual void updateInterfaceMatrix
154  (
155  scalarField& result,
156  const scalarField& psiInternal,
157  const scalarField& coeffs,
158  const direction cmpt,
159  const Pstream::commsTypes commsType
160  ) const;
161 
162  //- Update result field based on interface functionality
163  virtual void updateInterfaceMatrix
164  (
165  Field<Type>& result,
166  const Field<Type>& psiInternal,
167  const scalarField& coeffs,
168  const Pstream::commsTypes commsType
169  ) const;
170 
171 
172  // Cyclic coupled interface functions
173 
174  //- Return transformation between the coupled patches
175  virtual const transformer& transform() const
176  {
177  return cyclicPatch_.transform();
178  }
179 
180  //- Return rank of component for transform
181  virtual int rank() const
182  {
183  return pTraits<Type>::rank;
184  }
185 
186 
187  // I-O
188 
189  //- Write
190  virtual void write(Ostream& os) const;
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201  #include "cyclicFvPatchField.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Vector-tensor class used to perform translations, rotations and scaling operations 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:156
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:62
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.
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.
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
Namespace for OpenFOAM.
cyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.