FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

FitData.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::FitData
00026 
00027 Description
00028     Data for the upwinded and centred polynomial fit interpolation schemes.
00029     The linearCorrection_ determines whether the fit is for a corrected
00030     linear scheme (first two coefficients are corrections for owner and
00031     neighbour) or a pure upwind scheme (first coefficient is correction for
00032     owner ; weight on face taken as 1).
00033 
00034 SourceFiles
00035     FitData.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef FitData_H
00040 #define FitData_H
00041 
00042 #include <OpenFOAM/MeshObject.H>
00043 #include <finiteVolume/fvMesh.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                     Class FitData Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 template<class FitDataType, class ExtendedStencil, class Polynomial>
00055 class FitData
00056 :
00057     public MeshObject<fvMesh, FitDataType>
00058 {
00059     // Private data
00060 
00061         //- The stencil the fit is based on
00062         const ExtendedStencil& stencil_;
00063 
00064         //- Is scheme correction on linear (true) or on upwind (false)
00065         const bool linearCorrection_;
00066 
00067         //- Factor the fit is allowed to deviate from the base scheme
00068         //  (linear or pure upwind)
00069         //  This limits the amount of high-order correction and increases
00070         //  stability on bad meshes
00071         const scalar linearLimitFactor_;
00072 
00073         //- Weights for central stencil
00074         const scalar centralWeight_;
00075 
00076         //- Dimensionality of the geometry
00077         const label dim_;
00078 
00079         //- Minimum stencil size
00080         const label minSize_;
00081 
00082 
00083     // Private member functions
00084 
00085         //- Find the normal direction (i) and j and k directions for face faci
00086         void findFaceDirs
00087         (
00088             vector& idir,        // value changed in return
00089             vector& jdir,        // value changed in return
00090             vector& kdir,        // value changed in return
00091             const label faci
00092         );
00093 
00094 public:
00095 
00096     //TypeName("FitData");
00097 
00098 
00099     // Constructors
00100 
00101         //- Construct from components
00102         FitData
00103         (
00104             const fvMesh& mesh,
00105             const ExtendedStencil& stencil,
00106             const bool linearCorrection,
00107             const scalar linearLimitFactor,
00108             const scalar centralWeight
00109         );
00110 
00111 
00112     //- Destructor
00113     virtual ~FitData()
00114     {}
00115 
00116 
00117     // Member functions
00118 
00119         //- Return reference to the stencil
00120         const ExtendedStencil& stencil() const
00121         {
00122             return stencil_;
00123         }
00124 
00125         bool linearCorrection() const
00126         {
00127             return linearCorrection_;
00128         }
00129 
00130         //- Calculate the fit for the specified face and set the coefficients
00131         void calcFit
00132         (
00133             scalarList& coeffsi, // coefficients to be set
00134             const List<point>&,  // Stencil points
00135             const scalar wLin,   // Weight for linear approximation (weights
00136                                  // nearest neighbours)
00137             const label faci     // Current face index
00138         );
00139 
00140         //- Calculate the fit for all the faces
00141         virtual void calcFit() = 0;
00142 
00143 
00144         //- Recalculate weights (but not stencil) when the mesh moves
00145         bool movePoints();
00146 };
00147 
00148 
00149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00150 
00151 } // End namespace Foam
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 #ifdef NoRepository
00156 #   include "FitData.C"
00157 #endif
00158 
00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00160 
00161 #endif
00162 
00163 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines