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-2012 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  \heading Patch usage
35 
36  Example of the boundary condition specification:
37  \verbatim
38  myPatch
39  {
40  type cyclic;
41  }
42  \endverbatim
43 
44 Note
45  The patches must be topologically similar, i.e. if the owner patch is
46  transformed to the neighbour patch, the patches should be identical (or
47  very similar).
48 
49 SourceFiles
50  cyclicFvPatchField.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef cyclicFvPatchField_H
55 #define cyclicFvPatchField_H
56 
57 #include "coupledFvPatchField.H"
59 #include "cyclicFvPatch.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class cyclicFvPatch Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type>
72 :
73  virtual public cyclicLduInterfaceField,
74  public coupledFvPatchField<Type>
75 {
76  // Private data
77 
78  //- Local reference cast into the cyclic patch
79  const cyclicFvPatch& cyclicPatch_;
80 
81 
82  // Private Member Functions
83 
84  //- Return neighbour side field given internal fields
85  template<class Type2>
86  tmp<Field<Type2> > neighbourSideField
87  (
88  const Field<Type2>&
89  ) const;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName(cyclicFvPatch::typeName_());
96 
97 
98  // Constructors
99 
100  //- Construct from patch and internal field
102  (
103  const fvPatch&,
105  );
106 
107  //- Construct from patch, internal field and dictionary
109  (
110  const fvPatch&,
112  const dictionary&
113  );
114 
115  //- Construct by mapping given cyclicFvPatchField onto a new patch
117  (
119  const fvPatch&,
121  const fvPatchFieldMapper&
122  );
123 
124  //- Construct as copy
126  (
128  );
129 
130  //- Construct and return a clone
131  virtual tmp<fvPatchField<Type> > clone() const
132  {
133  return tmp<fvPatchField<Type> >
134  (
135  new cyclicFvPatchField<Type>(*this)
136  );
137  }
138 
139  //- Construct as copy setting internal field reference
141  (
144  );
145 
146  //- Construct and return a clone setting internal field reference
148  (
150  ) const
151  {
152  return tmp<fvPatchField<Type> >
153  (
154  new cyclicFvPatchField<Type>(*this, iF)
155  );
156  }
157 
158 
159  // Member functions
160 
161  // Access
162 
163  //- Return local reference cast into the cyclic patch
164  const cyclicFvPatch& cyclicPatch() const
165  {
166  return cyclicPatch_;
167  }
168 
169 
170  // Evaluation functions
171 
172  //- Return neighbour coupled internal cell data
174 
175  //- Return reference to neighbour patchField
177 
178  //- Update result field based on interface functionality
179  virtual void updateInterfaceMatrix
180  (
181  scalarField& result,
182  const scalarField& psiInternal,
183  const scalarField& coeffs,
184  const direction cmpt,
185  const Pstream::commsTypes commsType
186  ) const;
187 
188  //- Update result field based on interface functionality
189  virtual void updateInterfaceMatrix
190  (
191  Field<Type>& result,
192  const Field<Type>& psiInternal,
193  const scalarField& coeffs,
194  const Pstream::commsTypes commsType
195  ) const;
196 
197 
198  // Cyclic coupled interface functions
199 
200  //- Does the patch field perform the transformation
201  virtual bool doTransform() const
202  {
203  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
204  }
205 
206  //- Return face transformation tensor
207  virtual const tensorField& forwardT() const
208  {
209  return cyclicPatch_.forwardT();
210  }
211 
212  //- Return neighbour-cell transformation tensor
213  virtual const tensorField& reverseT() const
214  {
215  return cyclicPatch_.reverseT();
216  }
217 
218  //- Return rank of component for transform
219  virtual int rank() const
220  {
221  return pTraits<Type>::rank;
222  }
223 
224 
225  // I-O
226 
227  //- Write
228  virtual void write(Ostream& os) const;
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #ifdef NoRepository
239 # include "cyclicFvPatchField.C"
240 #endif
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
unsigned char direction
Definition: direction.H:43
virtual void write(Ostream &os) const
Write.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
cyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
This boundary condition enforces a cyclic condition between a pair of boundaries. ...
Namespace for OpenFOAM.
Abstract base class for cyclic coupled interfaces.
tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Abstract base class for coupled patches.
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual bool doTransform() const
Does the patch field perform the transformation.
virtual int rank() const
Return rank of component for transform.
Pre-declare SubField and related Field type.
Definition: Field.H:57
Traits class for primitives.
Definition: pTraits.H:50
Cyclic-plane patch.
Definition: cyclicFvPatch.H:51
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual const tensorField & forwardT() const
Return face transformation tensor.
const cyclicFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
TypeName(cyclicFvPatch::typeName_())
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:118
virtual bool parallel() const
Are the cyclic planes parallel.