1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
31 \*---------------------------------------------------------------------------*/
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 /*---------------------------------------------------------------------------*\
42 Class NVDVTVDV Declaration
43 \*---------------------------------------------------------------------------*/
50 typedef vector phiType;
51 typedef tensor gradPhiType;
63 const scalar faceFlux,
71 vector gradfV = phiN - phiP;
72 scalar gradf = gradfV & gradfV;
78 gradcf = gradfV & (d & gradcP);
82 gradcf = gradfV & (d & gradcN);
85 // Stabilise for division
86 gradcf = stabilise(gradcf, SMALL);
88 return 1 - 0.5*gradf/gradcf;
94 const scalar faceFlux,
102 vector gradfV = phiN - phiP;
103 scalar gradf = gradfV & gradfV;
109 gradcf = gradfV & (d & gradcP);
113 gradcf = gradfV & (d & gradcN);
116 // Stabilise for division
117 // Changed to SMALL to prevent FPE. OB, 14/Jan/2011
118 gradf = stabilise(gradf, SMALL);
120 // New formulation. Oliver Borm and Aleks Jemcov
122 return max(2*(gradcf/gradf) - 1, 0);
124 // return 2*(gradcf/gradf) - 1;
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 } // End namespace Foam
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 // ************************************************************************* //