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

quadraticFitSnGrad.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     quadraticFitSnGrad
00027 
00028 Description
00029     Simple central-difference snGrad scheme with quadratic fit correction from
00030     a larger stencil.
00031 
00032 SourceFiles
00033     quadraticFitSnGrad.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef quadraticFitSnGrad_H
00038 #define quadraticFitSnGrad_H
00039 
00040 #include "snGradScheme.H"
00041 #include "quadraticFitSnGradData.H"
00042 #include "extendedCellToFaceStencil.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace fv
00052 {
00053 
00054 /*---------------------------------------------------------------------------*\
00055                  Class quadraticFitSnGrad Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 template<class Type>
00059 class quadraticFitSnGrad
00060 :
00061     public snGradScheme<Type>
00062 {
00063     // Private Data
00064         //- weights for central stencil
00065         const scalar centralWeight_;
00066 
00067     // Private Member Functions
00068 
00069         //- Disallow default bitwise assignment
00070         void operator=(const quadraticFitSnGrad&);
00071 
00072 
00073 public:
00074 
00075     //- Runtime type information
00076     TypeName("quadraticFit");
00077 
00078 
00079     // Constructors
00080 
00081         //- Construct from mesh and scheme data
00082         quadraticFitSnGrad
00083         (
00084             const fvMesh& mesh,
00085             const scalar centralWeight
00086         )
00087         :
00088             snGradScheme<Type>(mesh),
00089             centralWeight_(centralWeight)
00090         {}
00091 
00092 
00093         //- Construct from mesh and data stream
00094         quadraticFitSnGrad(const fvMesh& mesh, Istream& is)
00095         :
00096             snGradScheme<Type>(mesh),
00097             centralWeight_(readScalar(is))
00098         {}
00099 
00100 
00101     // Destructor
00102 
00103         virtual ~quadraticFitSnGrad() {}
00104 
00105 
00106     // Member Functions
00107 
00108         //- Return the interpolation weighting factors for the given field
00109         virtual tmp<surfaceScalarField> deltaCoeffs
00110         (
00111             const GeometricField<Type, fvPatchField, volMesh>&
00112         ) const
00113         {
00114             return this->mesh().deltaCoeffs();
00115         }
00116 
00117         //- Return true if this scheme uses an explicit correction
00118         virtual bool corrected() const
00119         {
00120             return true;
00121         }
00122 
00123         //- Return the explicit correction to the quadraticFitSnGrad
00124         //  for the given field
00125         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00126         correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
00127         {
00128             const fvMesh& mesh = this->mesh();
00129 
00130             const quadraticFitSnGradData& qfd = quadraticFitSnGradData::New
00131             (
00132                 mesh,
00133                 centralWeight_
00134             );
00135 
00136             const extendedCellToFaceStencil& stencil = qfd.stencil();
00137             const List<scalarList>& f = qfd.fit();
00138 
00139             tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > sft
00140                 = stencil.weightedSum(vf, f);
00141 
00142             sft().dimensions() /= dimLength;
00143 
00144             return sft;
00145         }
00146 };
00147 
00148 
00149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00150 
00151 } // End namespace fv
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 } // End namespace Foam
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #endif
00160 
00161 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd