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

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