OpenFOAM logo
Open Source CFD Toolkit

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