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) 2011-2017 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::fvPatch
26 
27 Description
28  A finiteVolume patch using a polyPatch and a fvBoundaryMesh
29 
30 SourceFiles
31  fvPatch.C
32  fvPatchNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvPatch_H
37 #define fvPatch_H
38 
39 #include "polyPatch.H"
40 #include "labelList.H"
41 #include "SubList.H"
42 #include "typeInfo.H"
43 #include "tmp.H"
44 #include "primitiveFields.H"
45 #include "SubField.H"
46 #include "fvPatchFieldsFwd.H"
47 #include "autoPtr.H"
48 #include "runTimeSelectionTables.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  //- Initialise the patches for moving points
90  virtual void initMovePoints();
91 
92  //- Correct patches after moving points
93  virtual void movePoints();
94 
95 
96 public:
97 
99 
100  friend class fvBoundaryMesh;
101  friend class surfaceInterpolation;
102 
103  //- Runtime type information
104  TypeName(polyPatch::typeName_());
105 
106 
107  // Declare run-time constructor selection tables
108 
110  (
111  autoPtr,
112  fvPatch,
113  polyPatch,
114  (const polyPatch& patch, const fvBoundaryMesh& bm),
115  (patch, bm)
116  );
117 
118 
119  // Constructors
120 
121  //- Construct from polyPatch and fvBoundaryMesh
122  fvPatch(const polyPatch&, const fvBoundaryMesh&);
123 
124 
125  // Selectors
126 
127  //- Return a pointer to a new patch created on freestore from polyPatch
128  static autoPtr<fvPatch> New
129  (
130  const polyPatch&,
131  const fvBoundaryMesh&
132  );
133 
134 
135  //- Destructor
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 start label of this patch in the polyMesh face list
156  label start() const
157  {
158  return polyPatch_.start();
159  }
160 
161  //- Return size
162  virtual label size() const
163  {
164  return polyPatch_.size();
165  }
166 
167  //- Return true if this patch is coupled
168  virtual bool coupled() const
169  {
170  return polyPatch_.coupled();
171  }
172 
173  //- Return true if the given type is a constraint type
174  static bool constraintType(const word& pt);
175 
176  //- Return a list of all the constraint patch types
177  static wordList constraintTypes();
178 
179  //- Return the index of this patch in the fvBoundaryMesh
180  label index() const
181  {
182  return polyPatch_.index();
183  }
184 
185  //- Return boundaryMesh reference
186  const fvBoundaryMesh& boundaryMesh() const
187  {
188  return boundaryMesh_;
189  }
190 
191  //- Slice list to patch
192  template<class T>
193  const typename List<T>::subList patchSlice(const List<T>& l) const
194  {
195  return typename List<T>::subList(l, size(), start());
196  }
197 
198  //- Return faceCells
199  virtual const labelUList& faceCells() const;
200 
201 
202  // Access functions for geometrical data
203 
204  //- Return face centres
205  const vectorField& Cf() const;
206 
207  //- Return neighbour cell centres
208  tmp<vectorField> Cn() const;
209 
210  //- Return face area vectors
211  const vectorField& Sf() const;
212 
213  //- Return face area magnitudes
214  const scalarField& magSf() const;
215 
216  //- Return face normals
217  tmp<vectorField> nf() const;
218 
219  //- Return cell-centre to face-centre vector
220  // except for coupled patches for which the cell-centre
221  // to coupled-cell-centre vector is returned
222  virtual tmp<vectorField> delta() const;
223 
224 
225  // Access functions for demand driven data
226 
227  //- Return patch weighting factors
228  const scalarField& weights() const;
229 
230  //- Return the face - cell distance coeffient
231  // except for coupled patches for which the cell-centre
232  // to coupled-cell-centre distance coeffient is returned
233  const scalarField& deltaCoeffs() const;
234 
235 
236  // Evaluation functions
237 
238  //- Return given internal field next to patch as patch field
239  template<class Type>
241 
242  //- Return given internal field next to patch as patch field
243  template<class Type>
244  void patchInternalField(const UList<Type>&, Field<Type>&) const;
245 
246  //- Return the corresponding patchField of the named field
247  template<class GeometricField, class Type>
248  const typename GeometricField::Patch& patchField
249  (
250  const GeometricField&
251  ) const;
252 
253  //- Return the corresponding patchField reference of the named field
254  template<class GeometricField, class Type>
256  (
258  ) const;
259 
260  //- Lookup and return the patchField of the named field from the
261  // local objectRegistry.
262  // N.B. The dummy pointer arguments are used if this function is
263  // instantiated within a templated function to avoid a bug in gcc.
264  // See inletOutletFvPatchField.C and outletInletFvPatchField.C
265  template<class GeometricField, class Type>
267  (
268  const word& name,
269  const GeometricField* = nullptr,
270  const Type* = nullptr
271  ) const;
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace Foam
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #ifdef NoRepository
282  #include "fvPatchTemplates.C"
283 #endif
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 #endif
288 
289 // ************************************************************************* //
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185
const GeometricField::Patch & patchField(const GeometricField &) const
Return the corresponding patchField of the named field.
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:156
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const word & name() const
Return name.
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:136
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:179
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:124
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Generic GeometricField class.
SubList< T > subList
Declare type of subList.
Definition: List.H:192
Cell to surface interpolation scheme. Included in fvMesh.
declareRunTimeSelectionTable(autoPtr, fvPatch, polyPatch,(const polyPatch &patch, const fvBoundaryMesh &bm),(patch, bm))
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:61
const word & name() const
Return name.
Definition: fvPatch.H:149
A List obtained as a section of another List.
Definition: SubList.H:53
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:310
fvBoundaryMesh BoundaryMesh
Definition: fvPatch.H:97
A class for handling words, derived from string.
Definition: word.H:59
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:93
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:170
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:150
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:99
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
virtual label size() const
Return size.
Definition: fvPatch.H:161
tmp< Field< Type > > patchInternalField(const UList< Type > &) const
Return given internal field next to patch as patch field.
TypeName(polyPatch::typeName_())
Runtime type information.
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:130
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:192
Specialisations of Field<T> for scalar, vector and tensor.
PatchField< Type > Patch
Type of the patch field of which the.
const GeometricField::Patch & lookupPatchField(const word &name, const GeometricField *=nullptr, const Type *=nullptr) const
Lookup and return the patchField of the named field from the.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:155
const scalarField & deltaCoeffs() const
Return the face - cell distance coeffient.
Definition: fvPatch.C:164
Foam::fvBoundaryMesh.
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:105
label index() const
Return the index of this patch in the boundaryMesh.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:300
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:33
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:167
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:142
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:160
Namespace for OpenFOAM.
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:67