NVDVTVDV.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2012 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::NVDVTVDV
28
29Description
30 Foam::NVDVTVDV
31
32\*---------------------------------------------------------------------------*/
33
34#ifndef NVDVTVDV_H
35#define NVDVTVDV_H
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
39namespace Foam
40{
41
42/*---------------------------------------------------------------------------*\
43 Class LimitedScheme Declaration
44\*---------------------------------------------------------------------------*/
46class NVDVTVDV
47{
48
49public:
51 typedef vector phiType;
52 typedef tensor gradPhiType;
53
54 // Null Constructor
56 NVDVTVDV()
57 {}
58
59
60 // Member Functions
62 scalar phict
63 (
64 const scalar faceFlux,
65 const vector& phiP,
66 const vector& phiN,
67 const tensor& gradcP,
68 const tensor& gradcN,
69 const vector& d
70 ) const
71 {
72 vector gradfV = phiN - phiP;
73 scalar gradf = gradfV & gradfV;
74
75 scalar gradcf;
76
77 if (faceFlux > 0)
78 {
79 gradcf = gradfV & (d & gradcP);
80 }
81 else
82 {
83 gradcf = gradfV & (d & gradcN);
84 }
85
86 if (mag(gradf) >= 1000*mag(gradcf))
87 {
88 return 1 - 0.5*1000*sign(gradcf)*sign(gradf);
89 }
90 else
91 {
92 return 1 - 0.5*gradf/gradcf;
93 }
94 }
95
97 scalar r
98 (
99 const scalar faceFlux,
100 const vector& phiP,
101 const vector& phiN,
102 const tensor& gradcP,
103 const tensor& gradcN,
104 const vector& d
105 ) const
106 {
107 vector gradfV = phiN - phiP;
108 scalar gradf = gradfV & gradfV;
109
110 scalar gradcf;
111
112 if (faceFlux > 0)
113 {
114 gradcf = gradfV & (d & gradcP);
115 }
116 else
117 {
118 gradcf = gradfV & (d & gradcN);
119 }
120
121 if (mag(gradcf) >= 1000*mag(gradf))
122 {
123 return 2*1000*sign(gradcf)*sign(gradf) - 1;
124 }
125 else
126 {
127 return 2*(gradcf/gradf) - 1;
128 }
129 }
130};
131
132
133// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134
135} // End namespace Foam
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139#endif
140
141// ************************************************************************* //
Foam::NVDVTVDV.
Definition: NVDVTVDV.H:46
scalar r(const scalar faceFlux, const vector &phiP, const vector &phiN, const tensor &gradcP, const tensor &gradcN, const vector &d) const
Definition: NVDVTVDV.H:97
scalar phict(const scalar faceFlux, const vector &phiP, const vector &phiN, const tensor &gradcP, const tensor &gradcN, const vector &d) const
Definition: NVDVTVDV.H:62
vector phiType
Definition: NVDVTVDV.H:50
tensor gradPhiType
Definition: NVDVTVDV.H:51
Namespace for OpenFOAM.
dimensionedScalar sign(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)