fvSchemes.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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::fvSchemes
26 
27 Description
28  Selector class for finite volume differencing schemes.
29  fvMesh is derived from fvSchemes so that all fields have access to the
30  fvSchemes from the mesh reference they hold.
31 
32 SourceFiles
33  fvSchemes.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef fvSchemes_H
38 #define fvSchemes_H
39 
40 #include "IOdictionary.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class fvSchemes Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class fvSchemes
52 :
53  public IOdictionary
54 {
55  // Private Data
56 
57  dictionary ddtSchemes_;
58  ITstream defaultDdtScheme_;
59 
60  dictionary d2dt2Schemes_;
61  ITstream defaultD2dt2Scheme_;
62 
63  dictionary interpolationSchemes_;
64  ITstream defaultInterpolationScheme_;
65 
66  dictionary divSchemes_;
67  ITstream defaultDivScheme_;
68 
69  dictionary gradSchemes_;
70  ITstream defaultGradScheme_;
71 
72  dictionary snGradSchemes_;
73  ITstream defaultSnGradScheme_;
74 
75  dictionary laplacianSchemes_;
76  ITstream defaultLaplacianScheme_;
77 
78  mutable dictionary fluxRequired_;
79  bool defaultFluxRequired_;
80 
81  //- Steady-state run indicator
82  // Set true if the default ddtScheme is steadyState
83  bool steady_;
84 
85 
86  // Private Member Functions
87 
88  //- Clear the dictionaries and streams before reading
89  void clear();
90 
91  //- Read settings from the dictionary
92  void read(const dictionary&);
93 
94  //- Filter group extensions
95  word filterGroup(const word& name) const;
96 
97  //- Lookup and return scheme for name from the schemes dictionary
98  // or return defaultScheme if defined.
99  // Wildcard lookup and group extension are enabled
100  ITstream& lookupScheme
101  (
102  const word& name,
103  const dictionary& schemes,
104  const ITstream& defaultScheme
105  ) const;
106 
107 
108 public:
109 
110  //- Type information
111  ClassName("fvSchemes");
112 
113 
114  // Constructors
115 
116  //- Construct for objectRegistry
117  fvSchemes(const objectRegistry& obr);
118 
119  //- Disallow default bitwise copy construction
120  fvSchemes(const fvSchemes&) = delete;
121 
122 
123  // Member Functions
124 
125  // Access
126 
127  const dictionary& dict() const;
128 
129  ITstream& ddt(const word& name) const;
130 
131  ITstream& d2dt2(const word& name) const;
132 
133  ITstream& interpolation(const word& name) const;
134 
135  ITstream& div(const word& name) const;
136 
137  ITstream& grad(const word& name) const;
138 
139  ITstream& snGrad(const word& name) const;
140 
141  ITstream& laplacian(const word& name) const;
142 
143  void setFluxRequired(const word& name) const;
144 
145  bool fluxRequired(const word& name) const;
146 
147  //- Return true if the default ddtScheme is steadyState
148  bool steady() const
149  {
150  return steady_;
151  }
152 
153  //- Return true if the default ddtScheme is not steadyState
154  bool transient() const
155  {
156  return !steady_;
157  }
158 
159 
160  // Read
161 
162  //- Read the fvSchemes
163  bool read();
164 
165 
166  // Member Operators
167 
168  //- Disallow default bitwise assignment
169  void operator=(const fvSchemes&) = delete;
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Input token stream.
Definition: ITstream.H:53
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:109
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Selector class for finite volume differencing schemes. fvMesh is derived from fvSchemes so that all f...
Definition: fvSchemes.H:53
ClassName("fvSchemes")
Type information.
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:503
ITstream & interpolation(const word &name) const
Definition: fvSchemes.C:468
ITstream & snGrad(const word &name) const
Definition: fvSchemes.C:491
ITstream & grad(const word &name) const
Definition: fvSchemes.C:485
const dictionary & dict() const
Definition: fvSchemes.C:443
ITstream & ddt(const word &name) const
Definition: fvSchemes.C:456
fvSchemes(const objectRegistry &obr)
Construct for objectRegistry.
Definition: fvSchemes.C:304
ITstream & laplacian(const word &name) const
Definition: fvSchemes.C:497
ITstream & div(const word &name) const
Definition: fvSchemes.C:479
bool steady() const
Return true if the default ddtScheme is steadyState.
Definition: fvSchemes.H:147
ITstream & d2dt2(const word &name) const
Definition: fvSchemes.C:462
void operator=(const fvSchemes &)=delete
Disallow default bitwise assignment.
bool read()
Read the fvSchemes.
Definition: fvSchemes.C:425
bool fluxRequired(const word &name) const
Definition: fvSchemes.C:514
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.