FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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  Foam::cyclicFvPatchField
29 
30 SourceFiles
31  cyclicFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cyclicFvPatchField_H
36 #define cyclicFvPatchField_H
37 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class cyclicFvPatch Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
53 :
54  virtual public cyclicLduInterfaceField,
55  public coupledFvPatchField<Type>
56 {
57  // Private data
58 
59  //- Local reference cast into the cyclic patch
60  const cyclicFvPatch& cyclicPatch_;
61 
62 
63  // Private member functions
64 
65  //- Return neighbour side field given internal fields
66  template<class Type2>
67  tmp<Field<Type2> > neighbourSideField
68  (
69  const Field<Type2>&
70  ) const;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName(cyclicFvPatch::typeName_());
77 
78 
79  // Constructors
80 
81  //- Construct from patch and internal field
83  (
84  const fvPatch&,
86  );
87 
88  //- Construct from patch, internal field and dictionary
90  (
91  const fvPatch&,
93  const dictionary&
94  );
95 
96  //- Construct by mapping given cyclicFvPatchField onto a new patch
98  (
100  const fvPatch&,
102  const fvPatchFieldMapper&
103  );
104 
105  //- Construct as copy
107  (
109  );
110 
111  //- Construct and return a clone
112  virtual tmp<fvPatchField<Type> > clone() const
113  {
114  return tmp<fvPatchField<Type> >
115  (
116  new cyclicFvPatchField<Type>(*this)
117  );
118  }
119 
120  //- Construct as copy setting internal field reference
122  (
125  );
126 
127  //- Construct and return a clone setting internal field reference
128  virtual tmp<fvPatchField<Type> > clone
129  (
131  ) const
132  {
133  return tmp<fvPatchField<Type> >
134  (
135  new cyclicFvPatchField<Type>(*this, iF)
136  );
137  }
138 
139 
140  // Member functions
141 
142  // Access
143 
144  //- Retirn local reference cast into the cyclic patch
145  const cyclicFvPatch& cyclicPatch() const
146  {
147  return cyclicPatch_;
148  }
149 
150 
151  // Evaluation functions
152 
153  //- Return neighbour coupled given internal cell data
155 
156  //- Update result field based on interface functionality
157  virtual void updateInterfaceMatrix
158  (
159  const scalarField& psiInternal,
160  scalarField& result,
161  const lduMatrix&,
162  const scalarField& coeffs,
163  const direction cmpt,
164  const Pstream::commsTypes commsType
165  ) const;
166 
167 
168  //- Cyclic coupled interface functions
169 
170  //- Does the patch field perform the transfromation
171  virtual bool doTransform() const
172  {
173  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
174  }
175 
176  //- Return face transformation tensor
177  virtual const tensorField& forwardT() const
178  {
179  return cyclicPatch_.forwardT();
180  }
181 
182  //- Return neighbour-cell transformation tensor
183  virtual const tensorField& reverseT() const
184  {
185  return cyclicPatch_.reverseT();
186  }
187 
188  //- Return rank of component for transform
189  virtual int rank() const
190  {
191  return pTraits<Type>::rank;
192  }
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #ifdef NoRepository
204 #endif
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************ vim: set sw=4 sts=4 et: ************************ //