OpenFOAM logo
Open Source CFD Toolkit

linearUpwind.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     linearUpwind
00027 
00028 Description
00029     linearUpwind interpolation scheme class derived from upwind and returns
00030     upwind weighting factors but also applies an explicit correction.
00031 
00032 SourceFiles
00033     linearUpwind.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef linearUpwind_H
00038 #define linearUpwind_H
00039 
00040 #include "upwind.H"
00041 #include "gaussGrad.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class linearUpwind Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type>
00053 class linearUpwind
00054 :
00055     public upwind<Type>
00056 {
00057     // Private Data
00058 
00059         tmp<fv::gradScheme<Type> > gradScheme_;
00060 
00061 
00062     // Private Member Functions
00063 
00064         //- Disallow default bitwise copy construct
00065         linearUpwind(const linearUpwind&);
00066 
00067         //- Disallow default bitwise assignment
00068         void operator=(const linearUpwind&);
00069 
00070 
00071 public:
00072 
00073     //- Runtime type information
00074     TypeName("linearUpwind");
00075 
00076 
00077     // Constructors
00078 
00079         //- Construct from faceFlux
00080         linearUpwind
00081         (
00082             const fvMesh& mesh,
00083             const surfaceScalarField& faceFlux
00084         )
00085         :
00086             upwind<Type>(mesh, faceFlux),
00087             gradScheme_
00088             (
00089                 new fv::gaussGrad<Type>(mesh)
00090             )
00091         {}
00092 
00093         //- Construct from Istream. 
00094         //  The name of the flux field is read from the Istream and looked-up
00095         //  from the mesh objectRegistry
00096         linearUpwind
00097         (
00098             const fvMesh& mesh,
00099             Istream& schemeData
00100         )
00101         :
00102             upwind<Type>(mesh, schemeData),
00103             gradScheme_
00104             (
00105                 fv::gradScheme<Type>::New
00106                 (
00107                     mesh,
00108                     schemeData
00109                 )
00110             )
00111         {}
00112 
00113         //- Construct from faceFlux and Istream
00114         linearUpwind
00115         (
00116             const fvMesh& mesh,
00117             const surfaceScalarField& faceFlux,
00118             Istream& schemeData
00119         )
00120         :
00121             upwind<Type>(mesh, faceFlux, schemeData),
00122             gradScheme_
00123             (
00124                 fv::gradScheme<Type>::New
00125                 (
00126                     mesh,
00127                     schemeData
00128                 )
00129             )
00130         {}
00131 
00132 
00133     // Member Functions
00134 
00135         //- Return true if this scheme uses an explicit correction
00136         virtual bool corrected() const
00137         {
00138             return true;
00139         }
00140 
00141         //- Return the explicit correction to the face-interpolate
00142         virtual tmp<GeometricField<Type, fvPatchField, surfaceMesh> >
00143         correction
00144         (
00145             const GeometricField<Type, fvPatchField, volMesh>& vf
00146         ) const;
00147 };
00148 
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 } // End namespace Foam
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 #endif
00157 
00158 // ************************************************************************* //
For further information go to www.openfoam.org