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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fvPatch
28 
29 Description
30  A finiteVolume patch using a polyPatch and a fvBoundaryMesh
31 
32 SourceFiles
33  fvPatch.C
34  fvPatchNew.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef fvPatch_H
39 #define fvPatch_H
40 
41 #include "polyPatch.H"
42 #include "labelList.H"
43 #include "SubList.H"
44 #include "typeInfo.H"
45 #include "tmp.H"
46 #include "primitiveFields.H"
47 #include "SubField.H"
48 #include "fvPatchFieldsFwd.H"
49 #include "autoPtr.H"
50 #include "runTimeSelectionTables.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 class fvBoundaryMesh;
58 class surfaceInterpolation;
59 
60 /*---------------------------------------------------------------------------*\
61  Class fvPatch Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class fvPatch
65 {
66  // Private data
67 
68  //- Reference to the underlying polyPatch
69  const polyPatch& polyPatch_;
70 
71  //- Reference to boundary mesh
72  const fvBoundaryMesh& boundaryMesh_;
73 
74 
75  // Private Member Functions
76 
77  //- No copy construct
78  fvPatch(const fvPatch&) = delete;
79 
80  //- No copy assignment
81  void operator=(const fvPatch&) = delete;
82 
83 
84 protected:
85 
86  // Protected Member Functions
87 
88  //- Make patch weighting factors
89  virtual void makeWeights(scalarField&) const;
90 
91  //- Initialise the patches for moving points
92  virtual void initMovePoints();
93 
94  //- Correct patches after moving points
95  virtual void movePoints();
96 
97 
98 public:
99 
101 
102  friend class fvBoundaryMesh;
103  friend class surfaceInterpolation;
104 
105  //- Runtime type information
106  TypeName(polyPatch::typeName_());
107 
108 
109  // Declare run-time constructor selection tables
110 
112  (
113  autoPtr,
114  fvPatch,
115  polyPatch,
116  (const polyPatch& patch, const fvBoundaryMesh& bm),
117  (patch, bm)
118  );
119 
120 
121  // Constructors
122 
123  //- Construct from polyPatch and fvBoundaryMesh
124  fvPatch(const polyPatch&, const fvBoundaryMesh&);
125 
126 
127  // Selectors
128 
129  //- Return a pointer to a new patch created on freestore from polyPatch
130  static autoPtr<fvPatch> New
131  (
132  const polyPatch&,
133  const fvBoundaryMesh&
134  );
135 
136 
137  //- Destructor
138  virtual ~fvPatch();
139 
140 
141  // Member Functions
142 
143  // Access
144 
145  //- Return the polyPatch
146  const polyPatch& patch() const
147  {
148  return polyPatch_;
149  }
150 
151  //- Return name
152  virtual const word& name() const
153  {
154  return polyPatch_.name();
155  }
156 
157  //- Return start label of this patch in the polyMesh face list
158  virtual label start() const
159  {
160  return polyPatch_.start();
161  }
162 
163  //- Return size
164  virtual label size() const
165  {
166  return polyPatch_.size();
167  }
168 
169  //- Return true if this patch is coupled
170  virtual bool coupled() const
171  {
172  return polyPatch_.coupled();
173  }
174 
175  //- Return true if the given type is a constraint type
176  static bool constraintType(const word& pt);
177 
178  //- Return a list of all the constraint patch types
179  static wordList constraintTypes();
180 
181  //- Return the index of this patch in the fvBoundaryMesh
182  label index() const
183  {
184  return polyPatch_.index();
185  }
186 
187  //- Return boundaryMesh reference
188  const fvBoundaryMesh& boundaryMesh() const
189  {
190  return boundaryMesh_;
191  }
192 
193  //- Slice list to patch
194  template<class T>
195  const typename List<T>::subList patchSlice(const List<T>& l) const
196  {
197  return typename List<T>::subList(l, size(), start());
198  }
199 
200  //- Return faceCells
201  virtual const labelUList& faceCells() const;
202 
203 
204  // Access functions for geometrical data
205 
206  //- Return face centres
207  const vectorField& Cf() const;
208 
209  //- Return neighbour cell centres
210  tmp<vectorField> Cn() const;
211 
212  //- Return face area vectors
213  const vectorField& Sf() const;
214 
215  //- Return face area magnitudes
216  const scalarField& magSf() const;
217 
218  //- Return face normals
219  tmp<vectorField> nf() const;
220 
221  //- Return cell-centre to face-centre vector
222  //- except for coupled patches for which the cell-centre
223  //- to coupled-cell-centre vector is returned
224  virtual tmp<vectorField> delta() const;
225 
226 
227  // Access functions for demand driven data
228 
229  //- Return patch weighting factors
230  const scalarField& weights() const;
231 
232  //- Return the face - cell distance coefficient
233  //- except for coupled patches for which the cell-centre
234  //- to coupled-cell-centre distance coefficient is returned
235  const scalarField& deltaCoeffs() const;
236 
237 
238  // Evaluation functions
239 
240  //- Return given internal field next to patch as patch field
241  template<class Type>
243 
244  //- Return given internal field next to patch as patch field
245  template<class Type>
246  void patchInternalField(const UList<Type>&, Field<Type>&) const;
247 
248  //- Return the corresponding patchField of the named field
249  template<class GeometricField, class Type>
250  const typename GeometricField::Patch& patchField
251  (
252  const GeometricField&
253  ) const;
254 
255  //- Lookup and return the patchField of the named field from the
256  //- local objectRegistry.
257  // N.B. The dummy pointer arguments are used if this function is
258  // instantiated within a templated function to avoid a bug in gcc.
259  // See inletOutletFvPatchField.C and outletInletFvPatchField.C
260  template<class GeometricField, class Type>
262  (
263  const word& name,
264  const GeometricField* = nullptr,
265  const Type* = nullptr
266  ) const;
267 };
268 
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #ifdef NoRepository
277  #include "fvPatchTemplates.C"
278 #endif
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************************************************************* //
Foam::fvPatch::Sf
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:126
Foam::fvPatch::BoundaryMesh
fvBoundaryMesh BoundaryMesh
Definition: fvPatch.H:99
SubList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
SubField.H
typeInfo.H
polyPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::fvPatch::start
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:157
Foam::fvPatch::coupled
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:169
Foam::fvPatch::~fvPatch
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:57
Foam::fvPatch::delta
virtual tmp< vectorField > delta() const
Definition: fvPatch.C:138
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::polyPatch::coupled
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:327
Foam::fvPatch::New
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:35
fvPatchTemplates.C
fvPatchFieldsFwd.H
Foam::fvPatch::name
virtual const word & name() const
Return name.
Definition: fvPatch.H:151
Foam::fvPatch::patchInternalField
tmp< Field< Type > > patchInternalField(const UList< Type > &) const
Return given internal field next to patch as patch field.
Foam::fvPatch::movePoints
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:156
primitiveFields.H
Specialisations of Field<T> for scalar, vector and tensor.
Foam::fvPatch::patchSlice
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:194
Foam::fvPatch::boundaryMesh
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:187
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:57
Foam::fvPatch::size
virtual label size() const
Return size.
Definition: fvPatch.H:163
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:120
Foam::label
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:62
labelList.H
Foam::Field< scalar >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Foam::fvPatch::initMovePoints
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:152
Foam::fvPatch::constraintType
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:63
Foam::fvPatch::Cf
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:95
Foam::fvPatch::lookupPatchField
const GeometricField::Patch & lookupPatchField(const word &name, const GeometricField *=nullptr, const Type *=nullptr) const
Definition: fvPatchFvMeshTemplates.C:34
Foam::List::subList
SubList< T > subList
Declare type of subList.
Definition: List.H:117
Foam::fvPatch::index
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:181
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:311
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
tmp.H
Foam::fvPatch::weights
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:166
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List< word >
Foam::fvPatch::deltaCoeffs
const scalarField & deltaCoeffs() const
Definition: fvPatch.C:160
Foam::UList< label >
Foam::surfaceInterpolation
Cell to surface interpolation scheme. Included in fvMesh.
Definition: surfaceInterpolation.H:54
Foam::fvPatch::patchField
const GeometricField::Patch & patchField(const GeometricField &) const
Return the corresponding patchField of the named field.
Definition: fvPatchTemplates.C:72
Foam::fvPatch::faceCells
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:89
Foam::fvPatch::patch
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:145
Foam::fvPatch::TypeName
TypeName(polyPatch::typeName_())
Runtime type information.
Foam::fvPatch::magSf
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:132
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::GeometricField::Patch
PatchField< Type > Patch
Type of the patch field of which the.
Definition: GeometricField.H:111
Foam::patchIdentifier::name
const word & name() const
Return the patch name.
Definition: patchIdentifier.H:109
Foam::patchIdentifier::index
label index() const
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:133
Foam::fvPatch::makeWeights
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:146
Foam::fvPatch::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, fvPatch, polyPatch,(const polyPatch &patch, const fvBoundaryMesh &bm),(patch, bm))
Foam::fvPatch::constraintTypes
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:69
Foam::fvPatch::Cn
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:101
autoPtr.H