1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Skewness-corrected interpolation scheme that applies an explicit
30 correction to given scheme.
35 \*---------------------------------------------------------------------------*/
37 #ifndef skewCorrected_H
38 #define skewCorrected_H
40 #include "surfaceInterpolationScheme.H"
41 #include "skewCorrectionVectors.H"
43 #include "gaussGrad.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class skewCorrected Declaration
52 \*---------------------------------------------------------------------------*/
57 public surfaceInterpolationScheme<Type>
59 // Private member data
61 tmp<surfaceInterpolationScheme<Type> > tScheme_;
64 // Private Member Functions
66 //- Disallow default bitwise copy construct
67 skewCorrected(const skewCorrected&);
69 //- Disallow default bitwise assignment
70 void operator=(const skewCorrected&);
75 //- Runtime type information
76 TypeName("skewCorrected");
81 //- Construct from mesh and Istream
88 surfaceInterpolationScheme<Type>(mesh),
91 surfaceInterpolationScheme<Type>::New(mesh, is)
96 //- Construct from mesh, faceFlux and Istream
100 const surfaceScalarField& faceFlux,
104 surfaceInterpolationScheme<Type>(mesh),
107 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
114 //- Return the interpolation weighting factors
115 tmp<surfaceScalarField> weights
117 const GeometricField<Type, fvPatchField, volMesh>& vf
120 return tScheme_().weights(vf);
123 //- Return true if this scheme uses an explicit correction
124 virtual bool corrected() const
127 tScheme_().corrected()
128 || skewCorrectionVectors::New(this->mesh()).skew();
131 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
134 const GeometricField<Type, fvPatchField, volMesh>& vf
137 const fvMesh& mesh = this->mesh();
139 const skewCorrectionVectors& scv = skewCorrectionVectors::New(mesh);
141 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
143 new GeometricField<Type, fvsPatchField, surfaceMesh>
148 mesh.time().timeName(),
161 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
168 typename outerProduct
171 typename pTraits<Type>::cmptType
175 fv::gaussGrad<typename pTraits<Type>::cmptType>
176 (mesh).grad(vf.component(cmpt))
185 //- Return the explicit correction to the face-interpolate
186 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
189 const GeometricField<Type, fvPatchField, volMesh>& vf
194 tScheme_().corrected()
195 && skewCorrectionVectors::New(this->mesh()).skew()
198 return tScheme_().correction(vf) + skewCorrection(vf);
200 else if (tScheme_().corrected())
202 return tScheme_().correction(vf);
204 else if (skewCorrectionVectors::New(this->mesh()).skew())
206 return skewCorrection(vf);
211 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 } // End namespace Foam
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 // ************************************************************************* //