|
|
|
FitData.HGo 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-2009 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 the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 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, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::FitData 00027 00028 Description 00029 Data for the upwinded and centred polynomial fit interpolation schemes. 00030 The linearCorrection_ determines whether the fit is for a corrected 00031 linear scheme (first two coefficients are corrections for owner and 00032 neighbour) or a pure upwind scheme (first coefficient is correction for 00033 owner ; weight on face taken as 1). 00034 00035 SourceFiles 00036 FitData.C 00037 00038 \*---------------------------------------------------------------------------*/ 00039 00040 #ifndef FitData_H 00041 #define FitData_H 00042 00043 #include "MeshObject.H" 00044 #include "fvMesh.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 /*---------------------------------------------------------------------------*\ 00052 Class FitData Declaration 00053 \*---------------------------------------------------------------------------*/ 00054 00055 template<class FitDataType, class ExtendedStencil, class Polynomial> 00056 class FitData 00057 : 00058 public MeshObject<fvMesh, FitDataType> 00059 { 00060 // Private data 00061 00062 //- The stencil the fit is based on 00063 const ExtendedStencil& stencil_; 00064 00065 //- Is scheme correction on linear (true) or on upwind (false) 00066 const bool linearCorrection_; 00067 00068 //- Factor the fit is allowed to deviate from the base scheme 00069 // (linear or pure upwind) 00070 // This limits the amount of high-order correction and increases 00071 // stability on bad meshes 00072 const scalar linearLimitFactor_; 00073 00074 //- Weights for central stencil 00075 const scalar centralWeight_; 00076 00077 //- Dimensionality of the geometry 00078 const label dim_; 00079 00080 //- Minimum stencil size 00081 const label minSize_; 00082 00083 00084 // Private member functions 00085 00086 //- Find the normal direction (i) and j and k directions for face faci 00087 void findFaceDirs 00088 ( 00089 vector& idir, // value changed in return 00090 vector& jdir, // value changed in return 00091 vector& kdir, // value changed in return 00092 const label faci 00093 ); 00094 00095 public: 00096 00097 //TypeName("FitData"); 00098 00099 00100 // Constructors 00101 00102 //- Construct from components 00103 FitData 00104 ( 00105 const fvMesh& mesh, 00106 const ExtendedStencil& stencil, 00107 const bool linearCorrection, 00108 const scalar linearLimitFactor, 00109 const scalar centralWeight 00110 ); 00111 00112 00113 //- Destructor 00114 virtual ~FitData() 00115 {} 00116 00117 00118 // Member functions 00119 00120 //- Return reference to the stencil 00121 const ExtendedStencil& stencil() const 00122 { 00123 return stencil_; 00124 } 00125 00126 bool linearCorrection() const 00127 { 00128 return linearCorrection_; 00129 } 00130 00131 //- Calculate the fit for the specified face and set the coefficients 00132 void calcFit 00133 ( 00134 scalarList& coeffsi, // coefficients to be set 00135 const List<point>&, // Stencil points 00136 const scalar wLin, // Weight for linear approximation (weights 00137 // nearest neighbours) 00138 const label faci // Current face index 00139 ); 00140 00141 //- Calculate the fit for all the faces 00142 virtual void calcFit() = 0; 00143 00144 00145 //- Recalculate weights (but not stencil) when the mesh moves 00146 bool movePoints(); 00147 }; 00148 00149 00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00151 00152 } // End namespace Foam 00153 00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00155 00156 #ifdef NoRepository 00157 # include "FitData.C" 00158 #endif 00159 00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00161 00162 #endif 00163 00164 // ************************************************************************* // |