OpenFOAM logo
Open Source CFD Toolkit

skewLinear.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     skewLinear
00027 
00028 Description
00029     Skewness-corrected interpolation scheme class derived from linear and
00030     returns linear weighting factors but also applies an explicit correction.
00031 
00032 SourceFiles
00033     skewLinear.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef skewLinear_H
00038 #define skewLinear_H
00039 
00040 #include "skewCorrectionVectors.H"
00041 #include "linear.H"
00042 #include "gaussGrad.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class skewLinear Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template<class Type>
00054 class skewLinear
00055 :
00056     public linear<Type>
00057 {
00058     // Private Member Functions
00059 
00060         //- Disallow default bitwise copy construct
00061         skewLinear(const skewLinear&);
00062 
00063         //- Disallow default bitwise assignment
00064         void operator=(const skewLinear&);
00065 
00066 
00067 public:
00068 
00069     //- Runtime type information
00070     TypeName("skewLinear");
00071 
00072 
00073     // Constructors
00074 
00075         //- Construct from mesh
00076         skewLinear(const fvMesh& mesh)
00077         :
00078             linear<Type>(mesh)
00079         {}
00080 
00081 
00082         //- Construct from mesh and Istream
00083         skewLinear
00084         (
00085             const fvMesh& mesh,
00086             Istream&
00087         )
00088         :
00089             linear<Type>(mesh)
00090         {}
00091 
00092 
00093         //- Construct from mesh, faceFlux and Istream
00094         skewLinear
00095         (
00096             const fvMesh& mesh,
00097             const surfaceScalarField&,
00098             Istream&
00099         )
00100         :
00101             linear<Type>(mesh)
00102         {}
00103 
00104 
00105     // Member Functions
00106 
00107         //- Return true if this scheme uses an explicit correction
00108         virtual bool corrected() const
00109         {
00110             return skewCorrectionVectors::New(this->mesh()).skew();
00111         }
00112 
00113         //- Return the explicit correction to the face-interpolate
00114         virtual tmp<GeometricField<Type, fvPatchField, surfaceMesh> >
00115         correction
00116         (
00117             const GeometricField<Type, fvPatchField, volMesh>& vf
00118         ) const
00119         {
00120             const fvMesh& mesh = this->mesh();
00121 
00122             const skewCorrectionVectors& scv = skewCorrectionVectors::New(mesh);
00123 
00124             tmp<GeometricField<Type, fvPatchField, surfaceMesh> > tsfCorr
00125             (
00126                 new GeometricField<Type, fvPatchField, surfaceMesh>
00127                 (
00128                     IOobject
00129                     (
00130                         vf.name(),
00131                         mesh.time().timeName(),
00132                         mesh
00133                     ),
00134                     mesh,
00135                     dimensioned<Type>
00136                     (
00137                         vf.name(),
00138                         vf.dimensions(),
00139                         pTraits<Type>::zero
00140                     )
00141                 )
00142             );
00143 
00144             for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
00145             {
00146                 tsfCorr().replace
00147                 (
00148                     cmpt,
00149                     scv() & linear
00150                     <
00151                         typename outerProduct
00152                         <
00153                             vector,
00154                             typename pTraits<Type>::cmptType
00155                         >::type
00156                     > (mesh).interpolate
00157                     (
00158                         fv::gaussGrad<typename pTraits<Type>::cmptType>
00159                         (mesh).grad(vf.component(cmpt))
00160                     )
00161                 );
00162             }
00163 
00164             return tsfCorr;
00165         }
00166 };
00167 
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 } // End namespace Foam
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 #endif
00176 
00177 // ************************************************************************* //
For further information go to www.openfoam.org