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