stopAtClockTime.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::stopAtClockTime
26 
27 Description
28  Stops the run when the specified clock time in seconds has been reached
29  and optionally write results before stopping.
30 
31  The following actions are supported:
32  - noWriteNow
33  - writeNow
34  - nextWrite (default)
35 
36  Examples of function object specification:
37  \verbatim
38  stop
39  {
40  type stopAtClockTime;
41 
42  libs ("libutilityFunctionObjects.so");
43 
44  stopTime 10;
45  action writeNow;
46  }
47  \endverbatim
48  will write the fields and stop the run once the clock time has exceeded 10
49  seconds.
50 
51 Usage
52  \table
53  Property | Description | Required | Default value
54  type | type name: stopAtClockTime | yes |
55  stopTime | Maximum elapsed time [s] | yes |
56  action | Action executed | no | nextWrite
57  \endtable
58 
59 SourceFiles
60  stopAtClockTime.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef functionObjects_stopAtClockTime_H
65 #define functionObjects_stopAtClockTime_H
66 
67 #include "stopAt.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 namespace functionObjects
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class stopAtClockTime Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class stopAtClockTime
81 :
82  public stopAt
83 {
84  // Private Data
85 
86  //-
87  time_t stopTime_;
88 
89 
90  // Private Member Functions
91 
92  //- Return true when the stop condition is achieved
93  virtual bool condition() const;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("stopAtClockTime");
100 
101 
102  // Constructors
103 
104  //- Construct from Time and dictionary
106  (
107  const word& name,
108  const Time& runTime,
109  const dictionary&
110  );
111 
112  //- Disallow default bitwise copy construction
113  stopAtClockTime(const stopAtClockTime&) = delete;
114 
115 
116  //- Destructor
117  virtual ~stopAtClockTime();
118 
119 
120  // Member Functions
121 
122  //- Read the dictionary settings
123  virtual bool read(const dictionary&);
124 
125 
126  // Member Operators
127 
128  //- Disallow default bitwise assignment
129  void operator=(const stopAtClockTime&) = delete;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace functionObjects
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
const word & name() const
Return the name of this functionObject.
stopAtClockTime(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
TypeName("stopAtClockTime")
Runtime type information.
Stops the run when the specified clock time in seconds has been reached and optionally write results ...
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read the dictionary settings.
Namespace for OpenFOAM.
void operator=(const stopAtClockTime &)=delete
Disallow default bitwise assignment.