Merge branch 'upstream/OpenFOAM' into master
[freefoam.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / LimitedScheme / NVDVTVDV.H
blob185292f753b8189b04a7435aa174fb948b5e98fb
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::NVDVTVDV
28 Description
29     Foam::NVDVTVDV
31 \*---------------------------------------------------------------------------*/
33 #ifndef NVDVTVDV_H
34 #define NVDVTVDV_H
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 namespace Foam
41 /*---------------------------------------------------------------------------*\
42                            Class LimitedScheme Declaration
43 \*---------------------------------------------------------------------------*/
45 class NVDVTVDV
48 public:
50     typedef vector phiType;
51     typedef tensor gradPhiType;
53     // Null Constructor
55         NVDVTVDV()
56         {}
59     // Member Functions
61         scalar phict
62         (
63             const scalar faceFlux,
64             const vector& phiP,
65             const vector& phiN,
66             const tensor& gradcP,
67             const tensor& gradcN,
68             const vector& d
69         ) const
70         {
71             vector gradfV = phiN - phiP;
72             scalar gradf = gradfV & gradfV;
74             scalar gradcf;
76             if (faceFlux > 0)
77             {
78                 gradcf = gradfV & (d & gradcP);
79             }
80             else
81             {
82                 gradcf = gradfV & (d & gradcN);
83             }
85             // Stabilise for division
86             gradcf = stabilise(gradcf, VSMALL);
87             
88             return 1 - 0.5*gradf/gradcf;
89         }
92         scalar r
93         (
94             const scalar faceFlux,
95             const vector& phiP,
96             const vector& phiN,
97             const tensor& gradcP,
98             const tensor& gradcN,
99             const vector& d
100         ) const
101         {
102             vector gradfV = phiN - phiP;
103             scalar gradf = gradfV & gradfV;
105             scalar gradcf;
107             if (faceFlux > 0)
108             {
109                 gradcf = gradfV & (d & gradcP);
110             }
111             else
112             {
113                 gradcf = gradfV & (d & gradcN);
114             }
116             // Stabilise for division
117             gradf = stabilise(gradf, VSMALL);
119             return 2*(gradcf/gradf) - 1;
120         }
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 } // End namespace Foam
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 #endif
132 // ************************ vim: set sw=4 sts=4 et: ************************ //