fvPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 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 "tmpNrc.H"
45 #include "primitiveFields.H"
46 #include "SubField.H"
47 #include "fvPatchFieldsFwd.H"
48 #include "autoPtr.H"
49 #include "runTimeSelectionTables.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 class fvBoundaryMesh;
57 class objectRegistry;
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 protected:
76 
77  // Protected Member Functions
78 
79  //- Make patch weighting factors
80  virtual void makeWeights(scalarField&) const;
81 
82  //- Initialise the patches for moving points
83  virtual void initMovePoints();
84 
85  //- Correct patches after moving points
86  virtual void movePoints();
87 
88 
89 public:
90 
92 
93  friend class fvBoundaryMesh;
94  friend class surfaceInterpolation;
95 
96 
97  //- Runtime type information
98  TypeName(polyPatch::typeName_());
99 
100 
101  // Declare run-time constructor selection tables
102 
104  (
105  autoPtr,
106  fvPatch,
107  polyPatch,
108  (const polyPatch& patch, const fvBoundaryMesh& bm),
109  (patch, bm)
110  );
111 
112 
113  // Constructors
114 
115  //- Construct from polyPatch and fvBoundaryMesh
116  fvPatch(const polyPatch&, const fvBoundaryMesh&);
117 
118  //- Disallow default bitwise copy construction
119  fvPatch(const fvPatch&) = delete;
120 
121 
122  // Selectors
123 
124  //- Return a pointer to a new patch created on freestore from polyPatch
125  static autoPtr<fvPatch> New
126  (
127  const polyPatch&,
128  const fvBoundaryMesh&
129  );
130 
131 
132  //- Destructor
133  virtual ~fvPatch();
134 
135 
136  // Member Functions
137 
138  // Access
139 
140  //- Return the polyPatch
141  const polyPatch& patch() const
142  {
143  return polyPatch_;
144  }
145 
146  //- Return name
147  virtual const word& name() const
148  {
149  return polyPatch_.name();
150  }
151 
152  //- Return start label of this patch in the polyMesh face list
153  virtual label start() const
154  {
155  return polyPatch_.start();
156  }
157 
158  //- Return size
159  virtual label size() const
160  {
161  return polyPatch_.size();
162  }
163 
164  //- Return true if this patch is coupled
165  virtual bool coupled() const
166  {
167  return polyPatch_.coupled();
168  }
169 
170  //- Return true if the given type is a constraint type
171  static bool constraintType(const word& pt);
172 
173  //- Return a list of all the constraint patch types
174  static wordList constraintTypes();
175 
176  //- Return the index of this patch in the fvBoundaryMesh
177  label index() const
178  {
179  return polyPatch_.index();
180  }
181 
182  //- Return boundaryMesh reference
183  const fvBoundaryMesh& boundaryMesh() const
184  {
185  return boundaryMesh_;
186  }
187 
188  //- Return the local object registry
189  const objectRegistry& db() const;
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 coefficient
231  // except for coupled patches for which the cell-centre
232  // to coupled-cell-centre distance coefficient is returned
233  virtual 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  template<class GeometricField, class Type>
264  (
265  const word& name
266  ) const;
267 
268 
269  // Member Operators
270 
271  //- Disallow default bitwise assignment
272  void operator=(const fvPatch&) = delete;
273 };
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 } // End namespace Foam
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #ifdef NoRepository
283  #include "fvPatchTemplates.C"
284 #endif
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #endif
289 
290 // ************************************************************************* //
Generic GeometricField class.
PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
SubList< T > subList
Declare type of subList.
Definition: List.H:195
A List obtained as a section of another List.
Definition: SubList.H:56
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Foam::fvBoundaryMesh.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:67
virtual label size() const
Return size.
Definition: fvPatch.H:158
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
void operator=(const fvPatch &)=delete
Disallow default bitwise assignment.
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:164
const GeometricField::Patch & patchField(const GeometricField &) const
Return the corresponding patchField of the named field.
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:156
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:176
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:152
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:32
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:166
const objectRegistry & db() const
Return the local object registry.
Definition: fvPatch.C:93
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:111
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:140
virtual const word & name() const
Return name.
Definition: fvPatch.H:146
declareRunTimeSelectionTable(autoPtr, fvPatch, polyPatch,(const polyPatch &patch, const fvBoundaryMesh &bm),(patch, bm))
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:148
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:162
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:61
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:142
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:176
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:192
fvPatch(const polyPatch &, const fvBoundaryMesh &)
Construct from polyPatch and fvBoundaryMesh.
Definition: fvPatch.C:46
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:130
tmp< Field< Type > > patchInternalField(const UList< Type > &) const
Return given internal field next to patch as patch field.
fvBoundaryMesh BoundaryMesh
Definition: fvPatch.H:90
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:105
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:182
virtual const scalarField & deltaCoeffs() const
Return the face - cell distance coefficient.
Definition: fvPatch.C:170
TypeName(polyPatch::typeName_())
Runtime type information.
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:136
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:99
const GeometricField::Patch & lookupPatchField(const word &name) const
Lookup and return the patchField of the named field from the.
Registry of regIOobjects.
label index() const
Return the index of this patch in the boundaryMesh.
const word & name() const
Return name.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:290
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:280
Cell to surface interpolation scheme. Included in fvMesh.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
Specialisations of Field<T> for scalar, vector and tensor.
Macros to ease declaration of run-time selection tables.