simple.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) 2007-2020 PCOpt/NTUA
9 Copyright (C) 2013-2020 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28Class
29 Foam::simple
30
31Description
32 Base class for solution control classes
33
34\*---------------------------------------------------------------------------*/
35
36#ifndef simple_H
37#define simple_H
38
40#include "SIMPLEControl.H"
41#include "IOMRFZoneList.H"
42#include "objective.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class simple Declaration
51\*---------------------------------------------------------------------------*/
53class simple
54:
56{
57private:
58
59 // Private Member Functions
60
61 //- No copy construct
62 simple(const simple&) = delete;
63
64 //- No copy assignment
65 void operator=(const simple&) = delete;
66
67
68protected:
69
70 // Protected data
71
72 //- Solver control
74
75 //- Reference to incompressibleVars
76 // Used for convenience and to avoid repetitive dynamic_casts
77 // Same as getIncoVars()
79
80 //- MRF zones
82
83 //- Cumulative continuity error
84 scalar cumulativeContErr_;
85
86 //- List of objectives related to this primal solver
88
89
90 //- Protected Member Functions
91
92 //- Allocate incompressibleVars and return reference to be used for
93 //- convenience in the rest of the class.
95
96 //- In case variable names are different than the base ones,
97 //- add extra schemes and relaxation factors to the appropriate dicts
98 // Note: Not supported for now
99 void addExtraSchemes();
100
101 //- Compute continuity errors
102 void continuityErrors();
103
104
105public:
106
107 // Static Data Members
108
109 //- Run-time type information
110 TypeName("simple");
111
112
113 // Constructors
114
115 //- Construct from mesh and dictionary
116 simple
117 (
118 fvMesh& mesh,
119 const word& managerType,
120 const dictionary& dict
121 );
122
123
124 //- Destructor
125 virtual ~simple() = default;
126
127
128 // Member Functions
129
130 virtual bool readDict(const dictionary& dict);
131
132 // Evolution
133
134 //- Execute one iteration of the solution algorithm
135 virtual void solveIter();
136
137 //- Steps to be executed before each main SIMPLE iteration
138 virtual void preIter();
139
140 //- The main SIMPLE iter
141 virtual void mainIter();
142
143 //- Steps to be executed before each main SIMPLE iteration
144 virtual void postIter();
145
146 //- Main control loop
147 virtual void solve();
148
149 //- Looper (advances iters, time step)
150 virtual bool loop();
151
152 //- Restore initial field values if necessary
153 virtual void restoreInitValues();
154
155 //- Functions to be called before loop
156 virtual void preLoop();
157
158 //- Functions to be called after loop
159 virtual void postLoop();
160
161 //- Write average iteration
162 virtual bool writeData(Ostream& os) const;
163};
164
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168} // End namespace Foam
169
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173#endif
174
175// ************************************************************************* //
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
Definition: IOMRFZoneList.H:75
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Base class for primal incompressible solvers.
Base class for solution control classes.
Base class for solution control classes.
Definition: simple.H:55
virtual void postIter()
Steps to be executed before each main SIMPLE iteration.
Definition: simple.C:238
autoPtr< SIMPLEControl > solverControl_
Solver control.
Definition: simple.H:72
scalar cumulativeContErr_
Cumulative continuity error.
Definition: simple.H:83
List< objective * > objectives_
List of objectives related to this primal solver.
Definition: simple.H:86
virtual void preIter()
Steps to be executed before each main SIMPLE iteration.
Definition: simple.C:136
virtual void restoreInitValues()
Restore initial field values if necessary.
Definition: simple.C:280
virtual bool writeData(Ostream &os) const
Write average iteration.
Definition: simple.C:315
virtual ~simple()=default
Destructor.
incompressibleVars & allocateVars()
Protected Member Functions.
Definition: simple.C:49
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Definition: simple.C:118
virtual void mainIter()
The main SIMPLE iter.
Definition: simple.C:142
TypeName("simple")
Run-time type information.
void addExtraSchemes()
Definition: simple.C:56
incompressibleVars & incoVars_
Reference to incompressibleVars.
Definition: simple.H:77
virtual void preLoop()
Functions to be called before loop.
Definition: simple.C:286
void continuityErrors()
Compute continuity errors.
Definition: simple.C:70
IOMRFZoneList MRF_
MRF zones.
Definition: simple.H:80
virtual void postLoop()
Functions to be called after loop.
Definition: simple.C:303
virtual bool loop()
Looper (advances iters, time step)
Definition: simple.C:274
virtual void solveIter()
Execute one iteration of the solution algorithm.
Definition: simple.C:128
virtual void solve()
Main control loop.
Definition: simple.C:259
virtual const dictionary & dict() const
Return the solver dictionary.
Definition: solver.C:113
const fvMesh & mesh() const
Return the solver mesh.
Definition: solver.C:96
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73