OpenFOAM logo
Open Source CFD Toolkit

faNVDscheme.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-2005 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     Gamma
00027 
00028 Description
00029 
00030     Class to create the weighting-factors based on the NVD
00031     (Normalised Variable Diagram).
00032     The particular differencing scheme class is supplied as a template argument,
00033     the weight function of which is called by the weight function of this class
00034     for the internal edges as well as edges of coupled patches
00035     (e.g. processor-processor patches). The weight function is supplied the
00036     central-differencing weighting factor, the edge-flux, the cell and edge
00037     gradients (from which the normalised variable distribution may be created)
00038     and the cell centre distance.
00039 
00040     This code organisation is both neat and efficient, allowing for convenient
00041     implementation of new schemes to run on parallelised cases.
00042 
00043 SourceFiles
00044     faNVDscheme.C
00045 
00046 \*---------------------------------------------------------------------------*/
00047 
00048 #ifndef faNVDscheme_H
00049 #define faNVDscheme_H
00050 
00051 #include "edgeInterpolationScheme.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class faNVDscheme Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 template<class Type, class NVDweight>
00063 class faNVDscheme
00064 :
00065     public edgeInterpolationScheme<Type>,
00066     public NVDweight
00067 {
00068 
00069 protected:
00070 
00071     // Protected data
00072 
00073         const edgeScalarField& edgeFlux_;
00074 
00075 
00076 private:
00077 
00078     // Private Member Functions
00079 
00080         //- Disallow default bitwise copy construct
00081         faNVDscheme(const faNVDscheme&);
00082 
00083         //- Disallow default bitwise assignment
00084         void operator=(const faNVDscheme&);
00085 
00086 
00087 public:
00088 
00089     //- Define a typedef for the NVDweight
00090     typedef NVDweight Weight;
00091 
00092 
00093     //- Runtime type information
00094     TypeName("faNVDscheme");
00095 
00096 
00097     // Constructors
00098 
00099         //- Construct from mesh and edgeFlux and blendingFactor
00100         faNVDscheme
00101         (
00102             const faMesh& mesh,
00103             const edgeScalarField& edgeFlux,
00104             const NVDweight& weight
00105         )
00106         :
00107             edgeInterpolationScheme<Type>(mesh),
00108             NVDweight(weight),
00109             edgeFlux_(edgeFlux)
00110         {}
00111 
00112         //- Construct from mesh and Istream. 
00113         //  The name of the flux field is read from the Istream and looked-up
00114         //  from the database
00115         faNVDscheme
00116         (
00117             const faMesh& mesh,
00118             Istream& is
00119         )
00120         :
00121             edgeInterpolationScheme<Type>(mesh),
00122             NVDweight(is),
00123             edgeFlux_
00124             (
00125                 mesh().objectRegistry::lookupObject<edgeScalarField>
00126                 (
00127                     word(is)
00128                 )
00129             )
00130         {}
00131 
00132         //- Construct from mesh, edgeFlux and Istream
00133         faNVDscheme
00134         (
00135             const faMesh& mesh,
00136             const edgeScalarField& edgeFlux,
00137             Istream& is
00138         )
00139         :
00140             edgeInterpolationScheme<Type>(mesh),
00141             NVDweight(is),
00142             edgeFlux_(edgeFlux)
00143         {}
00144 
00145 
00146     // Member Functions
00147 
00148         //- Return the interpolation weighting factors
00149         virtual tmp<edgeScalarField> weights
00150         (
00151             const GeometricField<Type, faPatchField, areaMesh>&
00152         ) const;
00153 };
00154 
00155 
00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00157 
00158 } // End namespace Foam
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 // Add the patch constructor functions to the hash tables
00163 
00164 #define makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, TYPE)             \
00165                                                                                \
00166 typedef faNVDscheme<TYPE, WEIGHT> faNVDscheme##TYPE##WEIGHT_;                  \
00167 defineTemplateTypeNameAndDebugWithName(faNVDscheme##TYPE##WEIGHT_, NAME, 0);   \
00168                                                                                \
00169 edgeInterpolationScheme<TYPE>::addMeshConstructorToTable                       \
00170 <faNVDscheme<TYPE, WEIGHT> >                                                   \
00171     add##SS##TYPE##MeshConstructorToTable_;                                    \
00172                                                                                \
00173 edgeInterpolationScheme<TYPE>::addMeshFluxConstructorToTable                   \
00174 <faNVDscheme<TYPE, WEIGHT> >                                                   \
00175     add##SS##TYPE##MeshFluxConstructorToTable_;
00176 
00177 
00178 #define makeNVDedgeInterpolationScheme(SS, WEIGHT, NAME)                       \
00179                                                                                \
00180 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, scalar)                   \
00181 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, vector)                   \
00182 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, tensor)
00183 
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 #ifdef NoRepository
00188 #   include "faNVDscheme.C"
00189 #endif
00190 
00191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00192 
00193 #endif
00194 
00195 // ************************************************************************* //
For further information go to www.openfoam.org