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::NVDTVD 00026 00027 Description 00028 Foam::NVDTVD 00029 00030 \*---------------------------------------------------------------------------*/ 00031 00032 #ifndef NVDTVD_H 00033 #define NVDTVD_H 00034 00035 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00036 00037 namespace Foam 00038 { 00039 00040 /*---------------------------------------------------------------------------*\ 00041 Class LimitedScheme Declaration 00042 \*---------------------------------------------------------------------------*/ 00043 00044 class NVDTVD 00045 { 00046 00047 public: 00048 00049 typedef scalar phiType; 00050 typedef vector gradPhiType; 00051 00052 00053 // Null Constructor 00054 00055 NVDTVD() 00056 {} 00057 00058 00059 // Member Functions 00060 00061 scalar phict 00062 ( 00063 const scalar faceFlux, 00064 const scalar phiP, 00065 const scalar phiN, 00066 const vector& gradcP, 00067 const vector& gradcN, 00068 const vector& d 00069 ) const 00070 { 00071 scalar gradf = phiN - phiP; 00072 00073 scalar gradcf; 00074 00075 if (faceFlux > 0) 00076 { 00077 gradcf = d & gradcP; 00078 } 00079 else 00080 { 00081 gradcf = d & gradcN; 00082 } 00083 00084 // Stabilise for division 00085 gradcf = stabilise(gradcf, VSMALL); 00086 00087 return 1 - 0.5*gradf/gradcf; 00088 } 00089 00090 00091 scalar r 00092 ( 00093 const scalar faceFlux, 00094 const scalar phiP, 00095 const scalar phiN, 00096 const vector& gradcP, 00097 const vector& gradcN, 00098 const vector& d 00099 ) const 00100 { 00101 scalar gradf = phiN - phiP; 00102 00103 scalar gradcf; 00104 00105 if (faceFlux > 0) 00106 { 00107 gradcf = d & gradcP; 00108 } 00109 else 00110 { 00111 gradcf = d & gradcN; 00112 } 00113 00114 // Stabilise for division 00115 gradf = stabilise(gradf, VSMALL); 00116 00117 return 2*(gradcf/gradf) - 1; 00118 } 00119 }; 00120 00121 00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00123 00124 } // End namespace Foam 00125 00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00127 00128 #endif 00129 00130 // ************************ vim: set sw=4 sts=4 et: ************************ //