setTimeStepFunctionObject.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) 2013-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::setTimeStepFunctionObject
26 
27 Description
28  Updates the time step as a Function1 of time.
29 
30  If the case is running with userTime specified in controlDict then the
31  time-step values returned by the Function1 are assumed to be in user-time
32  rather than real-time.
33 
34  Makes no attempt to cooperate with other timeStep controllers (i.e., solver
35  courant number control or other functionObjects). In general any value set
36  here will be overwritten by solver time-step adjustment if enabled, so for
37  this to work 'adjustTime' should be switched off. This is compatible with
38  'adjustableWriteTime', in which case the time-step values set will not be
39  exactly as specified, but write intervals will be matched exactly.
40 
41  This function supports the 'enabled' flag but none of the other run
42  controls; 'startTime', 'endTime', 'writeControl', etc...
43 
44 SourceFiles
45  setTimeStepFunctionObject.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef functionObjects_setTimeStepFunctionObject_H
50 #define functionObjects_setTimeStepFunctionObject_H
51 
52 #include "functionObject.H"
53 #include "Function1.H"
54 #include "Time.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 namespace functionObjects
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class setTimeStepFunctionObject Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 :
69  public functionObject
70 {
71  // Private Data
72 
73  //- Time step function/table
74  autoPtr<Function1<scalar>> timeStepPtr_;
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("setTimeStep");
81 
82 
83  // Constructors
84 
85  //- Construct from components
87  (
88  const word& name,
89  const Time& runTime,
90  const dictionary& dict
91  );
92 
93  //- Disallow default bitwise copy construction
95 
96 
97  // Destructor
99 
100 
101  // Member Functions
102 
103  //- Read and reset the timeStep Function1
104  virtual bool read(const dictionary&);
105 
106  //- Return the list of fields required
107  virtual wordList fields() const
108  {
109  return wordList::null();
110  }
111 
112  //- Reset the timeStep from the Function1 of time
113  virtual bool execute();
114 
115  //- Do nothing
116  virtual bool write();
117 
118 
119  // Member Operators
120 
121  //- Disallow default bitwise assignment
122  void operator=(const setTimeStepFunctionObject&) = delete;
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace functionObjects
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Abstract base-class for Time/database functionObjects.
const word & name() const
Return the name of this functionObject.
Updates the time step as a Function1 of time.
virtual wordList fields() const
Return the list of fields required.
setTimeStepFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
TypeName("setTimeStep")
Runtime type information.
void operator=(const setTimeStepFunctionObject &)=delete
Disallow default bitwise assignment.
virtual bool execute()
Reset the timeStep from the Function1 of time.
virtual bool read(const dictionary &)
Read and reset the timeStep Function1.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict