FreeFOAM The Cross-Platform CFD Toolkit
limitedSnGrad.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::limitedSnGrad
26 
27 Description
28  Central-difference snGrad scheme with limited non-orthogonal correction.
29 
30  The limiter is controlled by a coefficient with a value between 0 and 1
31  which when 0 switches the correction off and the scheme behaves as
32  uncorrectedSnGrad, when set to 1 the full correction is applied and the
33  scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
34  calculated such that the non-orthogonal contribution does not exceed the
35  orthogonal part.
36 
37 SourceFiles
38  limitedSnGrad.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef limitedSnGrad_H
43 #define limitedSnGrad_H
44 
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace fv
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class limitedSnGrad Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
63 :
64  public snGradScheme<Type>
65 {
66  // Private data
67 
68  scalar limitCoeff_;
69 
70 
71  // Private Member Functions
72 
73  //- Disallow default bitwise assignment
74  void operator=(const limitedSnGrad&);
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("limited");
81 
82 
83  // Constructors
84 
85  //- Construct from mesh
87  :
88  snGradScheme<Type>(mesh)
89  {}
90 
91 
92  //- Construct from mesh and data stream
94  :
95  snGradScheme<Type>(mesh),
96  limitCoeff_(readScalar(is))
97  {
98  if (limitCoeff_ < 0 || limitCoeff_ > 1)
99  {
101  (
102  "limitedSnGrad(const fvMesh& mesh, Istream& is) : ",
103  is
104  ) << "limitCoeff is specified as " << limitCoeff_
105  << " but should be >= 0 && <= 1"
106  << exit(FatalIOError);
107  }
108  }
109 
110 
111  // Destructor
112 
113  virtual ~limitedSnGrad();
114 
115 
116  // Member Functions
117 
118  //- Return the interpolation weighting factors for the given field
120  (
122  ) const
123  {
124  return this->mesh().deltaCoeffs();
125  }
126 
127  //- Return true if this scheme uses an explicit correction
128  virtual bool corrected() const
129  {
130  return !this->mesh().orthogonal();
131  }
132 
133  //- Return the explicit correction to the limitedSnGrad
134  // for the given field
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace fv
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #ifdef NoRepository
152 #endif
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************ vim: set sw=4 sts=4 et: ************************ //