OpenFOAM logo
Open Source CFD Toolkit

skewLinearEdgeInterpolation.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     skewLinearEdgeInterpolation
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     skewLinearEdgeInterpolationMake.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef skewLinearEdgeInterpolation_H
00038 #define skewLinearEdgeInterpolation_H
00039 
00040 #include "linearEdgeInterpolation.H"
00041 #include "gaussFaGrad.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class skewLinearEdgeInterpolation Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type>
00053 class skewLinearEdgeInterpolation
00054 :
00055     public linearEdgeInterpolation<Type>
00056 {
00057     // Private Member Functions
00058 
00059         //- Disallow default bitwise copy construct
00060         skewLinearEdgeInterpolation(const skewLinearEdgeInterpolation&);
00061 
00062         //- Disallow default bitwise assignment
00063         void operator=(const skewLinearEdgeInterpolation&);
00064 
00065 
00066 public:
00067 
00068     //- Runtime type information
00069     TypeName("skewLinear");
00070 
00071 
00072     // Constructors
00073 
00074         //- Construct from mesh
00075         skewLinearEdgeInterpolation(const faMesh& mesh)
00076         :
00077             edgeInterpolationScheme<Type>(mesh),
00078             linearEdgeInterpolation<Type>(mesh)
00079         {}
00080 
00081 
00082         //- Construct from mesh and Istream
00083         skewLinearEdgeInterpolation
00084         (
00085             const faMesh& mesh,
00086             Istream&
00087         )
00088         :
00089             edgeInterpolationScheme<Type>(mesh),
00090             linearEdgeInterpolation<Type>(mesh)
00091         {}
00092 
00093 
00094         //- Construct from mesh, faceFlux and Istream
00095         skewLinearEdgeInterpolation
00096         (
00097             const faMesh& mesh,
00098             const edgeScalarField&,
00099             Istream&
00100         )
00101         :
00102             edgeInterpolationScheme<Type>(mesh),
00103             linearEdgeInterpolation<Type>(mesh)
00104         {}
00105 
00106 
00107     // Member Functions
00108 
00109         //- Return true if this scheme uses an explicit correction
00110         virtual bool corrected() const
00111         {
00112             return this->mesh().skew();
00113         }
00114 
00115         //- Return the explicit correction to the face-interpolate
00116         virtual tmp<GeometricField<Type, faPatchField, edgeMesh> >
00117         correction
00118         (
00119             const GeometricField<Type, faPatchField, areaMesh>& vf
00120         ) const
00121         {
00122             const faMesh& mesh = this->mesh();
00123 
00124             tmp<GeometricField<Type, faPatchField, edgeMesh> > tsfCorr
00125             (
00126                 new GeometricField<Type, faPatchField, edgeMesh>
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                     mesh.skewCorrectionVectors()
00150                   & linearEdgeInterpolation
00151                     <
00152                         typename outerProduct
00153                         <
00154                             vector,
00155                             typename pTraits<Type>::cmptType
00156                         >::type
00157                     >
00158                     (mesh).interpolate
00159                     (
00160                         fa::gaussGrad<typename pTraits<Type>::cmptType>
00161                         (mesh).grad(vf.component(cmpt))
00162                     )
00163                 );
00164             }
00165 
00166             return tsfCorr;
00167         }
00168 };
00169 
00170 
00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00172 
00173 } // End namespace Foam
00174 
00175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00176 
00177 #endif
00178 
00179 // ************************************************************************* //
For further information go to www.openfoam.org