|
|
|
filteredLinear.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-2007 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 filteredLinearLimiter 00027 00028 Description 00029 Class to generate weighting factors for the filtered-linear differencing 00030 scheme. The aim is to remove high-frequency modes with "staggering" 00031 characteristics by comparing the face gradient relative to the background 00032 distribution represented by the neighbouring cell gradients with those 00033 gradients and introduce small amounts of upwind in order to damp these 00034 modes. 00035 00036 Used in conjunction with the template class LimitedScheme. 00037 00038 SourceFiles 00039 filteredLinear.C 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef filteredLinear_H 00044 #define filteredLinear_H 00045 00046 #include "vector.H" 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class filteredLinearWeight Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 template<class LimiterFunc> 00058 class filteredLinearLimiter 00059 : 00060 public LimiterFunc 00061 { 00062 00063 public: 00064 00065 filteredLinearLimiter(Istream&) 00066 {} 00067 00068 scalar limiter 00069 ( 00070 const scalar cdWeight, 00071 const scalar faceFlux, 00072 const typename LimiterFunc::phiType& phiP, 00073 const typename LimiterFunc::phiType& phiN, 00074 const typename LimiterFunc::gradPhiType& gradcP, 00075 const typename LimiterFunc::gradPhiType& gradcN, 00076 const vector& d 00077 ) const 00078 { 00079 scalar df = phiN - phiP; 00080 00081 scalar dcP = d & gradcP; 00082 scalar dcN = d & gradcN; 00083 00084 scalar limiter = 00085 2 00086 - 0.5*min(mag(df - dcP), mag(df - dcN)) 00087 /(max(mag(dcP), mag(dcN)) + SMALL); 00088 00089 // Limit the limiter between linear and 20% upwind 00090 return max(min(limiter, 1), 0.8); 00091 } 00092 }; 00093 00094 00095 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00096 00097 } // End namespace Foam 00098 00099 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00100 00101 #endif 00102 00103 // ************************************************************************* // |