OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

fvPatch.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::fvPatch
00027 
00028 Description
00029     Foam::fvPatch
00030 
00031 SourceFiles
00032     fvPatch.C
00033     newFvPatch.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef fvPatch_H
00038 #define fvPatch_H
00039 
00040 #include "polyPatch.H"
00041 #include "labelList.H"
00042 #include "SubList.H"
00043 #include "typeInfo.H"
00044 #include "tmp.H"
00045 #include "primitiveFields.H"
00046 #include "SubField.H"
00047 #include "fvPatchFieldsFwd.H"
00048 #include "autoPtr.H"
00049 #include "runTimeSelectionTables.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 class fvBoundaryMesh;
00057 class surfaceInterpolation;
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class fvPatch Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class fvPatch
00064 {
00065     // Private data
00066 
00067         //- Reference to the underlying polyPatch
00068         const polyPatch& polyPatch_;
00069 
00070         //- Reference to boundary mesh
00071         const fvBoundaryMesh& boundaryMesh_;
00072 
00073 
00074     // Private Member Functions
00075 
00076         //- Disallow construct as copy
00077         fvPatch(const fvPatch&);
00078 
00079         //- Disallow assignment
00080         void operator=(const fvPatch&);
00081 
00082 
00083 protected:
00084 
00085     // Protected Member Functions
00086 
00087         //- Make patch weighting factors
00088         virtual void makeWeights(scalarField&) const;
00089 
00090         //- Make patch face - neighbour cell distances
00091         virtual void makeDeltaCoeffs(scalarField&) const;
00092 
00093         //- Initialise the patches for moving points
00094         virtual void initMovePoints();
00095 
00096         //- Correct patches after moving points
00097         virtual void movePoints();
00098 
00099 
00100 public:
00101 
00102     typedef fvBoundaryMesh BoundaryMesh;
00103 
00104     friend class fvBoundaryMesh;
00105     friend class surfaceInterpolation;
00106 
00107     //- Runtime type information
00108     TypeName(polyPatch::typeName_());
00109 
00110 
00111     // Declare run-time constructor selection tables
00112 
00113         declareRunTimeSelectionTable
00114         (
00115             autoPtr,
00116             fvPatch,
00117             polyPatch,
00118             (const polyPatch& patch, const fvBoundaryMesh& bm),
00119             (patch, bm)
00120         );
00121 
00122 
00123     // Constructors
00124 
00125         //- Construct from polyPatch
00126         fvPatch(const polyPatch&, const fvBoundaryMesh&);
00127 
00128 
00129     // Selectors
00130 
00131         //- Return a pointer to a new patch created on freestore from polyPatch
00132         static autoPtr<fvPatch> New(const polyPatch&, const fvBoundaryMesh&);
00133 
00134 
00135     // Destructor
00136 
00137         virtual ~fvPatch();
00138 
00139 
00140     // Member Functions
00141 
00142     // Access
00143 
00144             //- Return the polyPatch
00145             const polyPatch& patch() const
00146             {
00147                 return polyPatch_;
00148             }
00149 
00150             //- Return name
00151             const word& name() const
00152             {
00153                 return polyPatch_.name();
00154             }
00155 
00156             //- Return size
00157             virtual label size() const
00158             {
00159                 return polyPatch_.size();
00160             }
00161 
00162             //- Return true if this patch is coupled
00163             bool coupled() const
00164             {
00165                 return polyPatch_.coupled();
00166             }
00167 
00168             //- Return true if the given type is a constraint type
00169             static bool constraintType(const word& pt);
00170 
00171             //- Return a list of all the constraint patch types
00172             static wordList constraintTypes();
00173 
00174             //- Return the index of this patch in the fvBoundaryMesh
00175             label index() const
00176             {
00177                 return polyPatch_.index();
00178             }
00179 
00180             //- Return boundaryMesh reference
00181             const fvBoundaryMesh& boundaryMesh() const
00182             {
00183                 return boundaryMesh_;
00184             }
00185 
00186             //- Slice list to patch
00187             template<class T>
00188             const typename List<T>::subList patchSlice(const List<T>& l) const
00189             {
00190                 return typename List<T>::subList(l, size(), polyPatch_.start());
00191             }
00192 
00193             //- Return faceCells
00194             virtual const unallocLabelList& faceCells() const;
00195 
00196 
00197         // Access functions for geometrical data
00198 
00199             //- Return face centres
00200             const vectorField& Cf() const;
00201 
00202             //- Return neighbour cell centres
00203             tmp<vectorField> Cn() const;
00204 
00205             //- Return face area vectors
00206             const vectorField& Sf() const;
00207 
00208             //- Return face area magnitudes
00209             const scalarField& magSf() const;
00210 
00211             //- Return face normals
00212             tmp<vectorField> nf() const;
00213 
00214             //- Return cell-centre to face-centre vector
00215             //  except for coupled patches for which the cell-centre
00216             //  to coupled-cell-centre vector is returned
00217             virtual tmp<vectorField> delta() const;
00218 
00219 
00220         // Access functions for demand driven data
00221 
00222             //- Return patch weighting factors
00223             const scalarField& weights() const;
00224 
00225             //- Return the face - cell distance coeffient
00226             //  except for coupled patches for which the cell-centre
00227             //  to coupled-cell-centre distance coeffient is returned
00228             const scalarField& deltaCoeffs() const;
00229 
00230 
00231         // Evaluation functions
00232 
00233             //- Return given internal field next to patch as patch field
00234             template<class Type>
00235             tmp<Field<Type> > patchInternalField(const UList<Type>&) const;
00236 
00237             //- Return the corresponding patchField of the named field
00238             template<class GeometricField, class Type>
00239             const typename GeometricField::PatchFieldType& patchField
00240             (
00241                 const GeometricField&
00242             ) const;
00243 
00244             //- Lookup and return the patchField of the named field from the
00245             //  local objectRegistry.
00246             //  N.B.  The dummy pointer arguments are used if this function is 
00247             //  instantiated within a templated function to avoid a bug in gcc.
00248             //  See inletOutletFvPatchField.C and outletInletFvPatchField.C
00249             template<class GeometricField, class Type>
00250             const typename GeometricField::PatchFieldType& lookupPatchField
00251             (
00252                 const word& name,
00253                 const GeometricField* = NULL,
00254                 const Type* = NULL
00255             ) const;
00256 };
00257 
00258 
00259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00260 
00261 } // End namespace Foam
00262 
00263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00264 
00265 #ifdef NoRepository
00266 #   include "fvPatchTemplates.C"
00267 #endif
00268 
00269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00270 
00271 #endif
00272 
00273 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd