SIMPLEControlSingleRun.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 
29 Class
30  Foam::SIMPLEControlSingleRun
31 
32 Description
33  SIMPLE control class for single runs (i.e. not optimisation).
34  Time acts as in simpleFoam, with all solver control read through
35  optimisationDict
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef SIMPLEControlSingleRun_H
40 #define SIMPLEControlSingleRun_H
41 
42 #include "SIMPLEControl.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SIMPLEControlSingleRun Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public SIMPLEControl
56 {
57 protected:
58 
59  // Protected Data
60 
61  //- Start time
62  scalar startTime_;
63 
64  //- End time
65  scalar endTime_;
66 
67 
68  // Protected Member Functions
69 
70  //- Read controls from optimisationDict
71  virtual bool read();
72 
73  //- Set end time if number of iters has changed
74  virtual void readIters();
75 
76  //- Check whether endTime has been overwritten by a run-time
77  //- modification of controlDict
78  void checkEndTime(bool& isRunning);
79 
80 
81 private:
82 
83  //- No copy construct
85 
86  //- No copy assignment
87  void operator=(const SIMPLEControlSingleRun&) = delete;
88 
89 
90 public:
91 
92  // Static Data Members
93 
94  //- Run-time type information
95  TypeName("singleRun");
96 
97 
98  // Constructors
99 
100  //- Construct from mesh
102  (
103  fvMesh& mesh,
104  const word& managerType,
105  const solver& solver
106  );
107 
108 
109  //- Destructor
110  virtual ~SIMPLEControlSingleRun() = default;
111 
112 
113  // Member Functions
114 
115  // Solution control
116 
117  //- Whether to call time.write() or not
118  virtual bool write(const bool valid = true) const;
119 
120  //- Write fields, even if it is not a writeTime
121  void writeNow();
122 
123  // Evolution
124 
125  //- Loop
126  virtual bool loop();
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
Foam::SIMPLEControlSingleRun
SIMPLE control class for single runs (i.e. not optimisation). Time acts as in simpleFoam,...
Definition: SIMPLEControlSingleRun.H:52
Foam::SIMPLEControlSingleRun::~SIMPLEControlSingleRun
virtual ~SIMPLEControlSingleRun()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::SIMPLEControlSingleRun::readIters
virtual void readIters()
Set end time if number of iters has changed.
Definition: SIMPLEControlSingleRun.C:55
Foam::SIMPLEControlSingleRun::loop
virtual bool loop()
Loop.
Definition: SIMPLEControlSingleRun.C:131
Foam::SIMPLEControlSingleRun::TypeName
TypeName("singleRun")
Run-time type information.
Foam::solver
Base class for solution control classes.
Definition: solver.H:51
SIMPLEControl.H
Foam::SIMPLEControlSingleRun::startTime_
scalar startTime_
Start time.
Definition: SIMPLEControlSingleRun.H:61
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SIMPLEControlSingleRun::write
virtual bool write(const bool valid=true) const
Whether to call time.write() or not.
Definition: SIMPLEControlSingleRun.C:108
Foam::SIMPLEControlSingleRun::writeNow
void writeNow()
Write fields, even if it is not a writeTime.
Definition: SIMPLEControlSingleRun.C:118
Foam::SIMPLEControlSingleRun::endTime_
scalar endTime_
End time.
Definition: SIMPLEControlSingleRun.H:64
Foam::SIMPLEControlSingleRun::checkEndTime
void checkEndTime(bool &isRunning)
Definition: SIMPLEControlSingleRun.C:74
Foam::SIMPLEControlSingleRun::read
virtual bool read()
Read controls from optimisationDict.
Definition: SIMPLEControlSingleRun.C:49
Foam::SIMPLEControl
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: SIMPLEControl.H:52