stopAtTimeStep.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) 2023 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::stopAtTimeStep
26 
27 Description
28  Stops the run if the time-step drops below the specified value in seconds
29  and optionally write results before stopping.
30 
31  The following actions are supported:
32  - noWriteNow
33  - writeNow (default)
34  - nextWrite
35 
36  Examples of function object specification:
37  \verbatim
38  stop
39  {
40  type stopAtTimeStep;
41 
42  libs ("libutilityFunctionObjects.so");
43 
44  minDeltaT 1e-8;
45  action writeNow;
46  }
47  \endverbatim
48  will write the fields and stop if the time-step drops below 1e-8s.
49 
50 Usage
51  \table
52  Property | Description | Required | Default value
53  type | type name: stopAtTimeStep | yes |
54  minDeltaT | Minimum time-step [s] | yes |
55  action | Action executed | no | writeNow
56  \endtable
57 
58 SourceFiles
59  stopAtTimeStep.C
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef functionObjects_stopAtTimeStep_H
64 #define functionObjects_stopAtTimeStep_H
65 
66 #include "stopAt.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 namespace functionObjects
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class stopAtTimeStep Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class stopAtTimeStep
80 :
81  public stopAt
82 {
83  // Private Data
84 
85  //- Minimum time-step, below which the run is stopped
86  scalar minDeltaT_;
87 
88 
89  // Private Member Functions
90 
91  //- Return true when the stop condition is achieved
92  virtual bool condition() const;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("stopAtTimeStep");
99 
100 
101  // Constructors
102 
103  //- Construct from Time and dictionary
105  (
106  const word& name,
107  const Time& runTime,
108  const dictionary&
109  );
110 
111  //- Disallow default bitwise copy construction
112  stopAtTimeStep(const stopAtTimeStep&) = delete;
113 
114 
115  //- Destructor
116  virtual ~stopAtTimeStep();
117 
118 
119  // Member Functions
120 
121  //- Read the dictionary settings
122  virtual bool read(const dictionary&);
123 
124 
125  // Member Operators
126 
127  //- Disallow default bitwise assignment
128  void operator=(const stopAtTimeStep&) = delete;
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace functionObjects
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
Stops the run if the time-step drops below the specified value in seconds and optionally write result...
stopAtTimeStep(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
TypeName("stopAtTimeStep")
Runtime type information.
virtual bool read(const dictionary &)
Read the dictionary settings.
void operator=(const stopAtTimeStep &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.