FreeFOAM The Cross-Platform CFD Toolkit
fvPatch.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::fvPatch
26 
27 Description
28  Foam::fvPatch
29 
30 SourceFiles
31  fvPatch.C
32  newFvPatch.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvPatch_H
37 #define fvPatch_H
38 
39 #include <OpenFOAM/polyPatch.H>
40 #include <OpenFOAM/labelList.H>
41 #include <OpenFOAM/SubList.H>
42 #include <OpenFOAM/typeInfo.H>
43 #include <OpenFOAM/tmp.H>
45 #include <OpenFOAM/SubField.H>
47 #include <OpenFOAM/autoPtr.H>
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 class fvBoundaryMesh;
56 class surfaceInterpolation;
57 
58 /*---------------------------------------------------------------------------*\
59  Class fvPatch Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class fvPatch
63 {
64  // Private data
65 
66  //- Reference to the underlying polyPatch
67  const polyPatch& polyPatch_;
68 
69  //- Reference to boundary mesh
70  const fvBoundaryMesh& boundaryMesh_;
71 
72 
73  // Private Member Functions
74 
75  //- Disallow construct as copy
76  fvPatch(const fvPatch&);
77 
78  //- Disallow assignment
79  void operator=(const fvPatch&);
80 
81 
82 protected:
83 
84  // Protected Member Functions
85 
86  //- Make patch weighting factors
87  virtual void makeWeights(scalarField&) const;
88 
89  //- Make patch face - neighbour cell distances
90  virtual void makeDeltaCoeffs(scalarField&) const;
91 
92  //- Initialise the patches for moving points
93  virtual void initMovePoints();
94 
95  //- Correct patches after moving points
96  virtual void movePoints();
97 
98 
99 public:
100 
102 
103  friend class fvBoundaryMesh;
104  friend class surfaceInterpolation;
105 
106  //- Runtime type information
107  TypeName(polyPatch::typeName_());
108 
109 
110  // Declare run-time constructor selection tables
111 
113  (
114  autoPtr,
115  fvPatch,
116  polyPatch,
117  (const polyPatch& patch, const fvBoundaryMesh& bm),
118  (patch, bm)
119  );
120 
121 
122  // Constructors
123 
124  //- Construct from polyPatch
125  fvPatch(const polyPatch&, const fvBoundaryMesh&);
126 
127 
128  // Selectors
129 
130  //- Return a pointer to a new patch created on freestore from polyPatch
131  static autoPtr<fvPatch> New(const polyPatch&, const fvBoundaryMesh&);
132 
133 
134  // Destructor
135 
136  virtual ~fvPatch();
137 
138 
139  // Member Functions
140 
141  // Access
142 
143  //- Return the polyPatch
144  const polyPatch& patch() const
145  {
146  return polyPatch_;
147  }
148 
149  //- Return name
150  const word& name() const
151  {
152  return polyPatch_.name();
153  }
154 
155  //- Return size
156  virtual label size() const
157  {
158  return polyPatch_.size();
159  }
160 
161  //- Return true if this patch is coupled
162  bool coupled() const
163  {
164  return polyPatch_.coupled();
165  }
166 
167  //- Return true if the given type is a constraint type
168  static bool constraintType(const word& pt);
169 
170  //- Return a list of all the constraint patch types
171  static wordList constraintTypes();
172 
173  //- Return the index of this patch in the fvBoundaryMesh
174  label index() const
175  {
176  return polyPatch_.index();
177  }
178 
179  //- Return boundaryMesh reference
181  {
182  return boundaryMesh_;
183  }
184 
185  //- Slice list to patch
186  template<class T>
187  const typename List<T>::subList patchSlice(const List<T>& l) const
188  {
189  return typename List<T>::subList(l, size(), polyPatch_.start());
190  }
191 
192  //- Return faceCells
193  virtual const unallocLabelList& faceCells() const;
194 
195 
196  // Access functions for geometrical data
197 
198  //- Return face centres
199  const vectorField& Cf() const;
200 
201  //- Return neighbour cell centres
202  tmp<vectorField> Cn() const;
203 
204  //- Return face area vectors
205  const vectorField& Sf() const;
206 
207  //- Return face area magnitudes
208  const scalarField& magSf() const;
209 
210  //- Return face normals
211  tmp<vectorField> nf() const;
212 
213  //- Return cell-centre to face-centre vector
214  // except for coupled patches for which the cell-centre
215  // to coupled-cell-centre vector is returned
216  virtual tmp<vectorField> delta() const;
217 
218 
219  // Access functions for demand driven data
220 
221  //- Return patch weighting factors
222  const scalarField& weights() const;
223 
224  //- Return the face - cell distance coeffient
225  // except for coupled patches for which the cell-centre
226  // to coupled-cell-centre distance coeffient is returned
227  const scalarField& deltaCoeffs() const;
228 
229 
230  // Evaluation functions
231 
232  //- Return given internal field next to patch as patch field
233  template<class Type>
235 
236  //- Return the corresponding patchField of the named field
237  template<class GeometricField, class Type>
239  (
240  const GeometricField&
241  ) const;
242 
243  //- Lookup and return the patchField of the named field from the
244  // local objectRegistry.
245  // N.B. The dummy pointer arguments are used if this function is
246  // instantiated within a templated function to avoid a bug in gcc.
247  // See inletOutletFvPatchField.C and outletInletFvPatchField.C
248  template<class GeometricField, class Type>
250  (
251  const word& name,
252  const GeometricField* = NULL,
253  const Type* = NULL
254  ) const;
255 };
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace Foam
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #ifdef NoRepository
266 #endif
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #endif
271 
272 // ************************ vim: set sw=4 sts=4 et: ************************ //