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-2026 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 fvSchemes
92  void readDict();
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  ITstream& ddt(const word& name) const;
128 
129  ITstream& d2dt2(const word& name) const;
130 
131  ITstream& interpolation(const word& name) const;
132 
133  ITstream& div(const word& name) const;
134 
135  ITstream& grad(const word& name) const;
136 
137  ITstream& snGrad(const word& name) const;
138 
139  ITstream& laplacian(const word& name) const;
140 
141  void setFluxRequired(const word& name) const;
142 
143  bool fluxRequired(const word& name) const;
144 
145  //- Return true if the default ddtScheme is steadyState
146  bool steady() const
147  {
148  return steady_;
149  }
150 
151  //- Return true if the default ddtScheme is not steadyState
152  bool transient() const
153  {
154  return !steady_;
155  }
156 
157 
158  // Read
159 
160  //- Read the fvSchemes
161  bool read();
162 
163 
164  // Member Operators
165 
166  //- Disallow default bitwise assignment
167  void operator=(const fvSchemes&) = delete;
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Input token stream.
Definition: ITstream.H:56
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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:434
ITstream & interpolation(const word &name) const
Definition: fvSchemes.C:399
ITstream & snGrad(const word &name) const
Definition: fvSchemes.C:422
ITstream & grad(const word &name) const
Definition: fvSchemes.C:416
ITstream & ddt(const word &name) const
Definition: fvSchemes.C:387
fvSchemes(const objectRegistry &obr)
Construct for objectRegistry.
Definition: fvSchemes.C:304
ITstream & laplacian(const word &name) const
Definition: fvSchemes.C:428
ITstream & div(const word &name) const
Definition: fvSchemes.C:410
bool steady() const
Return true if the default ddtScheme is steadyState.
Definition: fvSchemes.H:145
ITstream & d2dt2(const word &name) const
Definition: fvSchemes.C:393
void operator=(const fvSchemes &)=delete
Disallow default bitwise assignment.
bool read()
Read the fvSchemes.
Definition: fvSchemes.C:369
bool fluxRequired(const word &name) const
Definition: fvSchemes.C:445
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.