OpenFOAM logo
Open Source CFD Toolkit

limitedGrad.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     limitedGrad
00027 
00028 Description
00029     Limited gradient scheme applied to a runTime selected base gradient scheme.
00030 
00031 SourceFiles
00032     limitedGrad.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef limitedGrad_H
00037 #define limitedGrad_H
00038 
00039 #include "gradScheme.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace fv
00049 {
00050 
00051 /*---------------------------------------------------------------------------*\
00052                        Class limitedGrad Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 template<class Type>
00056 class limitedGrad
00057 :
00058     public fv::gradScheme<Type>
00059 {
00060     // Private Data
00061 
00062         tmp<fv::gradScheme<Type> > basicGradScheme_;
00063 
00064         //- Limiter coefficient
00065         scalar k_;
00066 
00067 
00068     // Private Member Functions
00069 
00070         inline void limitFace
00071         (
00072             scalar& limiter,
00073             const scalar maxDelta,
00074             const scalar minDelta,
00075             const scalar extrapolate
00076         ) const;
00077 
00078 
00079         //- Disallow default bitwise copy construct
00080         limitedGrad(const limitedGrad&);
00081 
00082         //- Disallow default bitwise assignment
00083         void operator=(const limitedGrad&);
00084 
00085 
00086 public:
00087 
00088     //- RunTime type information
00089     TypeName("limited");
00090 
00091 
00092     // Constructors
00093 
00094         //- Construct from mesh and schemeData
00095         limitedGrad(const fvMesh& mesh, Istream& schemeData)
00096         :
00097             gradScheme<Type>(mesh),
00098             basicGradScheme_(fv::gradScheme<Type>::New(mesh, schemeData)),
00099             k_(readScalar(schemeData))
00100         {
00101             if (k_ < 0 || k_ > 1)
00102             {
00103                 FatalIOErrorIn
00104                 (
00105                     "limitedGrad(const fvMesh& mesh, Istream& schemeData)",
00106                     schemeData
00107                 )   << "coefficient = " << k_
00108                     << " should be >= 0 and <= 1"
00109                     << exit(FatalIOError);
00110             }
00111         }
00112 
00113 
00114     // Member Functions
00115 
00116         tmp
00117         <
00118             GeometricField
00119             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
00120         > grad
00121         (
00122             const GeometricField<Type, fvPatchField, volMesh>&
00123         ) const;
00124 };
00125 
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 } // End namespace fv
00130 
00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00132 
00133 } // End namespace Foam
00134 
00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00136 
00137 #endif
00138 
00139 // ************************************************************************* //
For further information go to www.openfoam.org