initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / LimitedScheme / NVDTVD.H
blob80de6148cbb3fe6bf00cea7744378be1f26f73f2
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::NVDTVD
28 Description
29     Foam::NVDTVD
31 \*---------------------------------------------------------------------------*/
33 #ifndef NVDTVD_H
34 #define NVDTVD_H
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 namespace Foam
41 /*---------------------------------------------------------------------------*\
42                            Class LimitedScheme Declaration
43 \*---------------------------------------------------------------------------*/
45 class NVDTVD
48 public:
50     typedef scalar phiType;
51     typedef vector gradPhiType;
54     // Null Constructor
56         NVDTVD()
57         {}
60     // Member Functions
62         scalar phict
63         (
64             const scalar faceFlux,
65             const scalar phiP,
66             const scalar phiN,
67             const vector& gradcP,
68             const vector& gradcN,
69             const vector& d
70         ) const
71         {
72             scalar gradf = phiN - phiP;
74             scalar gradcf;
76             if (faceFlux > 0)
77             {
78                 gradcf = d & gradcP;
79             }
80             else
81             {
82                 gradcf = d & gradcN;
83             }
85             // Stabilise for division
86             gradcf = stabilise(gradcf, VSMALL);
88             return 1 - 0.5*gradf/gradcf;
89         }
92         scalar r
93         (
94             const scalar faceFlux,
95             const scalar phiP,
96             const scalar phiN,
97             const vector& gradcP,
98             const vector& gradcN,
99             const vector& d
100         ) const
101         {
102             scalar gradf = phiN - phiP;
104             scalar gradcf;
106             if (faceFlux > 0)
107             {
108                 gradcf = d & gradcP;
109             }
110             else
111             {
112                 gradcf = d & gradcN;
113             }
115             // Stabilise for division
116             gradf = stabilise(gradf, VSMALL);
118             return 2*(gradcf/gradf) - 1;
119         }
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 } // End namespace Foam
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 #endif
131 // ************************************************************************* //