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