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 Simple central-difference snGrad scheme with quadratic fit correction from
35 \*---------------------------------------------------------------------------*/
37 #ifndef quadraticFitSnGrad_H
38 #define quadraticFitSnGrad_H
40 #include "snGradScheme.H"
41 #include "quadraticFitSnGradData.H"
42 #include "extendedCellToFaceStencil.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class quadraticFitSnGrad Declaration
56 \*---------------------------------------------------------------------------*/
59 class quadraticFitSnGrad
61 public snGradScheme<Type>
64 //- weights for central stencil
65 const scalar centralWeight_;
67 // Private Member Functions
69 //- Disallow default bitwise assignment
70 void operator=(const quadraticFitSnGrad&);
75 //- Runtime type information
76 TypeName("quadraticFit");
81 //- Construct from mesh and scheme data
85 const scalar centralWeight
88 snGradScheme<Type>(mesh),
89 centralWeight_(centralWeight)
93 //- Construct from mesh and data stream
94 quadraticFitSnGrad(const fvMesh& mesh, Istream& is)
96 snGradScheme<Type>(mesh),
97 centralWeight_(readScalar(is))
103 virtual ~quadraticFitSnGrad() {}
108 //- Return the interpolation weighting factors for the given field
109 virtual tmp<surfaceScalarField> deltaCoeffs
111 const GeometricField<Type, fvPatchField, volMesh>&
114 return this->mesh().deltaCoeffs();
117 //- Return true if this scheme uses an explicit correction
118 virtual bool corrected() const
123 //- Return the explicit correction to the quadraticFitSnGrad
124 // for the given field
125 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
126 correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
128 const fvMesh& mesh = this->mesh();
130 const quadraticFitSnGradData& qfd = quadraticFitSnGradData::New
136 const extendedCellToFaceStencil& stencil = qfd.stencil();
137 const List<scalarList>& f = qfd.fit();
139 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > sft
140 = stencil.weightedSum(vf, f);
142 sft().dimensions() /= dimLength;
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace fv
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 // ************************************************************************* //