FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::fvPatch
00026 
00027 Description
00028     Foam::fvPatch
00029 
00030 SourceFiles
00031     fvPatch.C
00032     newFvPatch.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef fvPatch_H
00037 #define fvPatch_H
00038 
00039 #include <OpenFOAM/polyPatch.H>
00040 #include <OpenFOAM/labelList.H>
00041 #include <OpenFOAM/SubList.H>
00042 #include <OpenFOAM/typeInfo.H>
00043 #include <OpenFOAM/tmp.H>
00044 #include <OpenFOAM/primitiveFields.H>
00045 #include <OpenFOAM/SubField.H>
00046 #include <finiteVolume/fvPatchFieldsFwd.H>
00047 #include <OpenFOAM/autoPtr.H>
00048 #include <OpenFOAM/runTimeSelectionTables.H>
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 class fvBoundaryMesh;
00056 class surfaceInterpolation;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class fvPatch Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class fvPatch
00063 {
00064     // Private data
00065 
00066         //- Reference to the underlying polyPatch
00067         const polyPatch& polyPatch_;
00068 
00069         //- Reference to boundary mesh
00070         const fvBoundaryMesh& boundaryMesh_;
00071 
00072 
00073     // Private Member Functions
00074 
00075         //- Disallow construct as copy
00076         fvPatch(const fvPatch&);
00077 
00078         //- Disallow assignment
00079         void operator=(const fvPatch&);
00080 
00081 
00082 protected:
00083 
00084     // Protected Member Functions
00085 
00086         //- Make patch weighting factors
00087         virtual void makeWeights(scalarField&) const;
00088 
00089         //- Make patch face - neighbour cell distances
00090         virtual void makeDeltaCoeffs(scalarField&) const;
00091 
00092         //- Initialise the patches for moving points
00093         virtual void initMovePoints();
00094 
00095         //- Correct patches after moving points
00096         virtual void movePoints();
00097 
00098 
00099 public:
00100 
00101     typedef fvBoundaryMesh BoundaryMesh;
00102 
00103     friend class fvBoundaryMesh;
00104     friend class surfaceInterpolation;
00105 
00106     //- Runtime type information
00107     TypeName(polyPatch::typeName_());
00108 
00109 
00110     // Declare run-time constructor selection tables
00111 
00112         declareRunTimeSelectionTable
00113         (
00114             autoPtr,
00115             fvPatch,
00116             polyPatch,
00117             (const polyPatch& patch, const fvBoundaryMesh& bm),
00118             (patch, bm)
00119         );
00120 
00121 
00122     // Constructors
00123 
00124         //- Construct from polyPatch
00125         fvPatch(const polyPatch&, const fvBoundaryMesh&);
00126 
00127 
00128     // Selectors
00129 
00130         //- Return a pointer to a new patch created on freestore from polyPatch
00131         static autoPtr<fvPatch> New(const polyPatch&, const fvBoundaryMesh&);
00132 
00133 
00134     // Destructor
00135 
00136         virtual ~fvPatch();
00137 
00138 
00139     // Member Functions
00140 
00141     // Access
00142 
00143             //- Return the polyPatch
00144             const polyPatch& patch() const
00145             {
00146                 return polyPatch_;
00147             }
00148 
00149             //- Return name
00150             const word& name() const
00151             {
00152                 return polyPatch_.name();
00153             }
00154 
00155             //- Return size
00156             virtual label size() const
00157             {
00158                 return polyPatch_.size();
00159             }
00160 
00161             //- Return true if this patch is coupled
00162             bool coupled() const
00163             {
00164                 return polyPatch_.coupled();
00165             }
00166 
00167             //- Return true if the given type is a constraint type
00168             static bool constraintType(const word& pt);
00169 
00170             //- Return a list of all the constraint patch types
00171             static wordList constraintTypes();
00172 
00173             //- Return the index of this patch in the fvBoundaryMesh
00174             label index() const
00175             {
00176                 return polyPatch_.index();
00177             }
00178 
00179             //- Return boundaryMesh reference
00180             const fvBoundaryMesh& boundaryMesh() const
00181             {
00182                 return boundaryMesh_;
00183             }
00184 
00185             //- Slice list to patch
00186             template<class T>
00187             const typename List<T>::subList patchSlice(const List<T>& l) const
00188             {
00189                 return typename List<T>::subList(l, size(), polyPatch_.start());
00190             }
00191 
00192             //- Return faceCells
00193             virtual const unallocLabelList& faceCells() const;
00194 
00195 
00196         // Access functions for geometrical data
00197 
00198             //- Return face centres
00199             const vectorField& Cf() const;
00200 
00201             //- Return neighbour cell centres
00202             tmp<vectorField> Cn() const;
00203 
00204             //- Return face area vectors
00205             const vectorField& Sf() const;
00206 
00207             //- Return face area magnitudes
00208             const scalarField& magSf() const;
00209 
00210             //- Return face normals
00211             tmp<vectorField> nf() const;
00212 
00213             //- Return cell-centre to face-centre vector
00214             //  except for coupled patches for which the cell-centre
00215             //  to coupled-cell-centre vector is returned
00216             virtual tmp<vectorField> delta() const;
00217 
00218 
00219         // Access functions for demand driven data
00220 
00221             //- Return patch weighting factors
00222             const scalarField& weights() const;
00223 
00224             //- Return the face - cell distance coeffient
00225             //  except for coupled patches for which the cell-centre
00226             //  to coupled-cell-centre distance coeffient is returned
00227             const scalarField& deltaCoeffs() const;
00228 
00229 
00230         // Evaluation functions
00231 
00232             //- Return given internal field next to patch as patch field
00233             template<class Type>
00234             tmp<Field<Type> > patchInternalField(const UList<Type>&) const;
00235 
00236             //- Return the corresponding patchField of the named field
00237             template<class GeometricField, class Type>
00238             const typename GeometricField::PatchFieldType& patchField
00239             (
00240                 const GeometricField&
00241             ) const;
00242 
00243             //- Lookup and return the patchField of the named field from the
00244             //  local objectRegistry.
00245             //  N.B.  The dummy pointer arguments are used if this function is 
00246             //  instantiated within a templated function to avoid a bug in gcc.
00247             //  See inletOutletFvPatchField.C and outletInletFvPatchField.C
00248             template<class GeometricField, class Type>
00249             const typename GeometricField::PatchFieldType& lookupPatchField
00250             (
00251                 const word& name,
00252                 const GeometricField* = NULL,
00253                 const Type* = NULL
00254             ) const;
00255 };
00256 
00257 
00258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00259 
00260 } // End namespace Foam
00261 
00262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00263 
00264 #ifdef NoRepository
00265 #   include <finiteVolume/fvPatchTemplates.C>
00266 #endif
00267 
00268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00269 
00270 #endif
00271 
00272 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines