fvSchemes.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fvSchemes
29 
30 Description
31  Selector class for finite volume differencing schemes.
32  fvMesh is derived from fvShemes so that all fields have access to the
33  fvSchemes from the mesh reference they hold.
34 
35 SourceFiles
36  fvSchemes.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef fvSchemes_H
41 #define fvSchemes_H
42 
43 #include "IOdictionary.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class fvSchemes Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class fvSchemes
55 :
56  public IOdictionary
57 {
58  // Private data
59 
60  dictionary ddtSchemes_;
61  ITstream defaultDdtScheme_;
62 
63  dictionary d2dt2Schemes_;
64  ITstream defaultD2dt2Scheme_;
65 
66  dictionary interpolationSchemes_;
67  ITstream defaultInterpolationScheme_;
68 
69  dictionary divSchemes_;
70  ITstream defaultDivScheme_;
71 
72  dictionary gradSchemes_;
73  ITstream defaultGradScheme_;
74 
75  dictionary snGradSchemes_;
76  ITstream defaultSnGradScheme_;
77 
78  dictionary laplacianSchemes_;
79  ITstream defaultLaplacianScheme_;
80 
81  mutable dictionary fluxRequired_;
82  bool defaultFluxRequired_;
83 
84  //- Steady-state run indicator
85  // Set true if the default ddtScheme is steadyState
86  bool steady_;
87 
88 
89  // Private Member Functions
90 
91  //- Clear the dictionaries and streams before reading
92  void clear();
93 
94  //- Read settings from the dictionary
95  void read(const dictionary&);
96 
97  //- No copy construct
98  fvSchemes(const fvSchemes&) = delete;
99 
100  //- No copy assignment
101  void operator=(const fvSchemes&) = delete;
102 
103 
104 public:
105 
106  //- Debug switch
107  static int debug;
108 
109 
110  // Constructors
111 
112  //- Construct for objectRegistry
113  fvSchemes(const objectRegistry& obr);
114 
115  //- Construct from objectRegistry and supplied (optional) content
116  // (gets used in case of NO_READ or fvSchemes dictionary cannot be
117  // read)
118  fvSchemes(const objectRegistry& obr, const dictionary& dict);
119 
120 
121  // Member Functions
122 
123  // Access
124 
125  const dictionary& schemesDict() const;
126 
127  ITstream& ddtScheme(const word& name) const;
128 
129  ITstream& d2dt2Scheme(const word& name) const;
130 
131  ITstream& interpolationScheme(const word& name) const;
132 
133  ITstream& divScheme(const word& name) const;
134 
135  ITstream& gradScheme(const word& name) const;
136 
137  ITstream& snGradScheme(const word& name) const;
138 
139  ITstream& laplacianScheme(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 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fvSchemes::ddtScheme
ITstream & ddtScheme(const word &name) const
Definition: fvSchemes.C:493
Foam::fvSchemes
Selector class for finite volume differencing schemes. fvMesh is derived from fvShemes so that all fi...
Definition: fvSchemes.H:53
Foam::fvSchemes::divScheme
ITstream & divScheme(const word &name) const
Definition: fvSchemes.C:554
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:82
Foam::fvSchemes::read
bool read()
Read the fvSchemes.
Definition: fvSchemes.C:466
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::fvSchemes::debug
static int debug
Debug switch.
Definition: fvSchemes.H:106
Foam::fvSchemes::setFluxRequired
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:630
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:55
Foam::fvSchemes::gradScheme
ITstream & gradScheme(const word &name) const
Definition: fvSchemes.C:573
Foam::fvSchemes::schemesDict
const dictionary & schemesDict() const
Definition: fvSchemes.C:482
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvSchemes::snGradScheme
ITstream & snGradScheme(const word &name) const
Definition: fvSchemes.C:592
Foam::fvSchemes::fluxRequired
bool fluxRequired(const word &name) const
Definition: fvSchemes.C:641
Foam::fvSchemes::steady
bool steady() const
Return true if the default ddtScheme is steadyState.
Definition: fvSchemes.H:145
IOdictionary.H
Foam::fvSchemes::interpolationScheme
ITstream & interpolationScheme(const word &name) const
Definition: fvSchemes.C:531
Foam::fvSchemes::d2dt2Scheme
ITstream & d2dt2Scheme(const word &name) const
Definition: fvSchemes.C:512
Foam::fvSchemes::laplacianScheme
ITstream & laplacianScheme(const word &name) const
Definition: fvSchemes.C:611