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-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
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 
28 Class
29  Foam::simple
30 
31 Description
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 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class simple Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class simple
54 :
56 {
57 private:
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 
68 protected:
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 
105 public:
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  //- Main control loop
138  virtual void solve();
139 
140  //- Looper (advances iters, time step)
141  virtual bool loop();
142 
143  //- Restore initial field values if necessary
144  virtual void restoreInitValues();
145 
146  //- Write average iteration
147  virtual bool writeData(Ostream& os) const;
148 };
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
incompressiblePrimalSolver.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::simple::solverControl_
autoPtr< SIMPLEControl > solverControl_
Solver control.
Definition: simple.H:72
Foam::simple::addExtraSchemes
void addExtraSchemes()
Definition: simple.C:55
Foam::simple::continuityErrors
void continuityErrors()
Compute continuity errors.
Definition: simple.C:69
Foam::simple::cumulativeContErr_
scalar cumulativeContErr_
Cumulative continuity error.
Definition: simple.H:83
Foam::simple
Base class for solution control classes.
Definition: simple.H:52
Foam::simple::objectives_
List< objective * > objectives_
List of objectives related to this primal solver.
Definition: simple.H:86
Foam::simple::solveIter
virtual void solveIter()
Execute one iteration of the solution algorithm.
Definition: simple.C:131
Foam::simple::writeData
virtual bool writeData(Ostream &os) const
Write average iteration.
Definition: simple.C:289
SIMPLEControl.H
Foam::simple::restoreInitValues
virtual void restoreInitValues()
Restore initial field values if necessary.
Definition: simple.C:283
Foam::incompressiblePrimalSolver
Base class for primal incompressible solvers.
Definition: incompressiblePrimalSolver.H:54
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::simple::incoVars_
incompressibleVars & incoVars_
Reference to incompressibleVars.
Definition: simple.H:77
Foam::simple::loop
virtual bool loop()
Looper (advances iters, time step)
Definition: simple.C:277
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
IOMRFZoneList.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::solver::mesh
const fvMesh & mesh() const
Return the solver mesh.
Definition: solver.C:96
Foam::simple::MRF_
IOMRFZoneList MRF_
MRF zones.
Definition: simple.H:80
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::IOMRFZoneList
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
Definition: IOMRFZoneList.H:69
Foam::simple::allocateVars
incompressibleVars & allocateVars()
Protected Member Functions.
Definition: simple.C:48
Foam::simple::~simple
virtual ~simple()=default
Destructor.
Foam::simple::TypeName
TypeName("simple")
Run-time type information.
Foam::simple::readDict
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Definition: simple.C:121
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
objective.H
Foam::solver::dict
virtual const dictionary & dict() const
Return the solver dictionary.
Definition: solver.C:113
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54
Foam::simple::solve
virtual void solve()
Main control loop.
Definition: simple.C:248