1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
26 Foam::CentredFitScheme
29 Centred fit surface interpolation scheme which applies an explicit
32 \*---------------------------------------------------------------------------*/
34 #ifndef CentredFitScheme_H
35 #define CentredFitScheme_H
37 #include "CentredFitData.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 /*---------------------------------------------------------------------------*\
46 Class CentredFitScheme Declaration
47 \*---------------------------------------------------------------------------*/
49 template<class Type, class Polynomial, class Stencil>
50 class CentredFitScheme
56 //- Factor the fit is allowed to deviate from linear.
57 // This limits the amount of high-order correction and increases
58 // stability on bad meshes
59 const scalar linearLimitFactor_;
61 //- Weights for central stencil
62 const scalar centralWeight_;
65 // Private Member Functions
67 //- Disallow default bitwise copy construct
68 CentredFitScheme(const CentredFitScheme&);
70 //- Disallow default bitwise assignment
71 void operator=(const CentredFitScheme&);
76 //- Runtime type information
77 TypeName("CentredFitScheme");
82 //- Construct from mesh and Istream
83 CentredFitScheme(const fvMesh& mesh, Istream& is)
86 linearLimitFactor_(readScalar(is)),
91 //- Construct from mesh, faceFlux and Istream
95 const surfaceScalarField& faceFlux,
100 linearLimitFactor_(readScalar(is)),
107 //- Return true if this scheme uses an explicit correction
108 virtual bool corrected() const
113 //- Return the explicit correction to the face-interpolate
114 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
117 const GeometricField<Type, fvPatchField, volMesh>& vf
120 const fvMesh& mesh = this->mesh();
122 const extendedCentredCellToFaceStencil& stencil = Stencil::New
127 const CentredFitData<Polynomial>& cfd =
128 CentredFitData<Polynomial>::New
136 const List<scalarList>& f = cfd.coeffs();
138 return stencil.weightedSum(vf, f);
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 // Add the patch constructor functions to the hash tables
151 #define makeCentredFitSurfaceInterpolationTypeScheme(SS, POLYNOMIAL, STENCIL, TYPE) \
153 typedef CentredFitScheme<TYPE, POLYNOMIAL, STENCIL> \
154 CentredFitScheme##TYPE##POLYNOMIAL##STENCIL##_; \
155 defineTemplateTypeNameAndDebugWithName \
156 (CentredFitScheme##TYPE##POLYNOMIAL##STENCIL##_, #SS, 0); \
158 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
159 <CentredFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
160 add##SS##STENCIL##TYPE##MeshConstructorToTable_; \
162 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
163 <CentredFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
164 add##SS##STENCIL##TYPE##MeshFluxConstructorToTable_;
166 #define makeCentredFitSurfaceInterpolationScheme(SS, POLYNOMIAL, STENCIL) \
168 makeCentredFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,scalar) \
169 makeCentredFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,vector) \
170 makeCentredFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,sphericalTensor) \
171 makeCentredFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,symmTensor)\
172 makeCentredFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,tensor)
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //