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-2026 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 "fvPatchFieldsFwd.H"
41 #include "GeometricFieldFwd.H"
42 #include "SlicedDimensionedField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class fvMesh;
50 class fvBoundaryMesh;
51 class surfaceMesh;
52 class faceZone;
53 
54 /*---------------------------------------------------------------------------*\
55  Class fvPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class fvPatch
59 {
60  // Private Data
61 
62  //- Reference to the underlying polyPatch
63  const polyPatch& poly_;
64 
65  //- Reference to boundary mesh
66  const fvBoundaryMesh& boundaryMesh_;
67 
68  //- Dimensioned face centres
70 
71 
72 public:
73 
74  // Public Typedefs
75 
76  //- Mesh type
77  typedef fvMesh Mesh;
78 
79  //- Boundary mesh type
81 
82  //- Zone type
83  typedef faceZone Zone;
84 
85 
86  //- Runtime type information
87  TypeName(polyPatch::typeName_());
88 
89 
90  // Declare run-time constructor selection tables
91 
93  (
94  autoPtr,
95  fvPatch,
96  polyPatch,
97  (const polyPatch& patch, const fvBoundaryMesh& bm),
98  (patch, bm)
99  );
100 
101 
102  // Constructors
103 
104  //- Construct from polyPatch and fvBoundaryMesh
105  fvPatch(const polyPatch&, const fvBoundaryMesh&);
106 
107  //- Disallow default bitwise copy construction
108  fvPatch(const fvPatch&) = delete;
109 
110 
111  // Selectors
112 
113  //- Return a pointer to a new patch created on freestore from polyPatch
114  static autoPtr<fvPatch> New
115  (
116  const polyPatch&,
117  const fvBoundaryMesh&
118  );
119 
120 
121  //- Destructor
122  virtual ~fvPatch();
123 
124 
125  // Member Functions
126 
127  // Access
128 
129  //- Return the polyPatch
130  const polyPatch& poly() const
131  {
132  return poly_;
133  }
134 
135  //- Return name
136  virtual const word& name() const
137  {
138  return poly_.name();
139  }
140 
141  //- Return start label of this patch in the polyMesh face list
142  virtual label start() const
143  {
144  return poly_.start();
145  }
146 
147  //- Return size
148  virtual label size() const
149  {
150  return poly_.size();
151  }
152 
153  //- Return true if this patch is a constraint type
154  virtual bool constraint() const
155  {
156  return poly_.constraint();
157  }
158 
159  //- Return true if this patch is coupled
160  virtual bool coupled() const
161  {
162  return poly_.coupled();
163  }
164 
165  //- Return the index of this patch in the fvBoundaryMesh
166  label index() const
167  {
168  return poly_.index();
169  }
170 
171  //- Return the local object registry
172  const objectRegistry& db() const;
173 
174  //- Return mesh reference
175  const fvMesh& mesh() const;
176 
177  //- Return time
178  const Time& time() const;
179 
180  //- Return boundaryMesh reference
181  const fvBoundaryMesh& boundaryMesh() const
182  {
183  return boundaryMesh_;
184  }
185 
186  //- Slice list to patch
187  template<class T>
188  const typename List<T>::subList patchSlice(const List<T>& l) const
189  {
190  return typename List<T>::subList(l, size(), start());
191  }
192 
193  //- Return faceCells
194  virtual const labelUList& faceCells() const;
195 
196 
197  // Access functions for geometrical data
198 
199  //- Return face centres
200  const vectorField& Cf() const;
201 
202  //- Return dimensioned face centres
203  const DimensionedField<vector, fvPatch>& C() const;
204 
205  //- Return neighbour cell centres
206  tmp<vectorField> Cn() const;
207 
208  //- Return face area vectors
209  const vectorField& Sf() const;
210 
211  //- Return face area magnitudes
212  const scalarField& magSf() const;
213 
214  //- Return face normals
215  tmp<vectorField> nf() const;
216 
217  //- Return cell-centre to face-centre vector
218  // except for coupled patches for which the cell-centre
219  // to coupled-cell-centre vector is returned
220  virtual tmp<vectorField> delta() const;
221 
222  //- Return the fraction of the poly-face that each fv-face in this
223  // patch covers. Will be equal to one, unless the mesh is
224  // non-conformal.
226 
227 
228  // Access functions for demand driven data
229 
230  //- Make patch weighting factors
231  virtual void makeWeights(scalarField&) const;
232 
233  //- Return patch weighting factors
234  const scalarField& weights() const;
235 
236  //- Return the face - cell distance coefficient
237  // except for coupled patches for which the cell-centre
238  // to coupled-cell-centre distance coefficient is returned
239  virtual const scalarField& deltaCoeffs() const;
240 
241 
242  // Evaluation functions
243 
244  //- Return given internal field next to patch as patch field
245  template<class Type>
247 
248  //- Return given internal field next to patch as patch field
249  template<class Type>
250  void patchInternalField(const UList<Type>&, Field<Type>&) const;
251 
252  //- Return the corresponding patchField of the named field
253  template<class GeometricField, class Type>
254  const typename GeometricField::Patch& patchField
255  (
256  const GeometricField&
257  ) const;
258 
259  //- Return the corresponding patchField reference of the named field
260  template<class GeometricField, class Type>
262  (
264  ) const;
265 
266  //- Lookup and return the patchField of the named field from the
267  // local objectRegistry.
268  template<class GeometricField, class Type>
270  (
271  const word& name
272  ) const;
273 
274  //- Lookup a dimensioned field for this geometry
275  template<class Type>
277 
278 
279  // Member Operators
280 
281  //- Disallow default bitwise assignment
282  void operator=(const fvPatch&) = delete;
283 
284  //- Return reference to fvMesh
285  const fvMesh& operator()() const;
286 };
287 
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 } // End namespace Foam
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 
295 #ifdef NoRepository
296  #include "fvPatchTemplates.C"
297 #endif
298 
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 
301 #endif
302 
303 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
GeoMesh::template PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
SubList< T > subList
Declare type of subList.
Definition: List.H:195
A List obtained as a section of another List.
Definition: SubList.H:56
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Named list of face indices representing a sub-set of the mesh faces.
Definition: faceZone.H:66
Foam::fvBoundaryMesh.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
const polyPatch & poly() const
Return the polyPatch.
Definition: fvPatch.H:129
virtual label size() const
Return size.
Definition: fvPatch.H:147
const fvMesh & operator()() const
Return reference to fvMesh.
Definition: fvPatch.C:199
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
void operator=(const fvPatch &)=delete
Disallow default bitwise assignment.
const Time & time() const
Return time.
Definition: fvPatch.C:73
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:159
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:181
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:165
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:141
fvMesh Mesh
Mesh type.
Definition: fvPatch.H:76
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:32
faceZone Zone
Zone type.
Definition: fvPatch.H:82
const objectRegistry & db() const
Return the local object registry.
Definition: fvPatch.C:61
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:122
virtual bool constraint() const
Return true if this patch is a constraint type.
Definition: fvPatch.H:153
virtual const word & name() const
Return name.
Definition: fvPatch.H:135
declareRunTimeSelectionTable(autoPtr, fvPatch, polyPatch,(const polyPatch &patch, const fvBoundaryMesh &bm),(patch, bm))
tmp< scalarField > polyFaceFraction() const
Return the fraction of the poly-face that each fv-face in this.
Definition: fvPatch.C:167
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:159
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:153
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:193
const DimensionedField< vector, fvPatch > & C() const
Return dimensioned face centres.
Definition: fvPatch.C:92
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:187
fvPatch(const polyPatch &, const fvBoundaryMesh &)
Construct from polyPatch and fvBoundaryMesh.
Definition: fvPatch.C:46
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:141
tmp< Field< Type > > patchInternalField(const UList< Type > &) const
Return given internal field next to patch as patch field.
fvBoundaryMesh BoundaryMesh
Boundary mesh type.
Definition: fvPatch.H:79
const fvMesh & mesh() const
Return mesh reference.
Definition: fvPatch.C:67
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:85
tmp< DimensionedField< Type, fvPatch > > lookupField(const word &) const
Lookup a dimensioned field for this geometry.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:180
virtual const scalarField & deltaCoeffs() const
Return the face - cell distance coefficient.
Definition: fvPatch.C:187
TypeName(polyPatch::typeName_())
Runtime type information.
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:147
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:79
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:71
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:296
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:277
virtual bool constraint() const
Return false as this patch is not a constraint type.
Definition: polyPatch.H:289
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
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