Loading...
Searching...
No Matches
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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 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\*---------------------------------------------------------------------------*/
52
53class simple
54:
55 public incompressiblePrimalSolver
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_;
86 //- List of objectives related to this primal solver
88
89 //- Allow the execution of function objects in optimisation mode.
90 // Depending on the functions used and the setup, this might lead
91 // to a high amount of data written to the hard drive.
92 // WIP
94
96 //- Protected Member Functions
97
98 //- Allocate incompressibleVars and return reference to be used for
99 //- convenience in the rest of the class.
101
102 //- In case variable names are different than the base ones,
103 //- add extra schemes and relaxation factors to the appropriate dicts
104 // Note: Not supported for now
105 void addExtraSchemes();
106
107 //- Compute continuity errors
108 void continuityErrors();
109
110
111public:
112
113 // Static Data Members
114
115 //- Run-time type information
116 TypeName("simple");
117
118
119 // Constructors
120
121 //- Construct from mesh and dictionary
122 simple
123 (
124 fvMesh& mesh,
125 const word& managerType,
126 const dictionary& dict,
127 const word& solverName
128 );
129
130
131 //- Destructor
132 virtual ~simple() = default;
133
134
135 // Member Functions
136
137 virtual bool readDict(const dictionary& dict);
139 // Evolution
140
141 //- Execute one iteration of the solution algorithm
142 virtual void solveIter();
143
144 //- Steps to be executed before each main SIMPLE iteration
145 virtual void preIter();
146
147 //- The main SIMPLE iter
148 virtual void mainIter();
149
150 //- Steps to be executed before each main SIMPLE iteration
151 virtual void postIter();
152
153 //- Main control loop
154 virtual void solve();
155
156 //- Looper (advances iters, time step)
157 virtual bool loop();
159 //- Restore initial field values if necessary
160 virtual void restoreInitValues();
161
162 //- Functions to be called before loop
163 virtual void preLoop();
164
165 //- Functions to be called after loop
166 virtual void postLoop();
167
168 //- Write average iteration
169 virtual bool writeData(Ostream& os) const;
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace Foam
176
177
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#endif
181
182// ************************************************************************* //
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Base class for solution control classes.
virtual void postIter()
Steps to be executed before each main SIMPLE iteration.
Definition simple.C:239
autoPtr< SIMPLEControl > solverControl_
Solver control.
Definition simple.H:72
UPtrList< objective > objectives_
List of objectives related to this primal solver.
Definition simple.H:95
scalar cumulativeContErr_
Cumulative continuity error.
Definition simple.H:90
virtual void preIter()
Steps to be executed before each main SIMPLE iteration.
Definition simple.C:137
virtual void restoreInitValues()
Restore initial field values if necessary.
Definition simple.C:288
virtual bool writeData(Ostream &os) const
Write average iteration.
Definition simple.C:323
virtual ~simple()=default
Destructor.
incompressibleVars & allocateVars()
Protected Member Functions.
Definition simple.C:42
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Definition simple.C:119
virtual void mainIter()
The main SIMPLE iter.
Definition simple.C:143
TypeName("simple")
Run-time type information.
bool allowFunctionObjects_
Allow the execution of function objects in optimisation mode.
Definition simple.H:104
void addExtraSchemes()
In case variable names are different than the base ones, add extra schemes and relaxation factors to ...
Definition simple.C:49
incompressibleVars & incoVars_
Reference to incompressibleVars.
Definition simple.H:80
virtual void preLoop()
Functions to be called before loop.
Definition simple.C:294
void continuityErrors()
Compute continuity errors.
Definition simple.C:63
IOMRFZoneList MRF_
MRF zones.
Definition simple.H:85
virtual void postLoop()
Functions to be called after loop.
Definition simple.C:311
virtual bool loop()
Looper (advances iters, time step).
Definition simple.C:282
virtual void solveIter()
Execute one iteration of the solution algorithm.
Definition simple.C:129
virtual void solve()
Main control loop.
Definition simple.C:267
const word & managerType() const
Return the manager type.
Definition solverI.H:72
const dictionary & dict() const
Return the solver dictionary.
Definition solverI.H:54
const fvMesh & mesh() const
Return the solver mesh.
Definition solverI.H:24
const word & solverName() const
Return the solver name.
Definition solverI.H:30
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
const dictionary & simple
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68