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::PureUpwindFitScheme
29 Upwind biased fit surface interpolation scheme that applies an explicit
32 \*---------------------------------------------------------------------------*/
34 #ifndef PureUpwindFitScheme_H
35 #define PureUpwindFitScheme_H
37 #include "UpwindFitData.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class PureUpwindFitScheme Declaration
48 \*---------------------------------------------------------------------------*/
50 template<class Type, class Polynomial, class Stencil>
51 class PureUpwindFitScheme
57 //- Factor the fit is allowed to deviate from linear.
58 // This limits the amount of high-order correction and increases
59 // stability on bad meshes
60 const scalar linearLimitFactor_;
62 //- Weights for central stencil
63 const scalar centralWeight_;
66 // Private Member Functions
68 //- Disallow default bitwise copy construct
69 PureUpwindFitScheme(const PureUpwindFitScheme&);
71 //- Disallow default bitwise assignment
72 void operator=(const PureUpwindFitScheme&);
77 //- Runtime type information
78 TypeName("PureUpwindFitScheme");
83 //- Construct from mesh and Istream
84 // The name of the flux field is read from the Istream and looked-up
85 // from the mesh objectRegistry
86 PureUpwindFitScheme(const fvMesh& mesh, Istream& is)
91 mesh.lookupObject<surfaceScalarField>(word(is))
93 linearLimitFactor_(readScalar(is)),
98 //- Construct from mesh, faceFlux and Istream
102 const surfaceScalarField& faceFlux,
106 upwind<Type>(mesh, faceFlux),
107 linearLimitFactor_(readScalar(is)),
114 //- Return true if this scheme uses an explicit correction
115 virtual bool corrected() const
120 //- Return the explicit correction to the face-interpolate
121 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
124 const GeometricField<Type, fvPatchField, volMesh>& vf
127 const fvMesh& mesh = this->mesh();
129 // Use the owner/neighbour splitting constructor
130 const extendedUpwindCellToFaceStencil& stencil = Stencil::New(mesh);
132 const UpwindFitData<Polynomial>& ufd =
133 UpwindFitData<Polynomial>::New
137 false, //offset to upwind
142 const List<scalarList>& fo = ufd.owncoeffs();
143 const List<scalarList>& fn = ufd.neicoeffs();
145 return stencil.weightedSum(this->faceFlux_, vf, fo, fn);
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 // Add the patch constructor functions to the hash tables
158 #define makePureUpwindFitSurfaceInterpolationTypeScheme(SS, POLYNOMIAL, STENCIL, TYPE) \
160 typedef PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> \
161 PureUpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_; \
162 defineTemplateTypeNameAndDebugWithName \
163 (PureUpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_, #SS, 0); \
165 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
166 <PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
167 add##SS##STENCIL##TYPE##MeshConstructorToTable_; \
169 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
170 <PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
171 add##SS##STENCIL##TYPE##MeshFluxConstructorToTable_;
173 #define makePureUpwindFitSurfaceInterpolationScheme(SS, POLYNOMIAL, STENCIL) \
175 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,scalar) \
176 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,vector) \
177 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,sphericalTensor) \
178 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,symmTensor) \
179 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,tensor)
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 // ************************************************************************* //