cyclicFvPatchField.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 | Copyright (C) 2011-2016 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 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  This boundary condition enforces a cyclic condition between a pair of
32  boundaries.
33 
34 Usage
35  Example of the boundary condition specification:
36  \verbatim
37  <patchName>
38  {
39  type cyclic;
40  }
41  \endverbatim
42 
43 Note
44  The patches must be topologically similar, i.e. if the owner patch is
45  transformed to the neighbour patch, the patches should be identical (or
46  very similar).
47 
48 SourceFiles
49  cyclicFvPatchField.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef cyclicFvPatchField_H
54 #define cyclicFvPatchField_H
55 
56 #include "coupledFvPatchField.H"
58 #include "cyclicFvPatch.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class cyclicFvPatch Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class Type>
71 :
72  virtual public cyclicLduInterfaceField,
73  public coupledFvPatchField<Type>
74 {
75  // Private data
76 
77  //- Local reference cast into the cyclic patch
78  const cyclicFvPatch& cyclicPatch_;
79 
80 
81  // Private Member Functions
82 
83  //- Return neighbour side field given internal fields
84  template<class Type2>
85  tmp<Field<Type2>> neighbourSideField
86  (
87  const Field<Type2>&
88  ) const;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName(cyclicFvPatch::typeName_());
95 
96 
97  // Constructors
98 
99  //- Construct from patch and internal field
101  (
102  const fvPatch&,
104  );
105 
106  //- Construct from patch, internal field and dictionary
108  (
109  const fvPatch&,
111  const dictionary&
112  );
113 
114  //- Construct by mapping given cyclicFvPatchField onto a new patch
116  (
118  const fvPatch&,
120  const fvPatchFieldMapper&
121  );
122 
123  //- Construct as copy
125  (
127  );
128 
129  //- Construct and return a clone
130  virtual tmp<fvPatchField<Type>> clone() const
131  {
132  return tmp<fvPatchField<Type>>
133  (
134  new cyclicFvPatchField<Type>(*this)
135  );
136  }
137 
138  //- Construct as copy setting internal field reference
140  (
143  );
144 
145  //- Construct and return a clone setting internal field reference
147  (
149  ) const
150  {
151  return tmp<fvPatchField<Type>>
152  (
153  new cyclicFvPatchField<Type>(*this, iF)
154  );
155  }
156 
157 
158  // Member functions
159 
160  // Access
161 
162  //- Return local reference cast into the cyclic patch
163  const cyclicFvPatch& cyclicPatch() const
164  {
165  return cyclicPatch_;
166  }
167 
168 
169  // Evaluation functions
170 
171  //- Return neighbour coupled internal cell data
173 
174  //- Return reference to neighbour patchField
176 
177  //- Update result field based on interface functionality
178  virtual void updateInterfaceMatrix
179  (
180  scalarField& result,
181  const scalarField& psiInternal,
182  const scalarField& coeffs,
183  const direction cmpt,
184  const Pstream::commsTypes commsType
185  ) const;
186 
187  //- Update result field based on interface functionality
188  virtual void updateInterfaceMatrix
189  (
190  Field<Type>& result,
191  const Field<Type>& psiInternal,
192  const scalarField& coeffs,
193  const Pstream::commsTypes commsType
194  ) const;
195 
196 
197  // Cyclic coupled interface functions
198 
199  //- Does the patch field perform the transformation
200  virtual bool doTransform() const
201  {
202  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
203  }
204 
205  //- Return face transformation tensor
206  virtual const tensorField& forwardT() const
207  {
208  return cyclicPatch_.forwardT();
209  }
210 
211  //- Return neighbour-cell transformation tensor
212  virtual const tensorField& reverseT() const
213  {
214  return cyclicPatch_.reverseT();
215  }
216 
217  //- Return rank of component for transform
218  virtual int rank() const
219  {
220  return pTraits<Type>::rank;
221  }
222 
223 
224  // I-O
225 
226  //- Write
227  virtual void write(Ostream& os) const;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
238  #include "cyclicFvPatchField.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
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.
Pre-declare SubField and related Field type.
Definition: Field.H:57
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.