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

correctedSnGrad.C

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 Description
00025     Simple central-difference snGrad scheme with non-orthogonal correction.
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "correctedSnGrad.H"
00030 #include <finiteVolume/volFields.H>
00031 #include <finiteVolume/surfaceFields.H>
00032 #include <finiteVolume/linear.H>
00033 #include <finiteVolume/fvcGrad.H>
00034 #include <finiteVolume/gaussGrad.H>
00035 
00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00037 
00038 namespace Foam
00039 {
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace fv
00044 {
00045 
00046 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00047 
00048 template<class Type>
00049 correctedSnGrad<Type>::~correctedSnGrad()
00050 {}
00051 
00052 
00053 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00054 
00055 template<class Type>
00056 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00057 correctedSnGrad<Type>::correction
00058 (
00059     const GeometricField<Type, fvPatchField, volMesh>& vf
00060 ) const
00061 {
00062     const fvMesh& mesh = this->mesh();
00063 
00064     // construct GeometricField<Type, fvsPatchField, surfaceMesh>
00065     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf
00066     (
00067         new GeometricField<Type, fvsPatchField, surfaceMesh>
00068         (
00069             IOobject
00070             (
00071                 "snGradCorr("+vf.name()+')',
00072                 vf.instance(),
00073                 mesh,
00074                 IOobject::NO_READ,
00075                 IOobject::NO_WRITE
00076             ),
00077             mesh,
00078             vf.dimensions()*mesh.deltaCoeffs().dimensions()
00079         )
00080     );
00081     GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf();
00082 
00083     for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
00084     {
00085         ssf.replace
00086         (
00087             cmpt,
00088             mesh.correctionVectors()
00089           & linear
00090             <
00091                 typename
00092                 outerProduct<vector, typename pTraits<Type>::cmptType>::type
00093             >(mesh).interpolate
00094             (
00095                 gradScheme<typename pTraits<Type>::cmptType>::New
00096                 (
00097                     mesh,
00098                     mesh.gradScheme(ssf.name())
00099                 )()
00100                 //gaussGrad<typename pTraits<Type>::cmptType>(mesh)
00101                .grad(vf.component(cmpt))
00102             )
00103         );
00104     }
00105 
00106     return tssf;
00107 }
00108 
00109 
00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00111 
00112 } // End namespace fv
00113 
00114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00115 
00116 } // End namespace Foam
00117 
00118 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines