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-2018 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  //- Construct as copy
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  //- Construct as copy 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  //- Does the patch field perform the transformation
187  virtual bool doTransform() const
188  {
189  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
190  }
191 
192  //- Return face transformation tensor
193  virtual const tensorField& forwardT() const
194  {
195  return cyclicPatch_.forwardT();
196  }
197 
198  //- Return neighbour-cell transformation tensor
199  virtual const tensorField& reverseT() const
200  {
201  return cyclicPatch_.reverseT();
202  }
203 
204  //- Return rank of component for transform
205  virtual int rank() const
206  {
207  return pTraits<Type>::rank;
208  }
209 
210 
211  // I-O
212 
213  //- Write
214  virtual void write(Ostream& os) const;
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #ifdef NoRepository
225  #include "cyclicFvPatchField.C"
226 #endif
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
TypeName(cyclicFvPatch::typeName_())
Runtime type information.
const cyclicFvPatchField< Type > & neighbourPatchField() 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.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
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. ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual bool doTransform() const
Does the patch field perform the transformation.
virtual const tensorField & forwardT() const
Return face transformation tensor.
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.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
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.
virtual bool parallel() const
Are the cyclic planes parallel.
Namespace for OpenFOAM.
cyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.