FreeFOAM The Cross-Platform CFD Toolkit
quadraticFitSnGrad.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  quadraticFitSnGrad
26 
27 Description
28  Simple central-difference snGrad scheme with quadratic fit correction from
29  a larger stencil.
30 
31 SourceFiles
32  quadraticFitSnGrad.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef quadraticFitSnGrad_H
37 #define quadraticFitSnGrad_H
38 
40 #include "quadraticFitSnGradData.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace fv
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class quadraticFitSnGrad Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public snGradScheme<Type>
61 {
62  // Private Data
63  //- weights for central stencil
64  const scalar centralWeight_;
65 
66  // Private Member Functions
67 
68  //- Disallow default bitwise assignment
69  void operator=(const quadraticFitSnGrad&);
70 
71 
72 public:
73 
74  //- Runtime type information
75  TypeName("quadraticFit");
76 
77 
78  // Constructors
79 
80  //- Construct from mesh and scheme data
82  (
83  const fvMesh& mesh,
84  const scalar centralWeight
85  )
86  :
88  centralWeight_(centralWeight)
89  {}
90 
91 
92  //- Construct from mesh and data stream
93  quadraticFitSnGrad(const fvMesh& mesh, Istream& is)
94  :
95  snGradScheme<Type>(mesh),
96  centralWeight_(readScalar(is))
97  {}
98 
99 
100  // Destructor
101 
102  virtual ~quadraticFitSnGrad() {}
103 
104 
105  // Member Functions
106 
107  //- Return the interpolation weighting factors for the given field
109  (
111  ) const
112  {
113  return this->mesh().deltaCoeffs();
114  }
115 
116  //- Return true if this scheme uses an explicit correction
117  virtual bool corrected() const
118  {
119  return true;
120  }
121 
122  //- Return the explicit correction to the quadraticFitSnGrad
123  // for the given field
126  {
127  const fvMesh& mesh = this->mesh();
128 
130  (
131  mesh,
132  centralWeight_
133  );
134 
135  const extendedCellToFaceStencil& stencil = qfd.stencil();
136  const List<scalarList>& f = qfd.fit();
137 
139  = stencil.weightedSum(vf, f);
140 
141  sft().dimensions() /= dimLength;
142 
143  return sft;
144  }
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace fv
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************ vim: set sw=4 sts=4 et: ************************ //