FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::NVDVTVDV
00026 
00027 Description
00028     Foam::NVDVTVDV
00029 
00030 \*---------------------------------------------------------------------------*/
00031 
00032 #ifndef NVDVTVDV_H
00033 #define NVDVTVDV_H
00034 
00035 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00036 
00037 namespace Foam
00038 {
00039 
00040 /*---------------------------------------------------------------------------*\
00041                            Class LimitedScheme Declaration
00042 \*---------------------------------------------------------------------------*/
00043 
00044 class NVDVTVDV
00045 {
00046 
00047 public:
00048 
00049     typedef vector phiType;
00050     typedef tensor gradPhiType;
00051 
00052     // Null Constructor
00053 
00054         NVDVTVDV()
00055         {}
00056 
00057 
00058     // Member Functions
00059 
00060         scalar phict
00061         (
00062             const scalar faceFlux,
00063             const vector& phiP,
00064             const vector& phiN,
00065             const tensor& gradcP,
00066             const tensor& gradcN,
00067             const vector& d
00068         ) const
00069         {
00070             vector gradfV = phiN - phiP;
00071             scalar gradf = gradfV & gradfV;
00072 
00073             scalar gradcf;
00074 
00075             if (faceFlux > 0)
00076             {
00077                 gradcf = gradfV & (d & gradcP);
00078             }
00079             else
00080             {
00081                 gradcf = gradfV & (d & gradcN);
00082             }
00083 
00084             // Stabilise for division
00085             gradcf = stabilise(gradcf, VSMALL);
00086             
00087             return 1 - 0.5*gradf/gradcf;
00088         }
00089 
00090 
00091         scalar r
00092         (
00093             const scalar faceFlux,
00094             const vector& phiP,
00095             const vector& phiN,
00096             const tensor& gradcP,
00097             const tensor& gradcN,
00098             const vector& d
00099         ) const
00100         {
00101             vector gradfV = phiN - phiP;
00102             scalar gradf = gradfV & gradfV;
00103 
00104             scalar gradcf;
00105 
00106             if (faceFlux > 0)
00107             {
00108                 gradcf = gradfV & (d & gradcP);
00109             }
00110             else
00111             {
00112                 gradcf = gradfV & (d & gradcN);
00113             }
00114 
00115             // Stabilise for division
00116             gradf = stabilise(gradf, VSMALL);
00117 
00118             return 2*(gradcf/gradf) - 1;
00119         }
00120 };
00121 
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 } // End namespace Foam
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 #endif
00130 
00131 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines