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

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