initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / PhiScheme / PhiScheme.H
blob71b3e11bfe8d04a903dad9ef51bdcc8d71f4f3af
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::PhiScheme
28 Description
29     Class to create the weighting-factors based on the face-flux.
31     The particular differencing scheme class is supplied as a template
32     argument, the weight function of which is called by the weight function
33     of this class for the internal faces as well as faces of coupled
34     patches (e.g. processor-processor patches). The weight function is
35     supplied with the central-differencing weighting factor, the face-flux,
36     the face neighbour cell values and the face area.
38     This code organisation is both neat and efficient, allowing for
39     convenient implementation of new schemes to run on parallelised cases.
41 SourceFiles
42     PhiScheme.C
44 \*---------------------------------------------------------------------------*/
46 #ifndef PhiScheme_H
47 #define PhiScheme_H
49 #include "limitedSurfaceInterpolationScheme.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 /*---------------------------------------------------------------------------*\
57                            Class PhiScheme Declaration
58 \*---------------------------------------------------------------------------*/
60 template<class Type, class PhiLimiter>
61 class PhiScheme
63     public limitedSurfaceInterpolationScheme<Type>,
64     public PhiLimiter
66     // Private Member Functions
68         //- Disallow default bitwise copy construct
69         PhiScheme(const PhiScheme&);
71         //- Disallow default bitwise assignment
72         void operator=(const PhiScheme&);
75 public:
77     //- Runtime type information
78     TypeName("PhiScheme");
81     // Constructors
83         //- Construct from mesh, faceFlux and blendingFactor
84         PhiScheme
85         (
86             const fvMesh& mesh,
87             const surfaceScalarField& faceFlux,
88             const PhiLimiter& weight
89         )
90         :
91             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
92             PhiLimiter(weight)
93         {}
95         //- Construct from mesh and Istream. 
96         //  The name of the flux field is read from the Istream and looked-up
97         //  from the mesh objectRegistry
98         PhiScheme
99         (
100             const fvMesh& mesh,
101             Istream& is
102         )
103         :
104             limitedSurfaceInterpolationScheme<Type>(mesh, is),
105             PhiLimiter(is)
106         {}
108         //- Construct from mesh, faceFlux and Istream
109         PhiScheme
110         (
111             const fvMesh& mesh,
112             const surfaceScalarField& faceFlux,
113             Istream& is
114         )
115         :
116             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
117             PhiLimiter(is)
118         {}
121     // Member Functions
123         //- Return the interpolation weighting factors
124         virtual tmp<surfaceScalarField> limiter
125         (
126             const GeometricField<Type, fvPatchField, volMesh>&
127         ) const;
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 } // End namespace Foam
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 // Add the patch constructor functions to the hash tables
139 #define makePhiSurfaceInterpolationScheme(SS, WEIGHT, TYPE)                    \
140                                                                                \
141 typedef PhiScheme<TYPE, WEIGHT> Phischeme##WEIGHT_;                            \
142 defineTemplateTypeNameAndDebugWithName(Phischeme##WEIGHT_, #SS, 0);            \
143                                                                                \
144 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                    \
145 <PhiScheme<TYPE, WEIGHT> > add##SS##TYPE##MeshConstructorToTable_;             \
146                                                                                \
147 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable                \
148 <PhiScheme<TYPE, WEIGHT> > add##SS##TYPE##MeshFluxConstructorToTable_;         \
149                                                                                \
150 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable             \
151 <PhiScheme<TYPE, WEIGHT> > add##SS##TYPE##MeshConstructorToLimitedTable_;      \
152                                                                                \
153 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable         \
154 <PhiScheme<TYPE, WEIGHT> > add##SS##TYPE##MeshFluxConstructorToLimitedTable_;
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 #ifdef NoRepository
159 #   include "PhiScheme.C"
160 #endif
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 #endif
166 // ************************************************************************* //