OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

limitWith.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-2009 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     Foam::limitWith
00027 
00028 Description
00029     limitWith differencing scheme limits the specified scheme with the
00030     specified limiter.
00031 
00032 SourceFiles
00033     limitWith.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef limitWith_H
00038 #define limitWith_H
00039 
00040 #include "surfaceInterpolationScheme.H"
00041 #include "limitedSurfaceInterpolationScheme.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class limitWith Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type>
00053 class limitWith
00054 :
00055     public surfaceInterpolationScheme<Type>
00056 {
00057     // Private Member Functions
00058 
00059         //- Interpolation scheme
00060         tmp<surfaceInterpolationScheme<Type> > tInterp_;
00061 
00062         //- Limiter
00063         tmp<limitedSurfaceInterpolationScheme<Type> > tLimiter_;
00064 
00065 
00066         //- Disallow default bitwise copy construct
00067         limitWith(const limitWith&);
00068 
00069         //- Disallow default bitwise assignment
00070         void operator=(const limitWith&);
00071 
00072 
00073 public:
00074 
00075     //- Runtime type information
00076     TypeName("limitWith");
00077 
00078 
00079     // Constructors
00080 
00081         //- Construct from mesh and Istream.
00082         //  The name of the flux field is read from the Istream and looked-up
00083         //  from the mesh objectRegistry
00084         limitWith
00085         (
00086             const fvMesh& mesh,
00087             Istream& is
00088         )
00089         :
00090             surfaceInterpolationScheme<Type>(mesh),
00091             tInterp_
00092             (
00093                 surfaceInterpolationScheme<Type>::New(mesh, is)
00094             ),
00095             tLimiter_
00096             (
00097                 limitedSurfaceInterpolationScheme<Type>::New(mesh, is)
00098             )
00099         {}
00100 
00101         //- Construct from mesh, faceFlux and Istream
00102         limitWith
00103         (
00104             const fvMesh& mesh,
00105             const surfaceScalarField& faceFlux,
00106             Istream& is
00107         )
00108         :
00109             surfaceInterpolationScheme<Type>(mesh),
00110             tInterp_
00111             (
00112                 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00113             ),
00114             tLimiter_
00115             (
00116                 limitedSurfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00117             )
00118         {}
00119 
00120 
00121     // Member Functions
00122 
00123         //- Return the interpolation weighting factors
00124         virtual tmp<surfaceScalarField> weights
00125         (
00126             const GeometricField<Type, fvPatchField, volMesh>& vf
00127         ) const
00128         {
00129             return tLimiter_().weights
00130             (
00131                 vf,
00132                 tInterp_().weights(vf),
00133                 tLimiter_().limiter(vf)
00134             );
00135         }
00136 
00137         //- Return true if this scheme uses an explicit correction
00138         virtual bool corrected() const
00139         {
00140             return tInterp_().corrected();
00141         }
00142 
00143         //- Return the explicit correction to the face-interpolate
00144         //  for the given field
00145         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00146         correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
00147         {
00148             return tLimiter_().limiter(vf)*tInterp_().correction(vf);
00149         }
00150 };
00151 
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 } // End namespace Foam
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #endif
00160 
00161 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd