1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 Data for the upwinded and centred polynomial fit interpolation schemes.
29 The linearCorrection_ determines whether the fit is for a corrected
30 linear scheme (first two coefficients are corrections for owner and
31 neighbour) or a pure upwind scheme (first coefficient is correction for
32 owner ; weight on face taken as 1).
37 \*---------------------------------------------------------------------------*/
42 #include "MeshObject.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class FitData Declaration
52 \*---------------------------------------------------------------------------*/
54 template<class FitDataType, class ExtendedStencil, class Polynomial>
57 public MeshObject<fvMesh, FitDataType>
61 //- The stencil the fit is based on
62 const ExtendedStencil& stencil_;
64 //- Is scheme correction on linear (true) or on upwind (false)
65 const bool linearCorrection_;
67 //- Factor the fit is allowed to deviate from the base scheme
68 // (linear or pure upwind)
69 // This limits the amount of high-order correction and increases
70 // stability on bad meshes
71 const scalar linearLimitFactor_;
73 //- Weights for central stencil
74 const scalar centralWeight_;
76 //- Dimensionality of the geometry
79 //- Minimum stencil size
83 // Private Member Functions
85 //- Find the normal direction (i) and j and k directions for face faci
88 vector& idir, // value changed in return
89 vector& jdir, // value changed in return
90 vector& kdir, // value changed in return
96 //TypeName("FitData");
101 //- Construct from components
105 const ExtendedStencil& stencil,
106 const bool linearCorrection,
107 const scalar linearLimitFactor,
108 const scalar centralWeight
119 //- Return reference to the stencil
120 const ExtendedStencil& stencil() const
125 bool linearCorrection() const
127 return linearCorrection_;
130 //- Calculate the fit for the specified face and set the coefficients
133 scalarList& coeffsi, // coefficients to be set
134 const List<point>&, // Stencil points
135 const scalar wLin, // Weight for linear approximation (weights
136 // nearest neighbours)
137 const label faci // Current face index
140 //- Calculate the fit for all the faces
141 virtual void calcFit() = 0;
144 //- Recalculate weights (but not stencil) when the mesh moves
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 # include "FitData.C"
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 // ************************************************************************* //