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-2022 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  const Pstream::commsTypes commsType
150  ) const;
151 
152  //- Return reference to neighbour patchField
154 
155  //- Update result field based on interface functionality
156  virtual void updateInterfaceMatrix
157  (
158  scalarField& result,
159  const scalarField& psiInternal,
160  const scalarField& coeffs,
161  const direction cmpt,
162  const Pstream::commsTypes commsType
163  ) const;
164 
165  //- Update result field based on interface functionality
166  virtual void updateInterfaceMatrix
167  (
168  Field<Type>& result,
169  const Field<Type>& psiInternal,
170  const scalarField& coeffs,
171  const Pstream::commsTypes commsType
172  ) const;
173 
174 
175  // Cyclic coupled interface functions
176 
177  //- Return transformation between the coupled patches
178  virtual const transformer& transform() const
179  {
180  return cyclicPatch_.transform();
181  }
182 
183  //- Return rank of component for transform
184  virtual int rank() const
185  {
186  return pTraits<Type>::rank;
187  }
188 
189 
190  // I-O
191 
192  //- Write
193  virtual void write(Ostream& os) const;
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #ifdef NoRepository
204  #include "cyclicFvPatchField.C"
205 #endif
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void updateInterfaceMatrix(scalarField &, const scalarField &, const scalarField &, const direction, const Pstream::commsTypes commsType) const=0
Inherit updateInterfaceMatrix from lduInterfaceField.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
Abstract base class for coupled patches.
This boundary condition enforces a cyclic condition between a pair of boundaries.
virtual int rank() const
Return rank of component for transform.
cyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
TypeName(cyclicFvPatch::typeName_())
Runtime type information.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType) const
Return neighbour coupled internal cell data.
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual void write(Ostream &os) const
Write.
const cyclicFvPatchField< Type > & nbrPatchField() const
Return reference to neighbour patchField.
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
Cyclic-plane patch.
Definition: cyclicFvPatch.H:55
virtual const transformer & transform() const
Return transformation between the coupled patches.
Abstract base class for cyclic coupled interfaces.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Traits class for primitives.
Definition: pTraits.H:53
A class for managing temporary objects.
Definition: tmp.H:55
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:45