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

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