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 Data for the upwinded and centred polynomial fit interpolation schemes.
30 The linearCorrection_ determines whether the fit is for a corrected
31 linear scheme (first two coefficients are corrections for owner and
32 neighbour) or a pure upwind scheme (first coefficient is correction for
33 owner ; weight on face taken as 1).
38 \*---------------------------------------------------------------------------*/
43 #include "MeshObject.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class FitData Declaration
53 \*---------------------------------------------------------------------------*/
55 template<class FitDataType, class ExtendedStencil, class Polynomial>
58 public MeshObject<fvMesh, FitDataType>
62 //- The stencil the fit is based on
63 const ExtendedStencil& stencil_;
65 //- Is scheme correction on linear (true) or on upwind (false)
66 const bool linearCorrection_;
68 //- Factor the fit is allowed to deviate from the base scheme
69 // (linear or pure upwind)
70 // This limits the amount of high-order correction and increases
71 // stability on bad meshes
72 const scalar linearLimitFactor_;
74 //- Weights for central stencil
75 const scalar centralWeight_;
77 //- Dimensionality of the geometry
80 //- Minimum stencil size
84 // Private member functions
86 //- Find the normal direction (i) and j and k directions for face faci
89 vector& idir, // value changed in return
90 vector& jdir, // value changed in return
91 vector& kdir, // value changed in return
97 //TypeName("FitData");
102 //- Construct from components
106 const ExtendedStencil& stencil,
107 const bool linearCorrection,
108 const scalar linearLimitFactor,
109 const scalar centralWeight
120 //- Return reference to the stencil
121 const ExtendedStencil& stencil() const
126 bool linearCorrection() const
128 return linearCorrection_;
131 //- Calculate the fit for the specified face and set the coefficients
134 scalarList& coeffsi, // coefficients to be set
135 const List<point>&, // Stencil points
136 const scalar wLin, // Weight for linear approximation (weights
137 // nearest neighbours)
138 const label faci // Current face index
141 //- Calculate the fit for all the faces
142 virtual void calcFit() = 0;
145 //- Recalculate weights (but not stencil) when the mesh moves
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 # include "FitData.C"
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 // ************************************************************************* //