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

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