OpenFOAM logo
Open Source CFD Toolkit

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