gaussConvectionScheme.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) 2011-2014 OpenFOAM Foundation
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::gaussConvectionScheme
26 
27 Description
28  Basic second-order convection using face-gradients and Gauss' theorem.
29 
30 SourceFiles
31  gaussConvectionScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef gaussConvectionScheme_H
36 #define gaussConvectionScheme_H
37 
38 #include "convectionScheme.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace fv
48 {
49 
50 //- Temporary debug switch to provide warning about backward-compatibility
51 // issue with setting div schemes for steady-state
52 extern int warnUnboundedGauss;
53 
54 /*---------------------------------------------------------------------------*\
55  Class gaussConvectionScheme Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Type>
60 :
61  public fv::convectionScheme<Type>
62 {
63  // Private data
64 
65  tmp<surfaceInterpolationScheme<Type> > tinterpScheme_;
66 
67 
68  // Private Member Functions
69 
70  //- Disallow default bitwise copy construct
72 
73  //- Disallow default bitwise assignment
74  void operator=(const gaussConvectionScheme&);
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("Gauss");
81 
82 
83  // Constructors
84 
85  //- Construct from flux and interpolation scheme
87  (
88  const fvMesh& mesh,
89  const surfaceScalarField& faceFlux,
91  )
92  :
93  convectionScheme<Type>(mesh, faceFlux),
94  tinterpScheme_(scheme)
95  {}
96 
97  //- Construct from flux and Istream
99  (
100  const fvMesh& mesh,
101  const surfaceScalarField& faceFlux,
102  Istream& is
103  )
104  :
105  convectionScheme<Type>(mesh, faceFlux),
106  tinterpScheme_
107  (
108  surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
109  )
110  {
111  is.rewind();
112  word bounded(is);
113 
114  if
115  (
116  warnUnboundedGauss
117  && word(mesh.ddtScheme("default")) == "steadyState"
118  && bounded != "bounded"
119  )
120  {
121  fileNameList controlDictFiles(findEtcFiles("controlDict"));
122 
123  IOWarningIn("gaussConvectionScheme", is)
124  << "Unbounded 'Gauss' div scheme used in "
125  "steady-state solver, use 'bounded Gauss' "
126  "to ensure boundedness.\n"
127  << " To remove this warning switch off "
128  << "'warnUnboundedGauss' in "
129  << controlDictFiles[controlDictFiles.size()-1]
130  << endl;
131  }
132  }
133 
134 
135  // Member Functions
136 
138 
140  (
141  const surfaceScalarField&,
143  ) const;
144 
146  (
147  const surfaceScalarField&,
149  ) const;
150 
152  (
153  const surfaceScalarField&,
155  ) const;
156 
158  (
159  const surfaceScalarField&,
161  ) const;
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace fv
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #ifdef NoRepository
176 # include "gaussConvectionScheme.C"
177 #endif
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
fileNameList findEtcFiles(const fileName &, bool mandatory=false, bool findFirst=false)
Search for files from user/group/shipped directories.
Definition: POSIX.C:272
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
int warnUnboundedGauss
Temporary debug switch to provide warning about backward-compatibility.
const surfaceInterpolationScheme< Type > & interpScheme() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A class for handling words, derived from string.
Definition: word.H:59
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
const fvMesh & mesh() const
Return mesh reference.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
Namespace for OpenFOAM.
#define IOWarningIn(functionName, ios)
Report an IO warning using Foam::Warning.
ITstream & ddtScheme(const word &name) const
Definition: fvSchemes.C:360
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
static tmp< convectionScheme< Type > > New(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &schemeData)
Return a pointer to a new convectionScheme created on freestore.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Abstract base class for surface interpolation schemes.
Basic second-order convection using face-gradients and Gauss&#39; theorem.
tmp< fvMatrix< Type > > fvmDiv(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
virtual Istream & rewind()=0
Rewind and return the stream so that it may be read again.
TypeName("Gauss")
Runtime type information.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
Abstract base class for convection schemes.
labelList fv(nPoints)
tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDiv(const surfaceScalarField &, const GeometricField< Type, fvPatchField, volMesh > &) const
A class for managing temporary objects.
Definition: PtrList.H:118
tmp< surfaceInterpolationScheme< Type > > scheme(const surfaceScalarField &faceFlux, Istream &streamData)