1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 A finiteVolume patch using a polyPatch and a fvBoundaryMesh
34 \*---------------------------------------------------------------------------*/
39 #include "polyPatch.H"
40 #include "labelList.H"
44 #include "primitiveFields.H"
46 #include "fvPatchFieldsFwd.H"
48 #include "runTimeSelectionTables.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 class surfaceInterpolation;
58 /*---------------------------------------------------------------------------*\
59 Class fvPatch Declaration
60 \*---------------------------------------------------------------------------*/
66 //- Reference to the underlying polyPatch
67 const polyPatch& polyPatch_;
69 //- Reference to boundary mesh
70 const fvBoundaryMesh& boundaryMesh_;
73 // Private Member Functions
75 //- Disallow construct as copy
76 fvPatch(const fvPatch&);
78 //- Disallow assignment
79 void operator=(const fvPatch&);
84 // Protected Member Functions
86 //- Make patch weighting factors
87 virtual void makeWeights(scalarField&) const;
89 //- Make patch face - neighbour cell distances
90 virtual void makeDeltaCoeffs(scalarField&) const;
92 //- Initialise the patches for moving points
93 virtual void initMovePoints();
95 //- Correct patches after moving points
96 virtual void movePoints();
101 typedef fvBoundaryMesh BoundaryMesh;
103 friend class fvBoundaryMesh;
104 friend class surfaceInterpolation;
106 //- Runtime type information
107 TypeName(polyPatch::typeName_());
110 // Declare run-time constructor selection tables
112 declareRunTimeSelectionTable
117 (const polyPatch& patch, const fvBoundaryMesh& bm),
124 //- Construct from polyPatch and fvBoundaryMesh
125 fvPatch(const polyPatch&, const fvBoundaryMesh&);
130 //- Return a pointer to a new patch created on freestore from polyPatch
131 static autoPtr<fvPatch> New
134 const fvBoundaryMesh&
146 //- Return the polyPatch
147 const polyPatch& patch() const
153 const word& name() const
155 return polyPatch_.name();
158 //- Return start label of this patch in the polyMesh face list
161 return polyPatch_.start();
165 virtual label size() const
167 return polyPatch_.size();
170 //- Return true if this patch is coupled
173 return polyPatch_.coupled();
176 //- Return true if the given type is a constraint type
177 static bool constraintType(const word& pt);
179 //- Return a list of all the constraint patch types
180 static wordList constraintTypes();
182 //- Return the index of this patch in the fvBoundaryMesh
185 return polyPatch_.index();
188 //- Return boundaryMesh reference
189 const fvBoundaryMesh& boundaryMesh() const
191 return boundaryMesh_;
194 //- Slice list to patch
196 const typename List<T>::subList patchSlice(const List<T>& l) const
198 return typename List<T>::subList(l, size(), start());
202 virtual const labelUList& faceCells() const;
205 // Access functions for geometrical data
207 //- Return face centres
208 const vectorField& Cf() const;
210 //- Return neighbour cell centres
211 tmp<vectorField> Cn() const;
213 //- Return face area vectors
214 const vectorField& Sf() const;
216 //- Return face area magnitudes
217 const scalarField& magSf() const;
219 //- Return face normals
220 tmp<vectorField> nf() const;
222 //- Return cell-centre to face-centre vector
223 // except for coupled patches for which the cell-centre
224 // to coupled-cell-centre vector is returned
225 virtual tmp<vectorField> delta() const;
228 // Access functions for demand driven data
230 //- Return patch weighting factors
231 const scalarField& weights() const;
233 //- Return the face - cell distance coeffient
234 // except for coupled patches for which the cell-centre
235 // to coupled-cell-centre distance coeffient is returned
236 const scalarField& deltaCoeffs() const;
239 // Evaluation functions
241 //- Return given internal field next to patch as patch field
243 tmp<Field<Type> > patchInternalField(const UList<Type>&) const;
245 //- Return the corresponding patchField of the named field
246 template<class GeometricField, class Type>
247 const typename GeometricField::PatchFieldType& patchField
249 const GeometricField&
252 //- Lookup and return the patchField of the named field from the
253 // local objectRegistry.
254 // N.B. The dummy pointer arguments are used if this function is
255 // instantiated within a templated function to avoid a bug in gcc.
256 // See inletOutletFvPatchField.C and outletInletFvPatchField.C
257 template<class GeometricField, class Type>
258 const typename GeometricField::PatchFieldType& lookupPatchField
261 const GeometricField* = NULL,
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 } // End namespace Foam
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 # include "fvPatchTemplates.C"
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 // ************************************************************************* //