OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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