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-2021 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  libs ("libutilityFunctionObjects.so");
42  stopTime 10;
43  action writeNow;
44  }
45  \endverbatim
46  will write the fields and stop the run once the clock time has exceeded 10
47  seconds.
48 
49 Usage
50  \table
51  Property | Description | Required | Default value
52  type | type name: stopAtClockTime | yes |
53  stopTime | Maximum elapsed time [s] | yes |
54  action | Action executed | no | nextWrite
55  \endtable
56 
57 SourceFiles
58  stopAtClockTime.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef functionObjects_stopAtClockTime_H
63 #define functionObjects_stopAtClockTime_H
64 
65 #include "stopAt.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class stopAtClockTime Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class stopAtClockTime
79 :
80  public stopAt
81 {
82  // Private Data
83 
84  //-
85  time_t stopTime_;
86 
87 
88  // Private Member Functions
89 
90  //- Return true when the stop condition is achieved
91  virtual bool condition() const;
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("stopAtClockTime");
98 
99 
100  // Constructors
101 
102  //- Construct from Time and dictionary
104  (
105  const word& name,
106  const Time& runTime,
107  const dictionary&
108  );
109 
110  //- Disallow default bitwise copy construction
111  stopAtClockTime(const stopAtClockTime&) = delete;
112 
113 
114  //- Destructor
115  virtual ~stopAtClockTime();
116 
117 
118  // Member Functions
119 
120  //- Read the dictionary settings
121  virtual bool read(const dictionary&);
122 
123 
124  // Member Operators
125 
126  //- Disallow default bitwise assignment
127  void operator=(const stopAtClockTime&) = delete;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace functionObjects
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
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
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
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.